Skip to content

Instantly share code, notes, and snippets.

@ctrlcctrlv
Last active March 26, 2022 14:55
Show Gist options
  • Select an option

  • Save ctrlcctrlv/85dd2ebead7f79e50536fa84738afc7c to your computer and use it in GitHub Desktop.

Select an option

Save ctrlcctrlv/85dd2ebead7f79e50536fa84738afc7c to your computer and use it in GitHub Desktop.
ffmpeg jeopardy thinking music generator
#!/bin/bash
function ffstreamlength ()
{
ffprobe -print_format json -show_streams "$1" 2> /dev/null |\
jq '.streams[]|select(.codec_type=="audio")|.tags.DURATION' -r |\
awk 'BEGIN { FS=":" } {printf "%.0f\n", ($1*60*60)+($2*60)+$3}'
}
COL=010b79
# you may need to remove _nvenc if you don't have nvidia
ffmpeg -f lavfi -i "color=$COL@1.0:size=1688x2388" -f gif -i tap.gif -i jeo1997.mka -shortest\
-c:v h264_nvenc -c:a aac -filter_complex "[1:v]loop=100:100[loop],[0][loop]overlay,\
scale=1024:576:force_original_aspect_ratio=decrease,pad=1024:576:('ow-iw')/2:('oh-ih')/2:$COL,\
setsar=1,drawtext=fontfile=korinna.otf:text='%{eif\:`ffstreamlength jeo1997.mka`-t+2\:d}':\
fontcolor=white:fontsize=72:x=w-tw-72:y=72" tap97.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment