[FFmpeg-user] ffmpeg pip issues

Lukácsy Gergely Gergely.Lukacsy at streamnet.hu
Tue May 7 12:57:21 CEST 2013


I'm recently trying to generate picture-in-picture videos with ffmpeg, and I've run accross with some issues when handling videos with different lengths.
The normal situation with equal lengths works well with the following command:

                ffmpeg -y -i main.mp4 -i pip.mp4 -r 25 -t 20 -filter_complex "[1]scale=iw/5:ih/5 [pip]; [0][pip] overlay=main_w-overlay_w-10:10" -b:v 600k -c:v libx264 -f mp4 out.mp4

However, different lengths causing some problems:
                Case 1: Main video is LONGER:
                               The main video has no problems and goes all the way to the end without errors, but the overlay freezes when reaching the last frame.
                               I've added the 'repeatlast=0' option to the overlay filter hoping that it'll solve the problem: '[0][pip] overlay=main_w-overlay_w-10:10:repeatlast=0', but all I've got is this error message:

                                               [overlay @ 00000000021c7680] Option 'repeatlast' not found
                                               [AVFilterGraph @ 000000000228e760] Error initializing filter 'overlay' with args 'main_w-overlay_w-10:10:repeatlast=0'
                                               Error configuring filters.

                               What's wrong with the syntax? Is it possible to make the PIP image dissappear when it has reached the end?

                Case 2: Main video is SHORTER:
                               Both main and overlay stops at the end of the main video.
                               Since I need full length, I've put the time ('-t') option in the command with the length of the longest file (altough it has no effect).

                               Surprisingly, when I've mixed the audiochannels with 'amix' filter, ffmpeg generated a full length video, but the picture freezes at the critical point. Sound can be heared full length of the recording. The main video is usually containing still images, (like text, pictures, diagrams, etc.) so this issue is not a big problem in this case.

                                               ffmpeg -y -i main.mp4 -i pip_long.mp4 -map 1:1 -r 25 -t 20 -filter_complex "[1]scale=iw/5:ih/5 [pip];[1][0]amix=inputs=2:duration=longest;[0][pip]overlay=main_w-overlay_w-10:10:repeatlast=0" -b:v 600k -c:v libx264 -f mp4 out.mp4

                               It gives repeatadely this warning after reaching the edge:
                                               Buffer queue overflow, dropping.     703kB time=00:00:19.80 bitrate= 290.8kbits/s
                                               [Parsed_overlay_2 @ 0000000002098340] Buffer queue overflow, dropping.
                                               Last message repeated ### times

                               So, is it possible to make the overlay play after the main layer is frozen? Is there any workaround for this, like, filling the shorter video with the last frame, before the overlay filter?

                               I'm using zeranoes' ffmpeg build version N-49610-gc2dd5a1 on Win7x64.

                Thanks in advance!

Regards: G.

More information about the ffmpeg-user mailing list