Skip to content

Instantly share code, notes, and snippets.

@jnbek
Last active April 27, 2022 15:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnbek/ad15ad30a5a30399c8b27f18deb7d33e to your computer and use it in GitHub Desktop.
Save jnbek/ad15ad30a5a30399c8b27f18deb7d33e to your computer and use it in GitHub Desktop.
Some ffmpeg things I may need
#Unfortunately, this isn't perfect yet, it prints the date/time in real time, while the timelapse proceeds at 5x, need to figure this part out.
#See: https://superuser.com/questions/1013753/how-can-i-overlay-the-captured-timestamp-onto-a-video-using-ffmpeg-in-yyyy-mm-dd
ffmpeg -f concat -safe 0 -i .\mylist.txt -i aliengeek.gif -i cagar.mp3 -filter_complex drawtext="fontfile=Pacifico.ttf: text='%{localtime\:%c}':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=44:fontcolor=white",select='not(mod(n\,5))',setpts=N/FRAME_RATE/TB,fps=60,"overlay=x=main_w-overlay_w-(main_w*0.01):y=main_h-overlay_h-(main_h*0.01)" -vcodec libx264 -map 0:v:0 -map 2:a:0 -c:a aac -b:a 192k -shortest timelapse_all.mp4
ffmpeg -f concat -safe 0 -i vidlist.txt -i aliengeek.gif -i 151.mp3 -filter_complex "drawtext=text='%{pts\:localtime\:$(date --date=7am +%s)}':x='(w-text_w)'/32:y=10:font=Vera:fontsize=40:alpha=0.5:box=1:boxborderw=4",select='not(mod(n\,5))',setpts=N/FRAME_RATE/TB,fps=30,"overlay=x=main_w-overlay_w-(main_w*0.01):y=main_h-overlay_h-(main_h*0.01)" -vcodec libx264 -map 0:v:0 -map 2:a:0 -c:a aac -b:a 192k -shortest -y timelapse_all.mp4
ffmpeg -i .\20220216_235314.mp4 -vf mpdecimate=frac='0.55':hi='(64*25)':lo='(64*10)',setpts=N/FRAME_RATE/TB -an -y out_2.mp4
# 125x -> 1080p@60fps
ffmpeg -f concat -safe 0 -i .\mylist.txt -i aliengeek.gif -filter_complex select='not(mod(n\,125))',setpts=N/FRAME_RATE/TB,fps=60,"overlay=x=main_w-overlay_w-(main_w*0.01):y=main_h-overlay_h-(main_h*0.01)" -vcodec libx264 -an timelapse.mp4
# Powershell
foreach ($i in Get-ChildItem .\*.MOV) {echo "file '$i'" >> mylist.txt}
# Bash/Zsh/etc
printf "file '%s'\n" *.MOV > mylist.txt
##
# At 33x to 1080p@60fps
ffmpeg -f concat -safe 0 -i .\mylist.txt -vf select='not(mod(n\,33))',setpts=N/FRAME_RATE/TB,fps=60 -vcodec libx264 -an timelapse.mp4
#Unfortunately, this isn't perfect yet, it prints the date/time in real time, while the timelapse proceeds at 5x, need to figure this part out.
ffmpeg -i 20200901_125219.MOV -i aliengeek.gif -i cagar.mp3 -filter_complex drawtext="fontfile=Pacifico.ttf: text='%{localtime\:%c}':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=44:fontcolor=white",select='not(mod(n\,5))',setpts=N/FRAME_RATE/TB,fps=60,"overlay=x=main_w-overlay_w-(main_w*0.01):y=main_h-overlay_h-(main_h*0.01)" -vcodec libx264 -map 0:v:0 -map 2:a:0 -c:a aac -b:a 192k -shortest timelapse_mp3.mp4
# At 5x to 1080p@60fps
ffmpeg -i .\20200901_122654.MOV -vf select='not(mod(n\,5))',setpts=N/FRAME_RATE/TB,fps=60 -vcodec libx264 -an timelapse.mp4
#125x to 1080p@60fps
ffmpeg -f concat -safe 0 -i .\mylist.txt -i aliengeek.gif -i cagar.mp3 -filter_complex select='not(mod(n\,125))',setpts=N/FRAME_RATE/TB,fps=60,"overlay=x=main_w-overlay_w-(main_w*0.01):y=main_h-overlay_h-(main_h*0.01)" -vcodec libx264 -map 0:v:0 -map 2:a:0 -c:a aac -b:a 192k -shortest timelapse_mp3.mp4
# This is ugly and sounds like shit... but syntax example none the less...
ffplay.exe -i .\cagar.mp3 -af acompressor=threshold=0.150:ratio=2:attack=200:release=1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment