0

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?

  3. Is there a better alternative for remuxing, that's command-line & actively developed?


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
3

The fourth stream apparently is a CEA-608 subtitle stream, which during the days of analog television signal transmission was caption data embedded within the video data. Apparently FFmpeg can extract it but can't mux it to a new container.

As for stripping only the audio, MP4Box may be of help.

  • So based on your answer & comment, ffmpeg currently doesn't support doing what I asked of it, and if the ticket is patched, it may in the future. No way to force ffmpeg to just do it right? – its_me Nov 27 '15 at 16:06
  • There may be a roundabout way of doing it: Mux only the AC3 and H264 streams into a new container. Try to extract the caption to a SRT e.g. ffmpeg -i file.mp4 -c:s copy file-out.srt. If this works, mux the SRT along with the streams from the new container into a final container. – Gyan Nov 27 '15 at 16:18
  • I just extracted the 2 subtitle streams as separate srt files and the command ran successfully without any issues. But when I opened them in Notepad++ I see this: i.imgur.com/j1MKW8n.png -- Any idea why? I've opened srt files before and they are supposed to show normal text. – its_me Nov 27 '15 at 16:46
  • Because they are just raw CEA608 data dumped into the output you specified. CCExtractor should be able to produce valid SRTs from them. – Gyan Nov 27 '15 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.