Skip to content

Instantly share code, notes, and snippets.

@timabell
Last active May 16, 2020 18:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save timabell/26716d7773b61d7b586c5a1babe8fb28 to your computer and use it in GitHub Desktop.
combine cycliq videos on a linux commandline
# https://gist.github.com/timabell/26716d7773b61d7b586c5a1babe8fb28
# make a picture in picture video from multiple front/back camera chunked video files
# expects files in folders `front/` and `back/`
mkdir -p output
# front
# concat file chunks together https://trac.ffmpeg.org/wiki/Concatenate
ls front/*.MP4 | awk '{print "file " "'\''" $0 "'\''"}' | tee front-files.txt
ffmpeg -f concat -i front-files.txt -c copy -flags +global_header -acodec libvo_aacenc output/front.mp4
# back
# concat file chunks together https://trac.ffmpeg.org/wiki/Concatenate
ls back/*.MP4 | awk '{print "file " "'\''" $0 "'\''"}' | tee back-files.txt
ffmpeg -f concat -i back-files.txt -c copy -flags +global_header -acodec libvo_aacenc output/back.mp4
# combine front and back
# https://www.oodlestechnologies.com/blogs/PICTURE-IN-PICTURE-effect-using-FFMPEG/
ffmpeg -i output/front.mp4 -i output/back.mp4 -filter_complex \
"[1]scale=iw/5:ih/5 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" \
-s 1920x1090 -vcodec h264 -acodec libvo_aacenc output/pip.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment