Copy all audio and video streams as is

707 views
Skip to first unread message

Caleb Sweeney

unread,
Mar 13, 2014, 1:51:17 PM3/13/14
to ffmbc-...@googlegroups.com
Hello,

Running FFMBC v.07 RC7 linux

My problem is that I need a catch-all script that copies all codecs (video and audio) as well as maps all streams as they exist from the input file, regardless of how many streams may exist (anywhere from 1 video 1 audio stream to 1 video and 8 audio streams). Below is an example of the script:

ffmbc -i "input.mov" -vcodec copy -acodec copy -y "output.mov" -shortest

This works fine for copying codecs. The other issue is to copy/map all streams, below are some scripts I've tried and the results I've gotten:

ffmbc -i "input.mov" -vcodec copy -acodec copy -y "output.mov" -strict experimental -newaudio -shortest

-strict experimental option must exist for the -newaudio command to be present. This allows another stream to be copied, but changes the audio codec for that stream to AAC (not preferred).

ffmbc -i "input.mov" -vcodec copy -acodec copy -y "output.mov" -strict experimental -newaudio -newaudio -shortest

With two -newaudio commands, 2 more additional audio streams are captured, but this is a manual process and does not capture ALL to output.  For example, if my source has 1 track, it will duplicate that track with this command.

Finally, I decided to give the -map option a try:

ffmbc -i "input.mov" -vcodec copy -acodec copy -map 0 -y "output.mov" -shortest

This throws an error of 'Number of stream maps must match number of output streams'.

Caleb Sweeney

unread,
Mar 13, 2014, 1:53:28 PM3/13/14
to ffmbc-...@googlegroups.com
Apologies about the section referring to -newaudio not copying the codec, just realized you can specify that next to the -newaudio command to also copy the codec to that stream.

Caleb Sweeney

unread,
Mar 13, 2014, 5:04:12 PM3/13/14
to ffmbc-...@googlegroups.com
Basically, I'm looking for the FFMPEG equivalent of -map 0

nathan lewis

unread,
Mar 14, 2014, 6:42:09 PM3/14/14
to ffmbc-...@googlegroups.com
On Thu, Mar 13, 2014 at 5:04 PM, Caleb Sweeney <omnip...@gmail.com> wrote:
Basically, I'm looking for the FFMPEG equivalent of -map 0

I'm not sure that such a feature exists.  If it does I'd like to know.  Even ffmpeg's -map 0 will throw errors if encounters a timecode track (see below) which forces me to have to use -map to get all channels into the output file.  

I started working on a perl script that would interrogate an input file in order to properly map the input file's track layouts match to the output file, but was diverted by higher priorities.  

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inputFile.mov':

  Metadata:

    major_brand     : qt  

    minor_version   : 537134592

    compatible_brands: qt  

    creation_time   : 2013-03-07 08:50:53

  Duration: 00:47:43.00, start: 0.000000, bitrate: 72332 kb/s

    Stream #0:0(eng): Data: none (tmcd / 0x64636D74)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:1(eng): Video: prores (apch / 0x68637061), yuv422p10le, 720x576, 68812 kb/s, SAR 16:15 DAR 4:3, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:2(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, mono, s16, 768 kb/s (default)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:3(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, mono, s16, 768 kb/s (default)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:4(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, mono, s16, 768 kb/s (default)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:5(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, mono, s16, 768 kb/s (default)

    Metadata:

      timecode        : 00:59:00:00

    Stream #0:6(eng): Subtitle: eia_608 (c608 / 0x38303663), 720x576, 2 kb/s (default)

Data stream encoding not supported yet (only streamcopy)

 

Caleb Sweeney

unread,
Mar 14, 2014, 6:52:06 PM3/14/14
to ffmbc-...@googlegroups.com
Nate,

Have you tried -map 0 along with -dn (disables copy of data stream) ?
Reply all
Reply to author
Forward
0 new messages