Discussion:
[FFmpeg-user] FFmpeg unable to copy subtitles due to 'unsupported codec'?
Aahan Krish
2015-11-27 13:57:46 UTC
Permalink
I've got an mp4 file with these streams (via `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

It's a movie that I downloaded from iTunes some time ago and am using
it to learn encoding, remuxing, etc.

Now I am trying to strip out the first audio stream from the file like
so (otoh, I've also tried mapping each steam to be included):

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:

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.)

1. What's wrong?

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

OR isn't ffmpeg the tool for the task?
Henk D. Schoneveld
2015-11-27 15:37:40 UTC
Permalink
Post by Aahan Krish
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
It's a movie that I downloaded from iTunes some time ago and am using
it to learn encoding, remuxing, etc.
Now I am trying to strip out the first audio stream from the file like
ffmpeg -i file.mp4 -map 0 -map -0:0 -codec copy file-out.mp4
AFAIK you should tell ffmpeg which streams you want. Not the ones to disregard.
And for every Stream what it should do with it.
To get only 0.1 and 0.2 AC3 and h264
ffmpeg -i file.mp4 c:v copy -c:a copy -map 0:2 -map 0:1 file-out.mp4
Post by Aahan Krish
Could not write header for output file #0 (incorrect codec
parameters ?): Operation not permitted
ffprobe file.mp4
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.)
1. What's wrong?
2. Can I simply force ffmpeg to do what I asked of it (i.e. strip the
audio stream & copy the rest as it is)? If so, how?
OR isn't ffmpeg the tool for the task?
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Aahan Krish
2015-11-27 16:03:08 UTC
Permalink
Hi Henk,
Post by Henk D. Schoneveld
AFAIK you should tell ffmpeg which streams you want. Not the ones to disregard.
And for every Stream what it should do with it.
To get only 0.1 and 0.2 AC3 and h264
ffmpeg -i file.mp4 c:v copy -c:a copy -map 0:2 -map 0:1 file-out.mp4
Like I said I need all streams (video, audio, subtitles, cover art)
except the first audio stream. And yes I've tried the explicit
commands too, like:

ffmpeg -i file.mp4 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5
-codec copy file-out.mp4

ffmpeg -i file.mp4 -codec copy -map 0:1 -map 0:2 -map 0:3 -map 0:4
-map 0:5 file-out.mp4

ffmpeg -i file.mp4 -c:v copy -c:a copy -c:s copy -map 0:1 -map 0:2
-map 0:3 -map 0:4 -map 0:5 file-out.mp4

I get the same error.

In addition to that, I noticed some other errors/warnings in the
console output before the final error message:

[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

But then if the container doesn't support things this way, how is
Apple able to do it? There must be a way to force ffmpeg to do what I
want, right?
Henk D. Schoneveld
2015-11-27 17:08:17 UTC
Permalink
1st I thought I had read, my mistake, you downloaded it from YouTube but,
you said you downloaded it from iTunes, now I realise that these files are copy protected, so it ain’t possible to do what you want.
Post by Aahan Krish
Hi Henk,
Post by Henk D. Schoneveld
AFAIK you should tell ffmpeg which streams you want. Not the ones to disregard.
And for every Stream what it should do with it.
To get only 0.1 and 0.2 AC3 and h264
ffmpeg -i file.mp4 c:v copy -c:a copy -map 0:2 -map 0:1 file-out.mp4
Like I said I need all streams (video, audio, subtitles, cover art)
except the first audio stream. And yes I've tried the explicit
ffmpeg -i file.mp4 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5
-codec copy file-out.mp4
ffmpeg -i file.mp4 -codec copy -map 0:1 -map 0:2 -map 0:3 -map 0:4
-map 0:5 file-out.mp4
ffmpeg -i file.mp4 -c:v copy -c:a copy -c:s copy -map 0:1 -map 0:2
-map 0:3 -map 0:4 -map 0:5 file-out.mp4
I get the same error.
In addition to that, I noticed some other errors/warnings in the
but container format requires global headers
but container format requires global headers
but container format requires global headers
but container format requires global headers
but container format requires global headers
supported in container
But then if the container doesn't support things this way, how is
Apple able to do it? There must be a way to force ffmpeg to do what I
want, right?
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Loading...