[FFmpeg-user] video overlay scaling issue or am I doing it wrong ?

neonira Arinoem neonira at gmail.com
Tue Dec 1 10:19:36 EET 2020

I have a main video named *assembled-video.mp4*, that has size *1058x594*
codec H.264 25 fps 57 kbps

I want the following three 5 seconds video to be overlaid respectively at
time 10s, 70s and 189s.

*video-msg01.mp4*, that has size *400x86* codec H.264 25 fps 11 Kbs
*video-msg02.mp4*, that has size *400x86* codec H.264 25 fps 11 Kbs
*video-msg03.mp4*, that has size *650x86* codec H.264 25 fps 16 Kbs

To generate overlay file I used following command lines

/code/mylinux/bin/video-utils/mergeMovieIntoMovie.bash assembled-video.mp4
video-msg01.mp4 5 10 400 86 G
assembled-video-merged.mp4 video-msg02.mp4 70 75 400 86 G
assembled-video-merged-merged.mp4 video-msg03.mp4 189 194 650 86 G

Find *mergeMovieIntoMovie.bash *as attachment. To make it clear this script
takes the background-video as first argument, the video to overlay as
second argument, and then start and end time of overlay, and video overlay
width and height. The final G is just a flag for verbosity. Mainly this
script does
ffmpeg -i $MOVIE_FILE -i $INSERT_FILE -s 1054x594 -filter_complex "[0:v][1:v]
overlay=0:0:enable='between(t,$3,$4)'" -pix_fmt yuv420p -c:v libx264 -c:a
copy $TFN -y

This roughly works but there is an annoying issue I am currently unable to
understand and solve.

First overlay works correctly. Second and third overlays appear twice as
big as the first overlay.
Got absolutely no clue about the origin of this. Any idea to get a proper
result is welcome.

Got also some newbie questions or confirmation requests

1. how to get the size of a video using ffmpeg ?
2. Does the bitrate have any importance during overlay ?
3. Is there a smarter way to achieve this result in just one pass?

Thanks in advance for suggestions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mergeMovieIntoMovie.bash
Type: application/octet-stream
Size: 1588 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20201201/6d7a1978/attachment.obj>

More information about the ffmpeg-user mailing list