Today, we show how to add a picture on a video using the advanced settings / options from ffmpeg. This process can actually be used to overlay any types of photos (.jpg, .png, .gif) or image to a video. All parameters can be customized to suit your needs.
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
EXAMPLES
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Picture overlay. Dynamic position
→ ffmpeg -i input.mp4 -vf "movie=image.jpg[layer];[in][layer]overlay=t*64:t*36[out]" output01.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-vf "movie=image.jpg [layer] = … imports «image.jpg» calling it [layer].
[in][layer] = Loads, in order, the original video ([in]) and the layer ([layer])…
overlay = … and overlays both (last loaded on top)…
t*64 = … moving the overlaid picture by 64 pixels horizontally …
t*36 = … and by 36 pixels vertically every (t) second …
[out] = … calling the result [out].
output01.mp4 = Outputs finally the whole to file «output01.mp4»
❷ Picture overlay centered. Blinking effect
→ ffmpeg -i input.mp4 -vf "movie=image.jpg[layer];[layer]scale=400:-1[layer2];[in][layer2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable='lt(mod(t,3),1)'[out]" output02.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-vf "movie=image.jpg [layer] = … imports «image.jpg» calling it [layer].
[layer]scale=400:-1[layer2] = Resizes now [layer] to 400 pixels width calling the result [layer2]… Note: -1 means keeps initial proportions so the height is automatically calculated (in this case = 225)
[in][layer2] overlay = … and overlays, as before, the resulting [layer2] on top of the original video [in]…
(main_w-overlay_w)/2:(main_h-overlay_h)/2 = … setting the picture so that it appears centered …
enable='lt(mod(t,3),1) = … while appearing every 3 seconds…
[out] = … calling the result [out].
output02.mp4 = Outputs finally the whole to file «output02.mp4»
❸ Picture overlay. Dynamic position time enabled
→ ffmpeg -i input.mp4 -vf "movie=image.jpg[layer];[layer]scale=400:-1[layer2];[in][layer2]overlay=t*128:'if(lt(t,5),0,(t-5)*72)':enable='between(t,0,3)+between(t,5,9)'[out2]" output03.mp4
with:
-i input.mp4 = Reads file «input.mp4» and …
-vf "movie=image.jpg [layer] = … imports «image.jpg» calling it [layer].
[layer]scale=400:-1 [layer2] = Resizes now [layer] to 400 pixels width calling the result [layer2]… Note: -1 means keeps initial proportions so the height is automatically calculated (in this case = 225)
[in][layer2] overlay = … and overlays, as before, the resulting [layer2] on top of the original video [in]…
enable='between(t,0,3) = … showing the picture between seconds 0 and 3 …
t*128 = … moving horizontally at 128 pixels per second … Note: between seconds 0 and 3 the value for y calculated per statement if(lt(t,5),0,(t-5)*72) gives us 0
between(t,5,9) = … and between seconds 5 and 9 …
t*128:'if(lt(t,5),0,(t-5)*72) = … moving horizontally at 128 pixels per second and vertically at 72 pixels per second …. Note: between seconds 5 and 9 the value for y calculated per statement if(lt(t,5),0,(t-5)*72) gives us y=(t-5)*72 i.e. starts at y=0 when t =5
[out2] = … calling the result [out2].
-output03.mp4 = Outputs finally the whole to file «output03.mp4»
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
• ALL THE VIDEOS FROM THE CHANNEL
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Sunspots - Jeremy Blake
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
Watch video How to overlay a picture on a video | Advanced dynamic settings to add a photo online without registration, duration hours minute second in high quality. This video was added by user The FFMPEG guy 07 November 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,092 once and liked it 28 people.