Replies: 7 comments 43 replies
-
Not familiar with the technical stuff, this is how I understand it:
|
Beta Was this translation helpful? Give feedback.
-
Could you answer me please how this would be any better then just the client requesting a normal transcode and then storing the resulted stream into a container itself instead of displaying it? |
Beta Was this translation helpful? Give feedback.
-
We already have an API that returns transcoded streams, which can be used instead. Why add a new endpoint in the already bloated API? |
Beta Was this translation helpful? Give feedback.
-
I've been working with @nathangur on this. I've found that for mkv files, the SeekHead element gets written by ffmpeg after the transcoding is complete, because it needs to know the position of everything in order to write the SeekHead info. So downloading it while it is transcoding gives you an unseekable video on exoplayer. mpv and other players can read the Cues data at the end of the file, so they still work, but exoplayer won't do that, and it should have the SeekHead, because searching for the Cues data can be slow, especially for large files. I can think of a few potential solutions to the problem of ffmpeg writing data back.
I'd appreciate any feedback or suggestions about this. |
Beta Was this translation helpful? Give feedback.
-
Could the Jellyfin Server team take a look at this? This is at a standstill currently. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, such an API is far from ideal on the server because transcoding to arbitrary containers isn't always streaming-compatible. This means you'd have to wait for the server to finish the entire transcoding process before even starting to download the file. Transcoding is often slow, and having an API that waits for minutes or even hours depending on transcoding speed is highly impractical. A more practical approach would be to introduce an "optimize" option, allowing the server to create an alternate version of the video with a specified transcoding profile that can be directly played on the target device. The server could maintain a queue for such transcoding tasks so users can monitor progress on a web page. Once completed, the version can be downloaded using the current API as-is. Also, you can already achieve this by downloading the entire HLS stream, without any server modification. HLS is designed for streaming, so you can download the video as quickly as the server transcodes it. Although HLS streams are less common for local video playback, many players do support playing local HLS .m3u8 files. They can also be easily remuxed into more common containers like MP4 or MKV if needed. |
Beta Was this translation helpful? Give feedback.
-
I've been working on video streaming in my other work, so thought I might chime in here. I'd +1 on what @gnattu about HLS. CMAF single-file HLS might be a really nice solution here. Here's why:
|
Beta Was this translation helpful? Give feedback.
-
Current Implementation
The current implementation of media downloads in Jellyfin directly provides the original media files without considering the client's device capabilities or preferences for file size and format. This approach, while straightforward, does not accommodate scenarios where a client might benefit from a transcoded version of the media, either for compatibility or bandwidth reasons. To address this, I propose enhancing the media download functionality to include transcoding support, leveraging existing API endpoints with hopefully minimal to no impact on client compatibility.
Currently, the
/Items/{itemId}/Download
endpoint, as defined in LibraryController.cs, directly streams the original media file to the client. This is done by the onDownloadClick function in the web client.Proposed Enhancement
The proposal is to extend the functionality of the existing download endpoint to support optional transcoding based on the client's request. This can be achieved by introducing an optional query parameter or a POST request body that allows clients to specify their transcoding preferences. This would entail an added dropdown or menu for a client to select the download quality per file or as a per user setting.
Option 1: Utilizing Query Parameters
We could extend the existing GET endpoint to accept additional query parameters that dictate the transcoding requirements. For example, parameters could include desired codec, bitrate, resolution, etc that are grouped by a selection of quality settings. This approach maintains the simplicity of a GET request but might limit the complexity and functionality depending on the future needs of this endpoint.
Option 2: Introducing a POST Endpoint
Alternatively, we could introduce a new POST endpoint or repurpose the existing endpoint to accept a POST request with a body containing the transcoding preferences. This approach offers more flexibility but is a more major API change.
Download requests would be handled by a transcode job that would save the files in the transcode file path.
This aims to be the base for having offline downloads and syncing for clients. The lack of support for offline play is also one of the major turning points away from switching to Jellyfin and one of the most requested features.
Related feature requests:
Support Downloading of Transcoded Files
Offline Mode Support on Android
Offline Sync Feature
Any ideas for implementations or feedback would be appreciated :)
Beta Was this translation helpful? Give feedback.
All reactions