FFmpeg Picture in Picture

by GarciaPL on Thursday 29 May 2014

In this post you can find a small piece of code which should allows you to make picture in picture using ffmpeg. More information about this effect you can find in reference section of this post.

ffmpeg -i \tmp\stream1.mp4 -r 29.97 -vf "movie=\tmp\stream2.mp4, scale=212:120 [vid2]; [in][vid2] overlay=main_w-overlay_w-10:10 [out]" \tmp\output.mp4 &

I used ampersand at the end of this command because I would like to create a new process of merging those two input videos files in background. I also uploaded below some example how it should looks like in final. I pointed using red circle the video which was added using stream2.mp4 source. Do not hesitate to modify this command above. I'm sure that you will adapt it for your own purposes.

Picture in Picture using FFmpeg

Reference : [1] Picture-in-picture Wikipedia