I have an overlayed video which can be longer or shorter than the background video.
Case 1: If the background video is longer, the video should end when the overlayed video is over.
Case 2: If the background video is shorter, it should repeat the last frame of the video until the overlayed video is over.
With the shortest=1
and eof_action
commands I haven't been able to achieve this without compromising one of the above cases. For example with shortest=1
in the overlay command, case #1 works but in case #2, both videos freeze when the background video ends while the audio plays out.
Note that only the overlayed video has audio. Thanks!
Apply the following filter to the bg video: tpad=stop=-1:stop_mode=clone
and use eof_action=endall
in overlay.