0

In some .mkv files with multiple different audio streams I removed all the ones I don't need with ffmpeg and only kept the desired audio stream along with the video and possibly subtitles. The result works fine in VLC, but in Windows Media Player I don't have any sound after the repacking. I do wonder what the issue is. Anything incorrect with the process? How could I achieve that it still works with WMP after the removal of certain audio streams. Note: The audio works well in WMP with the original file.

Here's what I use to remove the unneeded streams. Let's say I have a file with three audio streams and I only want to keep the second one:

ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv

Edit: ffmpgeg -i <file> output before and after removing.

I notice that the encoder changes, maybe that causes issues for WMP?

ffmpeg -i in.mkv

ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  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 --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. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'in.mkv':
  Metadata:
    title           : test
    encoder         : libebml v0.7.7 + libmatroska v0.8.1
    creation_time   : 2011-09-25T09:17:25.000000Z
  Duration: 01:31:44.83, start: 0.000000, bitrate: 13668 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : MVO
    Stream #0:2(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
    Stream #0:3(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Mihalev
    Stream #0:4(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
    Stream #0:5(rus): Subtitle: subrip (default)




ffmpeg -i out.mkv

ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  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 --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. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'out.mkv':
  Metadata:
    title           : test
    ENCODER         : Lavf58.42.100
  Duration: 01:31:44.83, start: 0.000000, bitrate: 12842 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      DURATION        : 01:31:44.828000000
    Stream #0:1(rus): Subtitle: subrip (default)
    Metadata:
      DURATION        : 01:26:07.385000000
    Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
      DURATION        : 01:31:44.273000000

EDIT 2: Log output of ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv

ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy out.mkv
ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  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 --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. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'inputfile.mkv':
  Metadata:
    title           : test
    encoder         : libebml v0.7.7 + libmatroska v0.8.1
    creation_time   : 2011-09-25T09:17:25.000000Z
  Duration: 01:31:44.83, start: 0.000000, bitrate: 13668 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : MVO
    Stream #0:2(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
    Stream #0:3(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Mihalev
    Stream #0:4(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
    Stream #0:5(rus): Subtitle: subrip (default)
Output #0, matroska, to 'out.mkv':
  Metadata:
    title           : test
    encoder         : Lavf58.42.100
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(rus): Subtitle: subrip (default)
    Stream #0:2(rus): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:5 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=131984 fps=941 q=-1.0 Lsize= 7741970kB time=01:31:44.70 bitrate=11521.5kbits/s speed=39.3x
video:7611378kB audio:128246kB subtitle:66kB other streams:0kB global headers:0kB muxing overhead: 0.029470%
4
  • Share the full log of ffmpeg -i file for both input and output.
    – Gyan
    Apr 23, 2020 at 6:33
  • @Gyan I added the outputs. I see that the encoder changes, maybe that might be the culprit...?
    – su_li
    Apr 23, 2020 at 8:36
  • The log from ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv may be more informative.
    – llogan
    Apr 23, 2020 at 18:33
  • @llogan See second edit above for the requested log output.
    – su_li
    Apr 26, 2020 at 19:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.