[FFmpeg-user] Pictures in video

Cecil Westerhof Cecil at decebal.nl
Wed May 25 00:57:14 EEST 2022


Michael Koch <astroelectronic at t-online.de> writes:

> Am 24.05.2022 um 21:55 schrieb Cecil Westerhof via ffmpeg-user:
>> With a search on the internet I found I could put a picture into a
>> video with:
>>      ffmpeg -i introductie.mkv -i Pictures/reiger.jpg \
>>      -filter_complex "[0:v][1:v] overlay=W-w:H-h:enable='between(t,0,20)'" \
>>      -pix_fmt yuv420p -c:a copy \
>>      metReiger.mp4
>>
>> But what if I would insert another picture at another time?
>> Or two at the same time? One top left, the other top right.
>
> You can use two or more overlay filters in the filter chain:
> ffmpeg -i introductie.mkv -i image1.jpg -i image2.jpg -filter_complex
> "[0:v][1:v] 
> overlay=W-w:H-h:enable='between(t,0,20)'[a];[a][2:v]overlay=W-w:H-h:enable='between(t,21,25)'"
> ...
>
>> What I find strange is that the input video is 23 MB and the picture
>> is 302 KB, but the generated video is 42 MB.
>
> You can for example specify the bitrate with -b:v

I changed it to:
    ffmpeg -i introductie.mkv -i Pictures/reiger.jpg -i Pictures/vlinder.jpg \
    -filter_complex "[0:v][1:v] overlay=10:10:enable='between(t, 0, 20)'[a];[a][2:v]overlay=W-w-10:10:enable='between(t, 0, 20)'" \
    -pix_fmt yuv420p -c:a copy -vcodec libx265 -preset veryfast -crf 30 \
    metReigerEnVlinder.mp4

and it works.

Thanks.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list