Consider using larger HLS segment size for audio-only transcoding #2170

Open
opened 2026-02-06 21:48:43 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @sfan5 on GitHub (Oct 4, 2020).

Describe the bug
When transcoding audio files Jellyfin creates small and a lot of HLS segments for a single song (e.g. 70 segments for a 3m30s file).
Fetching lots of small files over HTTP is unnecessarily slow. Jellyfin should be using a larger segment size such as -hls_time 30 instead.

System:

  • OS: Ubuntu 20.04 LTS
  • Clients: Browser
  • Jellyfin Version: 10.6.3
  • Playback: Transcode
  • Storage: local

To Reproduce

  1. Make sure transcoding is set up to happen
  2. Play audio file
  3. Observe lots of HLS segments in devtools

Expected behavior
By changing ffmpeg's hls_time parameter there would be less segments.

Logs
Example of how Jellyfin uses -hls_time 3:

[2020-10-04 19:46:21.248 +00:00] [INF] User policy for "admin". EnableAudioPlaybackTranscoding: True
[2020-10-04 19:46:21.248 +00:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 1067140, max bitrate: 1000000
[2020-10-04 19:46:21.248 +00:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 1067140, max bitrate: 1000000
[2020-10-04 19:46:23.102 +00:00] [INF] /usr/local/bin/ffmpeg -i file:"/media/data/VA - Monstercat Uncaged Vol. 8 (2020)/13. Aero Chord - The Sound.flac" -map_metadata -1 -map_chapters -1 -threads 0   -acodec aac -ac 2 -vn -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/opt/jellyfin/transcoding-temp/006dcc7643bf9e946144bf529f129587%d.mpegts" -hls_playlist_type vod -hls_list_size 0 -y "/opt/jellyfin/transcoding-temp/006dcc7643bf9e946144bf529f129587.m3u8"
[2020-10-04 19:46:27.430 +00:00] [INF] FFMpeg exited with code 0

Screenshots
Screenshot of segments in devtools Network tab:
pic

Originally created by @sfan5 on GitHub (Oct 4, 2020). **Describe the bug** When transcoding audio files Jellyfin creates small and a lot of HLS segments for a single song (e.g. 70 segments for a 3m30s file). Fetching lots of small files over HTTP is unnecessarily slow. Jellyfin should be using a larger segment size such as `-hls_time 30` instead. **System:** - OS: Ubuntu 20.04 LTS - Clients: Browser - Jellyfin Version: 10.6.3 - Playback: Transcode - Storage: local **To Reproduce** 1. Make sure transcoding is set up to happen 2. Play audio file 3. Observe lots of HLS segments in devtools **Expected behavior** By changing ffmpeg's `hls_time` parameter there would be less segments. **Logs** Example of how Jellyfin uses `-hls_time 3`: <pre> [2020-10-04 19:46:21.248 +00:00] [INF] User policy for "admin". EnableAudioPlaybackTranscoding: True [2020-10-04 19:46:21.248 +00:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 1067140, max bitrate: 1000000 [2020-10-04 19:46:21.248 +00:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 1067140, max bitrate: 1000000 [2020-10-04 19:46:23.102 +00:00] [INF] /usr/local/bin/ffmpeg -i file:"/media/data/VA - Monstercat Uncaged Vol. 8 (2020)/13. Aero Chord - The Sound.flac" -map_metadata -1 -map_chapters -1 -threads 0 -acodec aac -ac 2 -vn -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/opt/jellyfin/transcoding-temp/006dcc7643bf9e946144bf529f129587%d.mpegts" -hls_playlist_type vod -hls_list_size 0 -y "/opt/jellyfin/transcoding-temp/006dcc7643bf9e946144bf529f129587.m3u8" [2020-10-04 19:46:27.430 +00:00] [INF] FFMpeg exited with code 0 </pre> **Screenshots** Screenshot of segments in devtools Network tab: ![pic](https://user-images.githubusercontent.com/1042418/95025739-4784b680-068c-11eb-9da0-ba7aca3a0b17.png)
OVERLORD added the bugconfirmed labels 2026-02-06 21:48:43 +03:00
Author
Owner

@Artiume commented on GitHub (Oct 14, 2020):

I tried seeing what other programs used but they also based their info off video data. My concern for doing something like this is for devices that have sporadic internet connectivity. If a segment fails to transmute, that's a large segment to have to resend. Looking at the HLS spec, Apple does recommend 6 seconds these days so we could look at doing that.

https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices

@Artiume commented on GitHub (Oct 14, 2020): I tried seeing what other programs used but they also based their info off video data. My concern for doing something like this is for devices that have sporadic internet connectivity. If a segment fails to transmute, that's a large segment to have to resend. Looking at the HLS spec, Apple does recommend 6 seconds these days so we could look at doing that. https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices
Author
Owner

@sfan5 commented on GitHub (Oct 14, 2020):

I assume other programs don't use HLS to stream just audio, but there's nothing inherently wrong with doing that.
In the example 30s segments would be roughly 540KB, I wouldn't consider that too large.

@sfan5 commented on GitHub (Oct 14, 2020): I assume other programs don't use HLS to stream just audio, but there's nothing inherently wrong with doing that. In the example 30s segments would be roughly 540KB, I wouldn't consider that too large.
Author
Owner

@Artiume commented on GitHub (Oct 15, 2020):

One weekend when I'm in an area with weak cell signal, I can try it out but it might be a hot minute. I'd rather not fix something that isn't broken per se

@Artiume commented on GitHub (Oct 15, 2020): One weekend when I'm in an area with weak cell signal, I can try it out but it might be a hot minute. I'd rather not fix something that isn't broken per se
Author
Owner

@stale[bot] commented on GitHub (Mar 20, 2021):

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.
If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or nightlies, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.
This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

@stale[bot] commented on GitHub (Mar 20, 2021): This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments. If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or nightlies, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label. This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://docs.jellyfin.org/general/getting-help.html).
Author
Owner

@sfan5 commented on GitHub (Mar 27, 2021):

Retested with 10.7.1, Jellyfin still uses -hls_time 3.

@sfan5 commented on GitHub (Mar 27, 2021): Retested with 10.7.1, Jellyfin still uses `-hls_time 3`.
Author
Owner

@HybridSarcasm commented on GitHub (Oct 10, 2023):

This has been open quite a while. Can this be re-produced with the current build? If so, please update the bug report details. Thanks!

@HybridSarcasm commented on GitHub (Oct 10, 2023): This has been open quite a while. Can this be re-produced with the current build? If so, please update the bug report details. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#2170