Answers.Body: <p>As someone already replied, <code>-map 0</code> is used to grab everything from the first given input, in your case <code>-i toto1.mp4</code>.</p>
  <p>To achieve what you want you can remove a specific stream this way (notice the <code>-</code> sign):</p>
  <p><code>-map -0:0</code> which removes the first stream of the input<br />
  or<br />
  <code>-map -0:v:0</code> which removes the first video stream of the input</p>
  <p>But if you need to remove the second video from the input:</p>
  <p><code>-map -0:6</code> which removes the sixth stream of the input<br />
  or<br />
  <code>-map -0:v:1</code> which remove the second video stream of the input</p>
  <hr />
  <p>More info:</p>
  <ul>
  <li><a href="https://trac.ffmpeg.org/wiki/Map" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Map</a></li>
  <li><a href="https://ffmpeg.org/ffmpeg.html#Stream-selection" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg.html#Stream-selection</a></li>
  <li><a href="https://ffmpeg.org/ffmpeg.html#Stream-specifiers" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg.html#Stream-specifiers</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-09T15:33:07.333Z
Answers.LastActivityDate: 2024-12-09T13:32:42.243Z
Answers.LastEditDate: 2024-12-09T13:32:42.243Z
Answers.UserDisplayName: manero
Answers.Body: <p>Found the answer, I had to remove <code>-vn</code> and explicitly select all the streams I wanted to copy except the one I didn't want :</p>
  
  <pre><code>$ ffmpeg -hide_banner -i toto1.mp4 -map 0:a -map 0:s -map 0:v:1 -c copy toto2.mp4
  ....
  Stream mapping:
    Stream #0:1 -&gt; #0:0 (copy)
    Stream #0:2 -&gt; #0:1 (copy)
    Stream #0:3 -&gt; #0:2 (copy)
    Stream #0:4 -&gt; #0:3 (copy)
    Stream #0:5 -&gt; #0:4 (copy)
    Stream #0:6 -&gt; #0:5 (copy)
  Press [q] to stop, [?] for help
  frame=    1 fps=0.0 q=-1.0 Lsize=    6038kB time=00:08:21.10 bitrate=  98.7kbits/s speed=1.07e+03x    
  video:12kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.825498%
  </code></pre>
  
  <p>The input <code>Stream #0:6: Video: mjpeg</code> has been copied :-)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-07T07:19:42.927Z
Answers.Text: `-map 0 -map -0:v:0` will preserve original stream order if the other tracks are interspersed.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-07T14:47:41.990Z
Answers.Text: @Gyan I LOVE your solution, can you please convert it to an answer ?
Answers.UserDisplayName: SebMa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-07T03:19:47.620Z
Answers.LastActivityDate: 2019-04-07T03:19:47.620Z
Answers.UserDisplayName: SebMa
Answers.Body: <p><code>-map 0</code> will map all streams from the first input. A negative mapping can then be applied to disable an already mapped stream.</p>
  
  <p>So,</p>
  
  <pre><code>ffmpeg -i toto1.mp4 -map 0 -map -0:v:0 -c copy toto2.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-07T15:25:47.130Z
Answers.LastActivityDate: 2019-04-07T15:25:47.130Z
Answers.UserDisplayName: Gyan
Body: <p>I want to copy all the streams (including cover art) except the first video stream from one MP4 file to another, here is what I do :</p>
  
  <pre><code>$ time ffmpeg -hide_banner -i toto1.mp4 -map 0 -vn -c:v:1 copy -c copy toto2.mp4 
  [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5655577ffd00] stream 0, timescale not set
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'toto1.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : LA GRACE by ISRAEL KINDOMBA
      artist          : Israel Kindomba
      comment         : Soyez édifiés par ces déclarations sur la grâce...
      date            : 20170421
      description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
      encoder         : Lavf58.20.100
    Duration: 00:08:21.29, start: 0.000000, bitrate: 443 kb/s
      Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 332 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
      Metadata:
        handler_name    : IsoMedia File Produced by Google, 5-11-2011
      Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:3(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:4(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:5(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:6: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 480x360 [SAR 1:1 DAR 4:3], 90k tbr, 90k tbn, 90k tbc
  Output #0, mp4, to 'toto2.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : LA GRACE by ISRAEL KINDOMBA
      artist          : Israel Kindomba
      comment         : Soyez édifiés par ces déclarations sur la grâce...
      date            : 20170421
      description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
      encoder         : Lavf58.20.100
      Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
      Metadata:
        handler_name    : IsoMedia File Produced by Google, 5-11-2011
      Stream #0:1(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:2(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:3(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:4(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream mapping:
    Stream #0:1 -&gt; #0:0 (copy)
    Stream #0:2 -&gt; #0:1 (copy)
    Stream #0:3 -&gt; #0:2 (copy)
    Stream #0:4 -&gt; #0:3 (copy)
    Stream #0:5 -&gt; #0:4 (copy)
  Press [q] to stop, [?] for help
  size=    6026kB time=00:08:21.10 bitrate=  98.5kbits/s speed=1.18e+03x    
  video:0kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.828688%
  
  real    0m0.583s
  user    0m0.524s
  sys 0m0.060s
  </code></pre>
  
  <p>As you can see in the <code>Stream mapping:</code> the input <code>Stream #0:6: Video: mjpeg</code> stream has not been copied.</p>
  
  <p>Can you help me ?</p>
  
Tags: <ffmpeg><thumbnails>
Title: ffmpeg : Copy all the streams (including cover art) except the first video stream from one MP4 file to another
UserDisplayName: SebMa
ThreadText: # ffmpeg : Copy all the streams (including cover art) except the first video stream from one MP4 file to another
  
  (Asked by: username_0 on 2019-04-07)
  
  I want to copy all the streams (including cover art) except the first video stream from one MP4 file to another, here is what I do :
  
  ```
  $ time ffmpeg -hide_banner -i toto1.mp4 -map 0 -vn -c:v:1 copy -c copy toto2.mp4 
  [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5655577ffd00] stream 0, timescale not set
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'toto1.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : LA GRACE by ISRAEL KINDOMBA
      artist          : Israel Kindomba
      comment         : Soyez édifiés par ces déclarations sur la grâce...
      date            : 20170421
      description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
      encoder         : Lavf58.20.100
    Duration: 00:08:21.29, start: 0.000000, bitrate: 443 kb/s
      Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 332 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
      Metadata:
        handler_name    : IsoMedia File Produced by Google, 5-11-2011
      Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:3(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:4(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:5(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:6: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 480x360 [SAR 1:1 DAR 4:3], 90k tbr, 90k tbn, 90k tbc
  Output #0, mp4, to 'toto2.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : LA GRACE by ISRAEL KINDOMBA
      artist          : Israel Kindomba
      comment         : Soyez édifiés par ces déclarations sur la grâce...
      date            : 20170421
      description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
      encoder         : Lavf58.20.100
      Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
      Metadata:
        handler_name    : IsoMedia File Produced by Google, 5-11-2011
      Stream #0:1(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:2(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:3(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
      Stream #0:4(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream mapping:
    Stream #0:1 -> #0:0 (copy)
    Stream #0:2 -> #0:1 (copy)
    Stream #0:3 -> #0:2 (copy)
    Stream #0:4 -> #0:3 (copy)
    Stream #0:5 -> #0:4 (copy)
  Press [q] to stop, [?] for help
  size=    6026kB time=00:08:21.10 bitrate=  98.5kbits/s speed=1.18e+03x    
  video:0kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.828688%
  
  real    0m0.583s
  user    0m0.524s
  sys 0m0.060s
  
  ```
  
  As you can see in the `Stream mapping:` the input `Stream #0:6: Video: mjpeg` stream has not been copied.
  
  Can you help me ?
  
  **Tags:** ffmpeg, thumbnails
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2019-04-07. Score: 5 | Accepted answer
  
  `-map 0` will map all streams from the first input. A negative mapping can then be applied to disable an already mapped stream.
  
  So,
  
  ```
  ffmpeg -i toto1.mp4 -map 0 -map -0:v:0 -c copy toto2.mp4
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2023-11-09. Score: 1
  
  As someone already replied, `-map 0` is used to grab everything from the first given input, in your case `-i toto1.mp4`.
  
  To achieve what you want you can remove a specific stream this way (notice the `-` sign):
  
  `-map -0:0` which removes the first stream of the input  
  or  
  `-map -0:v:0` which removes the first video stream of the input
  
  But if you need to remove the second video from the input:
  
  `-map -0:6` which removes the sixth stream of the input  
  or  
  `-map -0:v:1` which remove the second video stream of the input
  
  ---
  
  More info:
  
  * <https://trac.ffmpeg.org/wiki/Map>
  * <https://ffmpeg.org/ffmpeg.html#Stream-selection>
  * <https://ffmpeg.org/ffmpeg.html#Stream-specifiers>
  
  
  ---
  
  ### Answer by username_0 on 2019-04-07. Score: 0
  
  Found the answer, I had to remove `-vn` and explicitly select all the streams I wanted to copy except the one I didn't want :
  
  ```
  $ ffmpeg -hide_banner -i toto1.mp4 -map 0:a -map 0:s -map 0:v:1 -c copy toto2.mp4
  ....
  Stream mapping:
    Stream #0:1 -> #0:0 (copy)
    Stream #0:2 -> #0:1 (copy)
    Stream #0:3 -> #0:2 (copy)
    Stream #0:4 -> #0:3 (copy)
    Stream #0:5 -> #0:4 (copy)
    Stream #0:6 -> #0:5 (copy)
  Press [q] to stop, [?] for help
  frame=    1 fps=0.0 q=-1.0 Lsize=    6038kB time=00:08:21.10 bitrate=  98.7kbits/s speed=1.07e+03x    
  video:12kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.825498%
  
  ```
  
  The input `Stream #0:6: Video: mjpeg` has been copied :-)
  
  > **Comments:**
  > **username_2**: `-map 0 -map -0:v:0` will preserve original stream order if the other tracks are interspersed.  
  > **username_0**: @username_2 I LOVE your solution, can you please convert it to an answer ?  
  
  ---
  
  