ffmpeg 删除第三个流不起作用

ffmpeg 删除第三个流不起作用

我有第三个流的文件,可能是来自 FCP 的一些元数据。这是 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  

现在我想剥离第三个流(流 2)

所以我使用:

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%

因此我再次使用 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 

为什么它没有剥离流 2?我遗漏了什么?

答案1

总的来说,我不知道为什么它没有按应有的方式映射。但我找到了解决方法:

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

看起来 ffmpeg 无法正确映射这个第三个流。

答案2

由于这个问题出现在谷歌搜索中,因此我来回答(以帮助其他寻找解决方案的人)。

从这张票开始,这个问题已经修复,https://trac.ffmpeg.org/ticket/5492-write_tmcd 0,您可以通过添加到 ffmpeg 命令来摆脱该轨道。

这专门针对Data (tmcd)轨道。对于其他轨道(字幕、一般数据等),结合使用-dn-map -0:d类似命令应该会有所帮助。

相关内容