I am using ffmpeg to create a composite video with multiple overlays onto a static background. I notice that ffmpeg creates a separate output stream in the output mp4 file for each overlay. Ideally, I would like these to be 'flattened' into a single stream. Is it possible to do this?
Here is simple example of what I mean - in this case I have a background 'logo' video onto which is being overlaid another video which is scaled to be a half the size of the background and is positioned in the top left corner of the output:
ffmpeg -i LOGO.mp4 -i VIDEO.mp4
-filter_complex "[1][0]scale2ref=iw/2:-2[scaled];
[0][scaled]overlay=x=0:y=0[composite]"
-map [composite]
-y OUTPUT.mp4
The resulting video has two video streams as shown by the output from ffmpeg:
Output #0, mp4, to 'OUTPUT.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1