[FFmpeg-user] How to create "Input #1", "Input #2" etc. in addition to "Input #0"?

Gyan Doshi ffmpeg at gyani.pro
Mon Sep 28 16:30:27 EEST 2020



On 28-09-2020 06:01 pm, Stub via ffmpeg-user wrote:
> On Monday, September 28, 2020, 09:35:28 AM GMT+9, Carl Zwanzig <cpz at tuunq.com> wrote:
>
> On 9/27/2020 5:27 PM, James Darnley wrote:
>> Please do not top post.
> And the formatting makes the ffprobe output difficult to read. If you (the
> OP) is posting in HTML, turn that off and stick to plain text.
>
> See https://ffmpeg.org/mailing-list-faq.html
>
>
> If I understand the question-
> there is a container holding multiple input streams and you want those
> streams to go into a stream-capable output container. Yes?
>
> Or is this question of copying metadata/stream names to the output container?
>
> Examples of commands you've tried along with the full output would clarify
> things.
>
> -------------
>
> Thank you for the quick responses.
>
> Let me give a much simplified example of what I hoped to achieve. I have two movie files that each contain a video stream and an audio stream: movie1.mp4 and movie2.mp4. I merge both into a single MKV container with ffmpeg:
>
> ffmpeg -i movie1.mp4 -i movie2.mp4 -map 0:v -map 0:a -map 1:v -map 1:a -c copy combined.mkv
>
> At the end of the ffmpeg monitor output I get the following about the contents of the "combined.mkv":
>
> Stream mapping:
>    Stream #0:0 -> #0:0 (copy)
>    Stream #0:1 -> #0:1 (copy)
>    Stream #1:0 -> #0:2 (copy)
>    Stream #1:1 -> #0:3 (copy)
>
>
> Now, my question is how to achieve the following mapping:
>
> Stream mapping:
>    Stream #0:0 -> #0:0 (copy)
>    Stream #0:1 -> #0:1 (copy)
>    Stream #1:0 -> #1:0 (copy)
>    Stream #1:1 -> #1:1 (copy)
>
>
> It seems that the "-map" flag always adds a stream as a "#0:n". I would like to have "#1:0" and "#1:1" in the "combined.mkv" container. Is that possible?

No. The first numeral in #0:n for a output stream refers to the output 
file index. Since you're sending streams to the same output file, they 
will have the same output file index

If you want  to record for posterity which file a stream originated 
from, add metadata tags per stream e.g.

   -metadata:s:2 title="from input 1"

This applies the metadata to the third output stream.

Gyan



More information about the ffmpeg-user mailing list