Have you even needed to create picture in picture videos, either for presentation purposes or just to create a fun video? Recently I had to create such a video and while I was going through the various solutions on the internet, I struggled to find a free tool that can do the trick.
As in most cases, I ended up trying to find out a command line tool that can deliver a PIP solution. This tool is ffmpeg.
Below you can see an example command that could deliver what I required.
$ ffmpeg -itsoffset 30 -i video_pip.mp4 -i video_master.mp4 -filter_complex "[0]scale=iw/3:ih/3 [pip]; [1][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,30,75)'" -profile:v main -level 3.1 -b:v 440k -ar 44100 -ab 128k -s 1920x1080 -vcodec h264 -acodec libfaac output.mp4
Selective flags explanation:
-itsoffset 30: Delay "video_pip.mp4" by 30 seconds (only works with video files that support time-stamps, so not .avi files)
[0]scale=iw/3:ih/3 [pip]: Scale the video with index 0 (video_pip.mp4) 1/3 of the size.
[1][pip]: Keep the sound from file with index 1 (video_master.mp4).
main_w-overlay_w-10:main_h-overlay_h-10: Location of the PIP image on the video.
between(t,30,75): Time between which the video will be visible. When the video finishes, the last frame will be visible until the time specified.
It is obvious that that the tool can be customized by changing the above flags or by adding new ones to deliver what you will need. If you have any questions just check the manual og ffmpeg
$ man ffmpeg and $ ffmpeg --help