Last active
November 10, 2023 12:08
-
-
Save wader/d7a5789833c053db3e39b1ee0e358c3e to your computer and use it in GitHub Desktop.
jupyter notebook bash kernel audio and video player helper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Author
wader
commented
Nov 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment