[FFmpeg-user] Why is a MP2 audio stream copied as a MP3 stream?

Nomis101 Nomis101 at web.de
Sun May 17 11:54:06 EEST 2020


Why is a MP2 audio stream copied as a MP3 stream into a MP4 container? For example, when I copy the streams from an MKV that has MP2 audio into MP4:

$ffmpeg -i /Users/Testfile.mkv -c copy /Users/Testfile.mp4
ffmpeg version N-97727-g7a92147f87 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.59)
  configuration: --pkg-config-flags=--static --enable-swscale --enable-avfilter --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype
--enable-libsoxr --enable-libaom --enable-libmp3lame --enable-librav1e --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwavpack --disable-ffplay --disable-debug --enable-libmysofa
--enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-libfdk-aac --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=ipod --enable-encoder=eac3 --enable-encoder=ac3
--enable-encoder=flac --enable-librtmp --enable-libsmbclient --enable-opencl --enable-libssh --enable-openssl --enable-encoder=truehd --enable-bsf=aac_adtstoasc --enable-encoder=h264_videotoolbox
--enable-encoder=hevc_videotoolbox --disable-sdl2 --extra-ldflags=-L/opt/local/lib
  libavutil      56. 44.100 / 56. 44.100
  libavcodec     58. 83.100 / 58. 83.100
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 80.100 /  7. 80.100
  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 '/Users/Testfile.mkv':
  Metadata:
    title           : Elephant's Dream
    ENCODER         : Lavf58.42.101
  Duration: 00:00:03.33, start: 0.000000, bitrate: 9360 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 3), yuv444p10le(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:03.332000000
    Stream #0:1(eng): Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s (default)
    Metadata:
      ENCODER         : Lavc58.82.100 mp2
      DURATION        : 00:00:03.317000000
Output #0, mp4, to '/Users/Testfile.mp4':
  Metadata:
    title           : Elephant's Dream
    encoder         : Lavf58.43.100
    Stream #0:0(eng): Video: vp9 (Profile 3) (vp09 / 0x39307076), yuv444p10le(tv, bt709/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:03.332000000
    Stream #0:1(eng): Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 384 kb/s (default)
    Metadata:
      ENCODER         : Lavc58.82.100 mp2
      DURATION        : 00:00:03.317000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=   80 fps=0.0 q=-1.0 Lsize=    3808kB time=00:00:03.29 bitrate=9473.1kbits/s speed= 431x
video:3653kB audio:152kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.081670%



It tells me it has copied the streams from mp2 to mp2. But, after inspection of the resulted file, the audio stream is detected as MP3:

$ffmpeg -i /Users/Testfile.mp4
ffmpeg version N-97727-g7a92147f87 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.59)
  configuration: --pkg-config-flags=--static --enable-swscale --enable-avfilter --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype
--enable-libsoxr --enable-libaom --enable-libmp3lame --enable-librav1e --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwavpack --disable-ffplay --disable-debug --enable-libmysofa
--enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-libfdk-aac --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=ipod --enable-encoder=eac3 --enable-encoder=ac3
--enable-encoder=flac --enable-librtmp --enable-libsmbclient --enable-opencl --enable-libssh --enable-openssl --enable-encoder=truehd --enable-bsf=aac_adtstoasc --enable-encoder=h264_videotoolbox
--enable-encoder=hevc_videotoolbox --disable-sdl2 --extra-ldflags=-L/opt/local/lib
  libavutil      56. 44.100 / 56. 44.100
  libavcodec     58. 83.100 / 58. 83.100
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 80.100 /  7. 80.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Testfile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    title           : Elephant's Dream
    encoder         : Lavf58.43.100
  Duration: 00:00:03.33, start: 0.000000, bitrate: 9362 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 3) (vp09 / 0x39307076), yuv444p10le(tv, bt709/unknown/unknown), 1920x1080, 8981 kb/s, SAR 1:1 DAR 16:9, 24.01 fps, 24 tbr, 16k tbn, 16k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 384 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified


Is this a bug in FFmpeg copy or is just the stream inside the MP4 file not detected correctly? Also HandBrake detects the audio stream of the MP4 file as MP3.


More information about the ffmpeg-user mailing list