Skip to content

Instantly share code, notes, and snippets.

@wader
Last active November 10, 2023 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wader/d7a5789833c053db3e39b1ee0e358c3e to your computer and use it in GitHub Desktop.
Save wader/d7a5789833c053db3e39b1ee0e358c3e to your computer and use it in GitHub Desktop.
jupyter notebook bash kernel audio and video player helper script
#!/bin/sh
# Usage in cell to autoplay and loop:
# ffmpeg ... && ./player -al test.mp4
# -a for autoplay
# -l for loop
# -m for mute
# -w <width> for video player width
# -h <height> for video player height
TAGS="controls"
while getopts "almh:w:" arg; do
case $arg in
a) TAGS="$TAGS autoplay";;
l) TAGS="$TAGS loop";;
m) TAGS="$TAGS mute";;
w) TAGS="$TAGS width=$OPTARG";;
h) TAGS="$TAGS height=$OPTARG";;
esac
done
shift $(($OPTIND - 1))
F=$(mktemp)
echo "<video $TAGS src=\"$1\"></video>" > "$F"
echo "bash_kernel: saved html data to: ($F) $F"
@wader
Copy link
Author

wader commented Nov 10, 2023

Screenshot 2023-11-10 at 12 37 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment