Last active
December 21, 2015 08:38
-
-
Save errkk/6279024 to your computer and use it in GitHub Desktop.
Composite a PNG over an input video frame by frame
This file contains 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
avconv -i input.mp4 -f image2 frames/f_%00d.jpg | |
for F in $(ls frames/) | |
do | |
composite -compose atop -gravity SouthWest overlay_frame.png frames/$F out/$F | |
done | |
avconv -f image2 -i out/f_%00d.jpg out.mpeg -b 2400kb |
This file contains 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
ffmpeg -i input.mp4 -i yorkshire_seq/f_%03d.png -filter_complex overlay=0:0 -q:v 1 -f mpeg tmp.mpeg && | |
ffmpeg -i tmp.mpeg -loop 1 -i frame.png -filter_complex overlay=0:0 -shortest -acodec aac -strict -2 out.mpeg && | |
rm tmp.mpeg |
This file contains 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
echo 'Numbering frames from 181' | |
COUNTER=181 | |
for F in $(ls yorkshire_seq/) | |
do | |
echo $F | |
mv yorkshire_seq/$F yorkshire_seq/f_$(printf "%03g" $COUNTER).png | |
COUNTER=$((COUNTER+1)) | |
done | |
echo 'Filling preceding frames with copy of the first one' | |
COUNTER=0 | |
while [ $COUNTER -lt 181 ] | |
do | |
cp yorkshire_seq/f_181.png yorkshire_seq/f_$(printf "%03g" $COUNTER).png | |
COUNTER=$((COUNTER+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment