Answers.Body: <p>The fourth stream apparently is a <a href="https://en.wikipedia.org/wiki/EIA-608" rel="nofollow">CEA-608</a> subtitle stream, which during the days of analog television signal transmission was caption data <em>embedded within</em> the video data. Apparently FFmpeg can extract it but can't <a href="https://trac.ffmpeg.org/ticket/1778" rel="nofollow">mux</a> it to a new container.</p>
  
  <p>As for stripping only the audio, <a href="https://gpac.wp.mines-telecom.fr/mp4box/" rel="nofollow">MP4Box</a> may be of help.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-27T16:06:13.947Z
Answers.Text: 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?
Answers.UserDisplayName: its_me
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-27T16:18:51.657Z
Answers.Text: 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.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-27T16:46:33.700Z
Answers.Text: 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: http://i.imgur.com/j1MKW8n.png -- Any idea why? I've opened srt files before and they are supposed to show normal text.
Answers.UserDisplayName: its_me
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-27T16:54:57.103Z
Answers.Text: Because they are just raw CEA608 data dumped into the output you specified. [CCExtractor](http://ccextractor.sourceforge.net/about-ccextractor.html) should be able to produce valid SRTs from them.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-27T15:34:09.423Z
Answers.LastActivityDate: 2015-11-27T15:34:09.423Z
Answers.UserDisplayName: Gyan
Body: <p>I've got an mp4 file with these streams (<code>avconv -i file.mp4</code> or <code>ffmpeg -i file.mp4</code>):</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am trying to strip out the first audio stream from the file like so:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The problem is, I get this error:</p>
  
  <pre><code>Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
  </code></pre>
  
  <p>So, I checked if something's wrong with the mp4 file itself:</p>
  
  <pre><code>avprobe file.mp4
  
  # OR #
  
  ffprobe file.mp4
  </code></pre>
  
  <p>And the output says:</p>
  
  <pre><code>Unsupported codec with id 0 for input stream 3
  Unsupported codec with id 94213 for input stream 4
  </code></pre>
  
  <p>I have no idea what that means. (Apparently something's wrong with the subtitles, but I got the video from iTunes.)</p>
  
  <ol>
  <li><p>What's wrong?</p></li>
  <li><p>Can I simply force avconv/ffmpeg to do what I asked of it (i.e. strip the audio stream &amp; copy the rest as it is)? If so, how?</p></li>
  <li><p>Is there a better alternative for remuxing, that's command-line &amp; actively developed?</p></li>
  </ol>
  
  <hr>
  
  <p>Apparently I missed the other errors/warnings in the console output before the final error message, like @aergistal suggested:</p>
  
  <pre><code>[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
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-27T15:50:24.037Z
Comments.Text: Lack of global headers is not relevant to your muxing problem.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-27T19:21:36.823Z
Comments.Text: [This question has been crossposted](http://stackoverflow.com/questions/33957009/ffmpeg-avconv-unable-to-copy-subtitles-due-to-unsupported-codec) (this is discouraged).
Comments.UserDisplayName: llogan
Tags: <video><ffmpeg><encoding>
Title: FFmpeg/Avconv unable to copy subtitles; Unsupported codec?
UserDisplayName: its_me
ThreadText: # FFmpeg/Avconv unable to copy subtitles; Unsupported codec?
  
  (Asked by: username_0 on 2015-11-27)
  
  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
  
  ```
  
  **Tags:** video, ffmpeg, encoding
  
  > **Comments:**
  > **username_1**: Lack of global headers is not relevant to your muxing problem.  
  > **username_2**: [This question has been crossposted](http://stackoverflow.com/questions/33957009/ffmpeg-avconv-unable-to-copy-subtitles-due-to-unsupported-codec) (this is discouraged).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-11-27. Score: 3 | Accepted answer
  
  The fourth stream apparently is a [CEA-608](https://en.wikipedia.org/wiki/EIA-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](https://trac.ffmpeg.org/ticket/1778) it to a new container.
  
  As for stripping only the audio, [MP4Box](https://gpac.wp.mines-telecom.fr/mp4box/) may be of help.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_1**: 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.  
  > **username_0**: 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: http://i.imgur.com/j1MKW8n.png -- Any idea why? I've opened srt files before and they are supposed to show normal text.  
  > **username_1**: Because they are just raw CEA608 data dumped into the output you specified. [CCExtractor](http://ccextractor.sourceforge.net/about-ccextractor.html) should be able to produce valid SRTs from them.  
  
  ---
  
  