ffmpeg stripping out third stream not working

6

3

I have files with a third stream which could be some metadata from FCP. This is the output of ffprobe:

ffprobe 00700.mov  
ffprobe version 2.0.1 Copyright (c) 2007-2013 the FFmpeg developers  
  built on Aug 27 2013 20:17:24 with gcc 4.5 (SUSE Linux)  
  configuration: --enable-gpl --enable-shared --enable-libmp3lame --enable-libxvid  --enable-libx264 --enable-nonfree --enable-postproc --enable-version3  
  libavutil      52. 38.100 / 52. 38.100  
  libavcodec     55. 18.102 / 55. 18.102  
  libavformat    55. 12.100 / 55. 12.100  
  libavdevice    55.  3.100 / 55.  3.100  
  libavfilter     3. 79.101 /  3. 79.101  
  libswscale      2.  3.100 /  2.  3.100  
  libswresample   0. 17.102 /  0. 17.102  
  libpostproc    52.  3.100 / 52.  3.100  
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x806f860] multiple edit list entries, a/v desync might occur, patch welcome  
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '00700.mov':  
  Metadata:  
    major_brand     : qt    
    minor_version   : 537199360  
    compatible_brands: qt    
    creation_time   : 2013-06-11 15:57:03  
  Duration: 00:02:41.56, start: 0.000000, bitrate: 48439 kb/s  
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5c / 0x63356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], 45873 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc  
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler  
      timecode        : 01:00:00:00  
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 2 channels, s32, 2304 kb/s  
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler  
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)  
    Metadata:  
      creation_time   : 2013-06-11 15:58:45  
      handler_name    : Apple Alias Data Handler  
      timecode        : 01:00:00:00  
Unsupported codec with id 0 for input stream 2  

Now I want to strip the third stream (stream 2)

So I use:

ffmpeg -i 00700.mov -vcodec copy -acodec copy -map 0:0 -map 0:1 testout.mov  
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers  
  built on Aug 27 2013 20:17:24 with gcc 4.5 (SUSE Linux)  
  configuration: --enable-gpl --enable-shared --enable-libmp3lame --enable-libxvid   --enable-libx264 --enable-nonfree --enable-postproc --enable-version3  
  libavutil      52. 38.100 / 52. 38.100  
  libavcodec     55. 18.102 / 55. 18.102  
  libavformat    55. 12.100 / 55. 12.100  
  libavdevice    55.  3.100 / 55.  3.100  
  libavfilter     3. 79.101 /  3. 79.101  
  libswscale      2.  3.100 /  2.  3.100  
  libswresample   0. 17.102 /  0. 17.102  
  libpostproc    52.  3.100 / 52.  3.100  
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8086ca0] multiple edit list entries, a/v desync might occur, patch welcome  
Guessed Channel Layout for  Input Stream #0.1 : stereo  
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '00700.mov':  
  Metadata:  
    major_brand     : qt    
    minor_version   : 537199360  
    compatible_brands: qt    
    creation_time   : 2013-06-11 15:57:03  
  Duration: 00:02:41.56, start: 0.000000, bitrate: 48439 kb/s  
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5c / 0x63356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], 45873 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc  
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler  
      timecode        : 01:00:00:00  
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s  
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler  
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)  
    Metadata:  
      creation_time   : 2013-06-11 15:58:45  
      handler_name    : Apple Alias Data Handler  
      timecode        : 01:00:00:00  
Output #0, mov, to 'testout.mov':  
  Metadata:  
    major_brand     : qt    
    minor_version   : 537199360  
    compatible_brands: qt    
    encoder         : Lavf55.12.100  
    Stream #0:0(eng): Video: mpeg2video (xd5c / 0x63356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 45873 kb/s, 25 fps, 12800 tbn, 25 tbc   
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler  
      timecode        : 01:00:00:00  
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, 2304 kb/s
    Metadata:  
      creation_time   : 2013-06-11 15:57:03  
      handler_name    : Apple Alias Data Handler
Stream mapping:  
  Stream #0:0 -> #0:0 (copy)  
  Stream #0:1 -> #0:1 (copy)  
Press [q] to stop, [?] for help  
frame=   45 fps=0.0 q=-1.0 size=   11470kB time=00:00:02.00 bitrate=46982.6kbitsframe=   99 fps= 99 q=-1.0 size=   25263kB time=00:00:04.00 bitrate=51738.5kbitsframe=  154 fps=101 q=-1.0 size=   38805kB time=00:00:06.12 bitrate=51942.3kbitsframe=  178 fps= 88 q=-1.0 size=   45189kB time=00:00:07.08 bitrate=52286.0kbitsframe=  211 fps= 82 q=-1.0 size=   53860kB time=00:00:09.00 bitrate=49024.2kbitsframe=  239 fps= 78 q=-1.0 size=   61190kB time=00:00:10.00 bitrate=50126.7kbitsframe=  269 fps= 73 q=-1.0 size=   68671kB time=00:00:11.00 bitrate=51140.9kbitsframe=  299 fps= 71 q=-1.0 size=   76513kB time=00:00:12.00 bitrate=52232.9kbitsframe=  332 fps= 69 q=-1.0 size=   83237kB time=00:00:13.24 bitrate=51501.1kbitsframe=  360 fps= 66 q=-1.0 size=   91908kB time=00:00:15.00 bitrate=50193.9kbits  ...and so on till  
frame= 4041 fps= 51 q=-1.0 size=  950203kB time=00:02:42.00 bitrate=48049.8kbitsframe= 4060 fps= 51 q=-1.0 Lsize=  955158kB time=00:02:42.40 bitrate=48181.4kbits/s    
video:909397kB audio:45675kB subtitle:0 global headers:0kB muxing overhead 0.008987%

So again I use ffprobe:

ffprobe testout.mov   
ffprobe version 2.0.1 Copyright (c) 2007-2013 the FFmpeg developers  
  built on Aug 27 2013 20:17:24 with gcc 4.5 (SUSE Linux)  
  configuration: --enable-gpl --enable-shared --enable-libmp3lame --enable-libxvid   --enable-libx264 --enable-nonfree --enable-postproc --enable-version3  
  libavutil      52. 38.100 / 52. 38.100  
  libavcodec     55. 18.102 / 55. 18.102  
  libavformat    55. 12.100 / 55. 12.100  
  libavdevice    55.  3.100 / 55.  3.100  
  libavfilter     3. 79.101 /  3. 79.101  
  libswscale      2.  3.100 /  2.  3.100  
  libswresample   0. 17.102 /  0. 17.102  
  libpostproc    52.  3.100 / 52.  3.100  
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testout.mov':  
  Metadata:  
    major_brand     : qt    
    minor_version   : 512  
    compatible_brands: qt    
    encoder         : Lavf55.12.100  
  Duration: 00:02:42.40, start: 0.000000, bitrate: 48181 kb/s  
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5c / 0x63356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], 45873 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc  
    Metadata:  
      handler_name    : DataHandler  
      timecode        : 01:00:00:00  
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s  
    Metadata:  
      handler_name    : DataHandler  
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)  
    Metadata:  
      handler_name    : DataHandler  
      timecode        : 01:00:00:00  
Unsupported codec with id 0 for input stream 2 

Why is it not stripping stream 2? What Am I missing?

Rajib

Posted 2013-12-09T06:10:08.780

Reputation: 2 406

@slhck Thanks again. I think now I've got the hang of the formatting. – Rajib – 2013-12-09T06:28:14.280

Can you provide sample of this mov file? – ptQa – 2013-12-09T11:12:58.240

@ptQa is sendspace good for you? The smallest file is 130 mb. Or do you want a cut version with no re-encoding? Also see the line multiple edit list entries, a/v desync might occur, patch welcome Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '00700.mov' which does go away. But the Unsupported codec bit still remains. – Rajib – 2013-12-09T13:04:05.383

yep, any hosting is ok. File size does not matter. – ptQa – 2013-12-09T13:05:55.983

@ptQa download link: http://www.sendspace.com/file/w6ckv7

– Rajib – 2013-12-09T13:29:50.647

Answers

8

Generally, I Have no idea why it's not mapped as it should. But I've found workaround for this:

ffmpeg -i 01300.mov -filter_complex "[0:v]null[video_out];[0:a]anull[audio_out]" -map [video_out] -map [audio_out] out.mov

Looks like ffmpeg cannot map this 3rd stream correctly.

ptQa

Posted 2013-12-09T06:10:08.780

Reputation: 1 599

This worked for me, when neither -sn nor -c:s none would strip such a third (subtitle) stream. BTW, the inevitable re-encoding is no problem if you use this filter graph in whatever command created that file. (My stream came from a gopro hero3+, not final cut pro.) – Camille Goudeseune – 2014-08-18T22:19:40.613

Thanks it works- i had to add -strict -2 for aac, and wonder where that's coming from because the original is pcm_s24le. So would you explain how this works? Rather, why this works. – Rajib – 2013-12-09T13:58:57.137

1It works because maps option work different when you use filter graph. It maps only out streams of filter graph and it can't map source streams.

In filtergraph I used null filters (do nothing) for audio and video. About aac - I'm pretty sure you can use any codec that you want, probably ffmpeg uses aac as default for .mov format. – ptQa – 2013-12-09T14:19:34.150

4

Answering this since it comes up on google search (to help others looking for solutions).

This has been fixed as of this ticket, https://trac.ffmpeg.org/ticket/5492, and you can get rid of the track by adding -write_tmcd 0 to the ffmpeg command.

This is specifically for a Data (tmcd) track. For others (subtitles, data in general, etc.), a combination of either -dn, -map -0:d and similar commands should help.

Christian P.

Posted 2013-12-09T06:10:08.780

Reputation: 206

Will check it out. I don't have that problematic file handy. Thanks. – Rajib – 2017-08-24T14:44:22.287

This will get rid of Unsupported codec with id 0 for input stream 1 errors (in my case caused by an unwanted data stream in the source file.) – Fabien Snauwaert – 2019-12-17T14:08:40.120