問題描述
由於不支持的編解碼器,FFmpeg/Avconv 無法複製字幕? (FFmpeg/Avconv unable to copy subtitles due to unsupported codec?)
我有一個包含這些流的 mp4 文件(avconv ‑i file.mp4
或 ffmpeg ‑i file.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 執行我的要求(即剝離音頻流並按原樣複製其餘部分)?如果是這樣,
參考解法
方法 1:
For
ffmpeg
, first thing make sure you have a recent version (try the git snapshot).One thing you can try is to use the
‑copy_unknown
option, but I don't think it'll help in this case.My hunch is that it doesn't allow some codecs in
mp4
. See if you don't have other errors/warnings in the console output before the final error message, likecodec not currently supported in container
.If that's the case try to write them to a
mov
file.參考文件