[FFmpeg-user] ffmpeg pip issues

Lukácsy Gergely Gergely.Lukacsy at streamnet.hu
Tue May 7 14:53:30 CEST 2013


Okay, tested it with the newest build, and works like a charm!

Regarding case # 2, I managed to come out with a workable solution, and I would share my results with you. Here's the command (it works with short main / long overlay videos and vice versa):
 
	ffmpeg -y -i pip3.mp4 -i pip2.mp4 -r 25 -filter_complex "nullsrc=size=688x320:duration=20, lutrgb=r=0:g=0:b=0 [bg];[0]scale=688x320 [main]; [1]scale=288:162 [pip]; [0][1] amix=inputs=2:duration=longest;[bg][main] overlay=repeatlast=0 [base];[base][pip] overlay=main_w-overlay_w-10:10:repeatlast=0" -b:v 600k -c:v libx264 -f mp4 out01.mp4

First, the program generates a blank "canvas". (nullsrc=size=688x320:duration=20, lutrgb=r=0:g=0:b=0)
Size attribute is nessesary, because the default value is realy small. Duration is also an important part, if you forget it, and your main record is shorter, ffmpeg will sit in an endless loop for some reason.

Next, I rescale the size of the main video, so it will not appear to be trimmed down. I have no idea why, but when I miss this step, the video  resolution will be same as the second input. It's especially problematic when you have a large main, and a smaller overlay resolutions. (Does anybody have any idea about this?)

Then, I apply the main layer to the black picture (which is as long as the overlay), and in the next step, apply the overlay to the output of the previous step. 

regards,
Gergely Lukácsy


More information about the ffmpeg-user mailing list