Skip to content

Server misidentifies MP2 as MP3 in MP4 Containers, causing playback issues #12539

Closed
@theguymadmax

Description

This issue respects the following points:

  • This is a bug, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found here.
  • This issue is not already reported on GitHub (I've searched it).
  • I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
  • I agree to follow Jellyfin's Code of Conduct.
  • This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.

Description of the bug

The server does not make the distinction between mp2 and mp3 files in MP4 containers due to a bug/limitation in ffprobe:
“It's a known issue, and caused by the specification since it defined the same config for MP2 and MP3. So with an mp4 container, we don't know whether it's MP2 or MP3 until decoding.”

The AndroidTV client requests MP3 and MP2 as direct play codecs and uses them in its default downmixing profile:

private val downmixSupportedAudioCodecs = arrayOf(
	Codec.Audio.AAC,
	Codec.Audio.MP3,
	Codec.Audio.MP2
) 

Given that MP2 support appears to be device-specific and not widely available, it is advisable to remove it. Testing on various devices has consistently resulted in an ExoPlayer codec decoder error. Even after removing the MP2 codec from the exoplayer profile, the issue persists due to the misidentification of the audio track as MP3, which still triggers direct play and leads to a remux causing playback failure.

Reproduction steps

  1. Import file with MP2 audio in MP4 container
  2. Notice audio is identified as mp3 in webui
  3. Playback in JellyfinATV

What is the current bug behavior?

The file is remuxed, and depending on the device, the file may either result in a playback failure or fall back? to the correct codec? after 2 errors and play.

What is the expected correct behavior?

The MP2 codec should be accurately identified, and if it is not supported, it should be transcoded to a supported format.

Jellyfin Server version

10.9.9+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.9.10

Environment

- OS: Windows 11
- Clients: Jellyfin ATV on Firestick 4k Gen 2
- FFmpeg Version:6.0.1-8
- Playback Method: Direct Play
- Hardware Acceleration: AMF
- GPU Model:RX 6700 XT

Jellyfin logs

[12:11:51] [INF] [65] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Max. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[12:11:52] [INF] [54] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Max. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[12:11:52] [INF] [82] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Android TV 0.17.4 playing Big Buck Bunny (mp2). Stopped at 0 ms
[12:11:53] [INF] [68] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Android TV 0.17.4 playing Big Buck Bunny (mp2). Stopped at 0 ms
[12:11:53] [INF] [54] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Max. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[12:11:53] [INF] [68] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: ffmpeg -analyzeduration 200M -probesize 1G -fflags +genpts  -i file:"H:\Test\Avc3.0High\Big Buck Bunny (mp2).mp4" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 copy -bsf:v h264_mp4toannexb -start_at_zero -codec:a:0 copy -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\827a6df43c2c2f7aefd9e7cc8ea67d13%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\827a6df43c2c2f7aefd9e7cc8ea67d13.m3u8"
[12:11:53] [INF] [56] MediaBrowser.Controller.MediaEncoding.TranscodingJob: Stopping ffmpeg process with q command for C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\827a6df43c2c2f7aefd9e7cc8ea67d13.m3u8
[12:11:53] [INF] [56] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: FFmpeg exited with code 0
[12:11:53] [INF] [56] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: Deleting partial stream file(s) C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\827a6df43c2c2f7aefd9e7cc8ea67d13.m3u8
[12:11:55] [INF] [56] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Android TV 0.17.4 playing Big Buck Bunny (mp2). Stopped at 0 ms

FFmpeg logs

{"Protocol":0,"Id":"81008ee9fa153e69eb87b06b585f4609","Path":"H:\\Test\\Big Buck Bunny\\Big Buck Bunny (mp2).mp4","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mov,mp4,m4a,3gp,3g2,mj2","Size":185027303,"Name":"Big Buck Bunny (mp2)","IsRemote":false,"ETag":"183fd4b3b19303316ed1fd59577a9a77","RunTimeTicks":6345996670,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":0,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"h264","CodecTag":"avc1","Language":"und","ColorRange":null,"ColorSpace":"bt709","ColorTransfer":"bt709","ColorPrimaries":"bt709","DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Rotation":null,"Comment":null,"TimeBase":"1/90000","CodecTimeBase":null,"Title":null,"VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"720p H264 SDR","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"ChannelLayout":null,"BitRate":2133830,"BitDepth":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":720,"Width":1280,"AverageFrameRate":30,"RealFrameRate":30,"Profile":"High","Type":1,"AspectRatio":"16:9","Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p","Level":31,"IsAnamorphic":false},{"Codec":"mp3","CodecTag":"mp4a","Language":"und","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Rotation":null,"Comment":null,"TimeBase":"1/48000","CodecTimeBase":null,"Title":"Surround","VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Default","LocalizedForced":null,"LocalizedExternal":"External","LocalizedHearingImpaired":null,"DisplayTitle":"Surround - MP3 - Stereo - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":"stereo","BitRate":192002,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":2,"SampleRate":48000,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":2332523,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null,"HasSegments":false}

ffmpeg -analyzeduration 200M -probesize 1G -fflags +genpts  -i file:"H:\Test\Big Buck Bunny\Big Buck Bunny (mp2).mp4" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 copy -bsf:v h264_mp4toannexb -start_at_zero -codec:a:0 copy -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e.m3u8"


ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13-win32 (GCC)
  configuration: --prefix=/opt/ffmpeg --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=Jellyfin --disable-ffplay --disable-debug --disable-doc --disable-sdl2 --disable-ptx-compression --disable-w32threads --enable-pthreads --enable-shared --enable-lto --enable-gpl --enable-version3 --enable-schannel --enable-iconv --enable-libxml2 --enable-zlib --enable-lzma --enable-gmp --enable-chromaprint --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libwebp --enable-libvpx --enable-libzimg --enable-libx264 --enable-libx265 --enable-libsvtav1 --enable-libdav1d --enable-libfdk-aac --enable-opencl --enable-dxva2 --enable-d3d11va --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:H:\Test\Big Buck Bunny\Big Buck Bunny (mp2).mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf61.1.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:10:34.60, start: 0.000000, bitrate: 2332 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 2133 kb/s, 30 fps, 30 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : Surround
      vendor_id       : [0][0][0][0]
Output #0, hls, to 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e.m3u8':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2133 kb/s, 30 fps, 30 tbr, 90k tbn (default)
  Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 size=       0kB time=-00:00:00.03 bitrate=  -0.0kbits/s speed=N/A    
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e0.ts' for writing
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e1.ts' for writing
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e2.ts' for writing
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e3.ts' for writing
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e4.ts' for writing
[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e5.ts' for writing


[q] command received. Exiting.

[hls @ 000002c0ff65d200] Opening 'C:\Users\Max\AppData\Local\jellyfin\cache\transcodes\17ffa9e7014d34a7a1f974e790c2aa5e6.ts' for writing
frame= 1254 fps=0.0 q=-1.0 Lsize=N/A time=-00:00:00.00 bitrate=N/A speed=N/A    
video:14075kB audio:979kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Client / Browser logs

No response

Relevant screenshots or videos

Exoplayer error:
error message

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamThe issue is due to a upstream library or project

    Type

    No type

    Projects

    • Status

      Wrong Repo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions