Apple Lossless file not correctly streamed on iOS and macOS device #1173

Closed
opened 2025-12-21 18:10:52 +01:00 by backuprepo · 5 comments
Owner

Originally created by @gnattu on GitHub (Dec 31, 2019).

Media Info of the file

Title Und ALAC stereo Default
Language und
Codec ALAC
Codec tag alac
Layout stereo
Channels 2 ch
Bitrate 1087 kbps
Sample rate 44100 Hz
Bit depth 16 bit
Default Yes

Logs

FFmpeg exited with code 1 after this:
D:\Jellyfin\ffmpeg.exe -i file:"Z:\Music\AliA\realize\1-01 realize.m4a" -map_metadata -1 -map_chapters -1 -threads 0 -acodec aac -strict experimental -ac 2 -vn -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type aac -start_number 0 -hls_segment_filename "D:\JellyfinData\transcoding-temp\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\c762c3564cbe81faad88399689623d9c%d.aac" -hls_playlist_type vod -hls_list_size 0 -y "D:\JellyfinData\transcoding-temp\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\c762c3564cbe81faad88399689623d9c.m3u8"

When manually invoke above command, ffmpeg is not happy with the -hls_segment_type aac part. It seems like aac is not a valid type of hls_segment_type

Stats for Nerds Screenshots

Not available

Server System (please complete the following information):

  • OS: Windows Server 2019
  • Jellyfin Version: 10.4.3
  • Hardware settings & device: Quadro P400, Xeon D-1541(VM in ESXi, 16GB RAM)
  • Reverse proxy: N/A
  • Other hardware notes: Media mounted in CIFS/SMB share

Client System (please complete the following information):

  • Device: iPad Pro 2018
  • OS: iPadOS
  • Client: Browser
  • Browser (if Web client): Safari and Firefox
  • Client and Browser Version: Safari included in iPadOS 13.3, Firefox 2.10 App Store

Extra note
If I disable audio conversion those ALAC files actually plays in browser. This is expected as iOS natives supports ALAC files, but the browser seems not exposing the capability correctly. Conversion works fine on Chrome on PC though, but -hls_segment_type became mpegts on Desktop. So basically, to make the situation perfect, there are 2 parts of this problem:

  1. Adjust ffmpeg option as -hls_segment_type aac is invalid.
  2. Prevent transcoding of alac files for iOS and macOS clients.
Originally created by @gnattu on GitHub (Dec 31, 2019). **Media Info of the file** > Title Und ALAC stereo Default Language und Codec ALAC Codec tag alac Layout stereo Channels 2 ch Bitrate 1087 kbps Sample rate 44100 Hz Bit depth 16 bit Default Yes **Logs** <!-- Please paste any log message from during the playback issue, for example the ffmpeg command line can be very useful. --> FFmpeg exited with code 1 after this: ```D:\Jellyfin\ffmpeg.exe -i file:"Z:\Music\AliA\realize\1-01 realize.m4a" -map_metadata -1 -map_chapters -1 -threads 0 -acodec aac -strict experimental -ac 2 -vn -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type aac -start_number 0 -hls_segment_filename "D:\JellyfinData\transcoding-temp\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\c762c3564cbe81faad88399689623d9c%d.aac" -hls_playlist_type vod -hls_list_size 0 -y "D:\JellyfinData\transcoding-temp\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\transcodes\c762c3564cbe81faad88399689623d9c.m3u8" ``` When manually invoke above command, ffmpeg is not happy with the `-hls_segment_type aac ` part. It seems like `aac` is not a valid type of `hls_segment_type` **Stats for Nerds Screenshots** <!-- If available, add screenshots of the stats for nerds screen to help show the issue problem. --> Not available **Server System (please complete the following information):** - OS: Windows Server 2019 - Jellyfin Version: 10.4.3 - Hardware settings & device: Quadro P400, Xeon D-1541(VM in ESXi, 16GB RAM) - Reverse proxy: N/A - Other hardware notes: Media mounted in CIFS/SMB share **Client System (please complete the following information):** - Device: iPad Pro 2018 - OS: iPadOS - Client: Browser - Browser (if Web client): Safari and Firefox - Client and Browser Version: Safari included in iPadOS 13.3, Firefox 2.10 App Store **Extra note** If I disable audio conversion those ALAC files actually plays in browser. This is expected as iOS natives supports ALAC files, but the browser seems not exposing the capability correctly. Conversion works fine on Chrome on PC though, but `-hls_segment_type` became `mpegts` on Desktop. So basically, to make the situation perfect, there are 2 parts of this problem: 1. Adjust ffmpeg option as `-hls_segment_type aac` is invalid. 2. Prevent transcoding of alac files for iOS and macOS clients.
backuprepo 2025-12-21 18:10:52 +01:00
Author
Owner

@gnattu commented on GitHub (Jan 1, 2020):

"TranscodingProfiles":[ 
         { 
            "Container":"aac",
            "Type":"Audio",
            "AudioCodec":"aac",
            "Protocol":"hls",
            "EstimateContentLength":false,
            "EnableMpegtsM2TsMode":false,
            "TranscodeSeekInfo":"Auto",
            "CopyTimestamps":false,
            "Context":"Streaming",
            "EnableSubtitlesInManifest":false,
            "MaxAudioChannels":"2",
            "MinSegments":2,
            "SegmentLength":0,
            "BreakOnNonKeyFrames":true
         },

Looks like there is something wrong with the hls container profile. As per FFmpeg Doc, HLS Segment container can only be mpegts or fmp4, and nothing else. It is weird that some device reports values different than this(and get recorded by jellyfin). Maybe we can workaround this by resetting any hls_segment_type other than mpegts and fmp4 to mpegts ? As per specification, all devices supports HLS should supoorts MPEG-TS container.

@gnattu commented on GitHub (Jan 1, 2020): ``` "TranscodingProfiles":[ { "Container":"aac", "Type":"Audio", "AudioCodec":"aac", "Protocol":"hls", "EstimateContentLength":false, "EnableMpegtsM2TsMode":false, "TranscodeSeekInfo":"Auto", "CopyTimestamps":false, "Context":"Streaming", "EnableSubtitlesInManifest":false, "MaxAudioChannels":"2", "MinSegments":2, "SegmentLength":0, "BreakOnNonKeyFrames":true }, ``` Looks like there is something wrong with the hls container profile. As per [FFmpeg Doc](https://ffmpeg.org/ffmpeg-formats.html), HLS Segment container can only be `mpegts` or `fmp4`, and nothing else. It is weird that some device reports values different than this(and get recorded by jellyfin). Maybe we can workaround this by resetting any `hls_segment_type` other than `mpegts` and `fmp4` to `mpegts` ? As per specification, all devices supports HLS should supoorts MPEG-TS container.
Author
Owner

@anthonylavado commented on GitHub (Jan 3, 2020):

For reference to the customizations made to FFmpeg lately, tagging @JustAMan

@anthonylavado commented on GitHub (Jan 3, 2020): For reference to the customizations made to FFmpeg lately, tagging @JustAMan
Author
Owner

@JustAMan commented on GitHub (Jan 10, 2020):

That is actually a (inadvertently introduced) bug which I made during transition to HLS muxer.
As soon as ffmpeg upstream accepts my segment muxer fix we can revert back to segment (though no ETA on this, so making a workaround should be fine).

@JustAMan commented on GitHub (Jan 10, 2020): That is actually a (inadvertently introduced) bug which I made during transition to HLS muxer. As soon as ffmpeg upstream accepts my segment muxer fix we can revert back to `segment` (though no ETA on this, so making a workaround should be fine).
Author
Owner

@EraYaN commented on GitHub (Jan 11, 2020):

This is the last version of your patch I saw: https://patchwork.ffmpeg.org/project/ffmpeg/patch/59884611570452895@iva5-58d151f416d2.qloud-c.yandex.net/ did you end up sending in a new one (as per the comments)?

@EraYaN commented on GitHub (Jan 11, 2020): This is the last version of your patch I saw: https://patchwork.ffmpeg.org/project/ffmpeg/patch/59884611570452895@iva5-58d151f416d2.qloud-c.yandex.net/ did you end up sending in a new one (as per the comments)?
Author
Owner

@JustAMan commented on GitHub (Jan 13, 2020):

No, as I haven't had time yet. :( I sure hope to restart the upstreaming process soon.

@JustAMan commented on GitHub (Jan 13, 2020): No, as I haven't had time yet. :( I sure hope to restart the upstreaming process soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#1173
No description provided.