我有一个包含这些流(avconv -i file.mp4
或ffmpeg -i file.mp4
)的 mp4 文件:
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, fltp, 125 kb/s (default)
Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 384 kb/s
Stream #0.2(eng): Video: h264 (Main), yuv420p, 1280x568, 4027 kb/s, PAR 1:1 DAR 160:71, 23.98 fps, 2997 tbn, 50 tbc (default)
Stream #0.3(eng): Subtitle: c608 / 0x38303663, 0 kb/s
Stream #0.4(und): Subtitle: text / 0x74786574
Stream #0.5: Video: mjpeg, yuvj420p, 667x1000 [PAR 72:72 DAR 667:1000], 90k tbn
我正在尝试从文件中删除第一个音频流,如下所示:
avconv -i file.mp4 -map 0 -map -0:0 -codec copy file-out.mp4
# OR #
ffmpeg -i file.mp4 -map 0 -map -0:0 -codec copy file-out.mp4
问题是,我收到此错误:
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
所以,我检查了 mp4 文件本身是否有问题:
avprobe file.mp4
# OR #
ffprobe file.mp4
输出说:
Unsupported codec with id 0 for input stream 3
Unsupported codec with id 94213 for input stream 4
我不知道那是什么意思。(显然字幕有问题,但我从 iTunes 获得了视频。)
怎么了?
我可以简单地强制 avconv/ffmpeg 做我所要求的(即剥离音频流并按原样复制其余部分)吗?如果是这样,怎么做?
显然,在最终错误消息之前,我错过了控制台输出中的其他错误/警告,就像@aergistal 建议的那样:
[mp4 @ 0x2645420] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x2645420] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 0x2645420] Codec for stream 2 does not use global headers but container format requires global headers
[mp4 @ 0x2645420] Codec for stream 3 does not use global headers but container format requires global headers
[mp4 @ 0x2645420] Codec for stream 4 does not use global headers but container format requires global headers
[mp4 @ 0x2645420] track 2: could not find tag, codec not currently supported in container