its_me
its_me

Reputation: 11338

FFmpeg/Avconv unable to copy subtitles due to unsupported codec?

I've got an mp4 file with these streams (avconv -i file.mp4 or 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

I am trying to strip out the first audio stream from the file like so:

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

The problem is, I get this error:

Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted

So, I checked if something's wrong with the mp4 file itself:

avprobe file.mp4

# OR #

ffprobe file.mp4

And the output says:

Unsupported codec with id 0 for input stream 3
Unsupported codec with id 94213 for input stream 4

I have no idea what that means. (Apparently something's wrong with the subtitles, but I got the video from iTunes.)

  1. What's wrong?

  2. Can I simply force avconv/ffmpeg to do what I asked of it (i.e. strip the audio stream & copy the rest as it is)? If so, how?


Apparently I missed the other errors/warnings in the console output before the final error message, like @aergistal suggested:

[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

Upvotes: 1

Views: 5268

Answers (1)

aergistal
aergistal

Reputation: 31209

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, like codec not currently supported in container.

If that's the case try to write them to a mov file.

Upvotes: 2

Related Questions