Opened 4 years ago

Closed 4 years ago

#8807 closed defect (wontfix)

Remuxing MKV to MP4 fails when using -map 0 but works fine when Remuxing MP4 to MKV

Reported by: SwiftMove Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

#####################

Summary of the bug

#####################
I have an MKV file that contains 5 streams...

0: video
1: audio
2: audio
3: text
4: menu

I was able to remux the MKV into an MP4 using this command...

ffmpeg.exe -i input.mp4 -c copy -c:s mov_text output.mkv


The resulting output MP4 contains all the streams from the original MKV.

But if I try to remux the output MP4 into an MKV using the same command, but with a different codec for the subtitles and different file extension, I get an error. However, if I omit "-map 0" from the command, it works but only ONE of the audio streams get copied to the output MKV file.

##################

How to Reproduce

##################
These two commands work, however, the output MKV only contains ONE of the TWO audio streams...

ffmpeg.exe -i input.mp4 -c copy -c:s srt output.mkv
ffmpeg.exe -i input.mp4 -c:v copy -c:a copy -c:s srt output.mkv


When I try to use either of the two commands below using "-map 0" just like I did when I remuxed the original MKV into an MP4, the commands fail and both result in the following output...

ffmpeg.exe -i input.mp4 -map 0 -c copy -c:s srt output.mkv
ffmpeg.exe -i input.mp4 -map 0 -c:v copy -c:a copy -c:s srt output.mkv


So why would using "-map 0" cause it to fail when I used the exact same command to remux the original MKV into an MP4? And why does omitting "-map 0" cause it to work, but then it doesn't copy both audio streams?


ffmpeg version git-2020-07-20-43a08d9 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 96.100 / 58. 96.100
  libavformat    58. 48.100 / 58. 48.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.48.100
  Duration: 00:11:03.90, start: 0.000000, bitrate: 5873 kb/s
    Chapter #0:0: start 0.000000, end 663.872000
    Metadata:
      title           : Chapter 01
    Stream #0:0(eng): Video: mpeg2video (Main) (mp4v / 0x7634706D), yuv420p(tv, smpte170m, top first), 720x480 [SAR 8:9 DAR 4:3], 5546 kb/s, 29.97 fps, 29.97 tbr, 16k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Side data:
      cpb: bitrate max/min/avg: 8500000/0/0 buffer size: 1835008 vbv_delay: N/A
    Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      audio service type: main
    Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 160 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      audio service type: main
    Stream #0:3(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:4(eng): Data: bin_data (text / 0x74786574)
    Metadata:
      handler_name    : SubtitleHandler
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 3, only the last option '-c:s srt' will be used.
[matroska @ 0000002df6f90f40] Only audio, video, and subtitles are supported for Matroska.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (mov_text (native) -> subrip (srt))
  Stream #0:4 -> #0:4 (copy)
    Last message repeated 1 times

Change History (2)

comment:1 by SwiftMove, 4 years ago

Summary: Remuxing MKV to MP4 fails when using -map 0Remuxing MKV to MP4 fails when using -map 0 but works fine when Remuxing MP4 to MKV

comment:2 by Carl Eugen Hoyos, 4 years ago

Keywords: ffmpeg map removed
Resolution: wontfix
Status: newclosed

There is no guarantee that -map 0 works in all situations.

Note: See TracTickets for help on using tickets.