Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Created September 16, 2019 14:45
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 Gro-Tsen/babe6c252684fb008e0f3e0058521f88 to your computer and use it in GitHub Desktop.
Save Gro-Tsen/babe6c252684fb008e0f3e0058521f88 to your computer and use it in GitHub Desktop.
### Speed up ×6:
ffmpeg -f concat -safe 0 -i =(for file in /mnt/ext/data/100GOPRO/GH??0012.MP4 ; do echo file $file ; done) -vf select='eq(mod(n\,25)\,0)+eq(mod(n\,25)\,6)+eq(mod(n\,25)\,12)+eq(mod(n\,25)\,18)',scale=960:540,setpts=N/24/TB,fps=24 -c:v libx264 -crf 26 -an /tmp/timelapse-combined/tl-gopro.mp4 ; done
ls /mnt/usbkey/AUKEY/Movie/2019_0915_*B.MP4 | perl -ne 'print "$1\n" if m/(2019_0915_[0-9]{6}_[0-9]{3}B\.MP4)/' > /tmp/filelist
for f in $(cat /tmp/filelist) ; do ffmpeg -i "/mnt/usbkey/AUKEY/Movie/${f}" -vf select='(eq(mod(n\,15)\,0)+eq(mod(n\,15)\,7))*lt(n\,5400)',scale=960:540,setpts=N/24/TB,fps=24 -c:v libx264 -crf 26 -an /tmp/timelapse-combined/tl-dashcam-${f%.MP4}.mp4 ; done
## I have no idea why this causes errors
# convert 'xc:gray[960x540!]' /tmp/timelapse-combined/gray.png
# ffmpeg -r 24 -f concat -safe 0 -i =(for i in $(seq 1349) ; do echo file /tmp/timelapse-combined/gray.png ; done) -c:v libx264 -an -pix_fmt yuv420p /tmp/timelapse-combined/gray.mp4
# ffmpeg -i /tmp/timelapse-combined/gray.mp4 -vf setpts=N/24/TB,fps=24 -c:v libx264 -an /tmp/timelapse-combined/tl-dashcam-2019_0915_110952_079MISSING.mp4
ffmpeg -i /mnt/usbkey/AUKEY/Movie/$(head -1 /tmp/filelist) -vf select='lt(n\,1349)',geq=128,scale=960:540,setpts=N/24/TB,fps=24 -c:v libx264 -crf 26 -an /tmp/timelapse-combined/tl-dashcam-2019_0915_110952_079MISSING.mp4
ffmpeg -f concat -safe 0 -i =(for file in /tmp/timelapse-combined/tl-dashcam-2019*.mp4 ; do echo file $file ; done) -c:v copy -an /tmp/timelapse-combined/tl-dashcam-full.mp4
## Still not correctly sync'ed, hence the need for the *0.9998 here: WHY???
ffmpeg -i /tmp/timelapse-combined/tl-gopro.mp4 -i /tmp/timelapse-combined/tl-dashcam-full.mp4 -filter_complex '[0:v]setpts=(PTS-365/24/TB)*(0.9998)[int0];[1:v]pad=iw:ih*2[int1];[int1][int0]overlay=0:H/2:shortest=1[vid]' -map '[vid]' -c:v libx264 -crf 26 -an /tmp/timelapse-combined/tl-combined.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment