mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
[PR #13053] [CLOSED] Set -copytb 1 in ffmpeg when creating an HLS stream, to fix "non-monotonic DTS" time breakage when remuxing.
#13453
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/13053
Author: @tsuereth
Created: 11/17/2024
Status: ❌ Closed
Base:
master← Head:hls-ffmpeg-copytb📝 Commits (3)
d0fb477Set-copytb 1which "is sometimes required to avoid non monotonically increasing timestamps when copying video streams with variable frame rate."b12f354Merge branch 'master' into hls-ffmpeg-copytb62e1c57Use configExperimentalFfmpegSetCopytbto set ffmpeg's-copytboption (default -1, matching the ffmpeg default).📊 Changes
2 files changed (+6 additions, -1 deletions)
View changed files
📝
Jellyfin.Api/Controllers/DynamicHlsController.cs(+4 -1)📝
MediaBrowser.Model/Configuration/ServerConfiguration.cs(+2 -0)📄 Description
Set
-copytb 1which "is sometimes required to avoid non monotonically increasing timestamps when copying video streams with variable frame rate."Does this adversely affect non-copy (transcode) streams? ... is an excellent question. :) In my limited testing, I don't think it does, though admittedly I don't have a ton of domain knowledge or relevant testing material.
Changes
This change simply adds
-copytb 1to ffmpeg's command-line arguments when creating an HLS stream. As ffmpeg documentation mentions: https://ffmpeg.org/ffmpeg.htmlLike the doc says, when a source video has "non monotonically increasing timestamps," this setting appears necessary to ensure that a remux operation outputs frames with the source's intended timings.
Otherwise an HLS remux stream will adjust those non-monotonic timestamps, and produce a video which appears to miss or skip frames. This results in warnings logged by ffmpeg such as:
Issues
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.