jellyfin-plugin-tvheadend
jellyfin-plugin-tvheadend copied to clipboard
LiveTV playback does not work
With Jellyfin 10.9.6 amd Plugin 12, LiveTV does not work. The web GUI just keeps showing the spinner. It did work with Jellyfin 10.8 and Plugin 11
tvheadend log:
Jun 15 00:41:16 router tvheadend[235888]: htsp: Got connection from 127.0.0.1
Jun 15 00:41:16 router tvheadend[235888]: htsp: 127.0.0.1: Identified as user 'jellyfin' (unverified)
Jun 15 00:41:16 router tvheadend[235888]: htsp: 127.0.0.1 [ jellyfin ]: Welcomed client software: TVHclient4Emby-10.9.6.0 (HTSPv20)
Jun 15 00:41:16 router tvheadend[235888]: htsp: 127.0.0.1 [ jellyfin | TVHclient4Emby-10.9.6.0 ]: Identified as user 'jellyfin'
Jun 15 00:41:20 router tvheadend[235888]: mpegts: 450MHz in DVB-C Network - tuning on Philips TDA10023 DVB-C #0 : DVB-C #0
Jun 15 00:41:20 router tvheadend[235888]: subscription: 0001: "epggrab" unsubscribing
Jun 15 00:41:20 router tvheadend[235888]: subscription: 0003: "HTTP" subscribing on channel "ZDF HD", weight: 100, adapter: "Philips TDA10023 DVB-C #0 : DVB-C #0", network: "DVB-C Network", mux: "450MHz", provider: "ZDFvision", service: "ZDF HD", profile="pass", hostname="127.0.0.1", client="Lavf/60.3.100"
Jellyfin's log:
[2024-06-15 00:41:19.036 +02:00] [INF] Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
[2024-06-15 00:41:20.537 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffmpeg" "-analyzeduration 3000000 -probesize 1G -init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -noautorotate -i \"http://i-removed-the-user-here:[email protected]:9981/stream/channelid/1872186106\" -map_metadata -1 -map_chapters -1 -threads 0 -sn -codec:v:0 h264_qsv -preset veryfast -look_ahead 0 -b:v 670704640 -maxrate 670704640 -bufsize 1341409280 -vf \"setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,yadif=0:-1:0,scale=trunc(min(max(iw\,ih*a)\,1920)/2)*2:trunc(ow/a/2)*2,format=nv12\" -flags -global_header -codec:a:0 libfdk_aac -ab 384000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url \"hls/3d2a96e7f2d5a5382111646208baf2b4/\" -hls_segment_filename \"/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b4%d.ts\" -hls_playlist_type event -hls_list_size 0 -y \"/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b4.m3u8\""
Excerpt of jellyfin's transcoding log:
[hls @ 0x55e5f3d65740] Opening '/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b434.ts' for writing
[hls @ 0x55e5f3d65740] Opening '/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b4.m3u8.tmp' for writing
frame= 8762 fps= 51 q=44.0 size=N/A time=00:02:55.74 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8795 fps= 51 q=50.0 size=N/A time=00:02:56.25 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8819 fps= 51 q=50.0 size=N/A time=00:02:56.83 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8845 fps= 51 q=41.0 size=N/A time=00:02:57.40 bitrate=N/A dup=2 drop=0 speed=1.02x
frame= 8866 fps= 51 q=43.0 size=N/A time=00:02:57.89 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8896 fps= 51 q=46.0 size=N/A time=00:02:58.36 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8919 fps= 51 q=50.0 size=N/A time=00:02:58.94 bitrate=N/A dup=2 drop=0 speed=1.02x
frame= 8947 fps= 51 q=51.0 size=N/A time=00:02:59.32 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 8972 fps= 51 q=42.0 size=N/A time=00:02:59.90 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9003 fps= 51 q=42.0 size=N/A time=00:03:00.48 bitrate=N/A dup=2 drop=0 speed=1.01x
[hls @ 0x55e5f3d65740] Opening '/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b435.ts' for writing
[hls @ 0x55e5f3d65740] Opening '/var/lib/jellyfin/transcodes/3d2a96e7f2d5a5382111646208baf2b4.m3u8.tmp' for writing
frame= 9027 fps= 51 q=38.0 size=N/A time=00:03:01.05 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9051 fps= 51 q=46.0 size=N/A time=00:03:01.63 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9084 fps= 51 q=40.0 size=N/A time=00:03:02.01 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9106 fps= 51 q=26.0 size=N/A time=00:03:02.59 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9139 fps= 51 q=26.0 size=N/A time=00:03:03.16 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9162 fps= 51 q=50.0 size=N/A time=00:03:03.61 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9194 fps= 51 q=50.0 size=N/A time=00:03:04.19 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9219 fps= 51 q=32.0 size=N/A time=00:03:04.70 bitrate=N/A dup=2 drop=0 speed=1.01x
frame= 9243 fps= 51 q=29.0 size=N/A time=00:03:05.32 bitrate=N/A dup=2 drop=0 speed=1.01x
So technically it seems to work - at least to a certain extent. But it does not display anything, except for the spinner.
I believe I am encountering the same problem. Jellyfin 10.9.6 in Docker, Tvheadend Plugin 12.0.0.0. Trying to stream a channel just results in the loading spinner.
Some log output below (XXXX are values that I redacted; they did not look unusual or anything though):
Jellyfin Docker output:
[19:47:48] [INF] [3] TVHeadEnd.AccessTicketHandler: [TVHclient] AccessTicketHandler.GetAccessTicket: New ticket (#3) created for channelId=XXXX
[19:47:48] [INF] [3] TVHeadEnd.LiveTvService: [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
[19:47:48] [INF] [3] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for XXXX. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[19:47:48] [INF] [3] TVHeadEnd.LiveTvService: [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
[19:47:48] [INF] [45] TVHeadEnd.LiveTvService: [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
[19:47:48] [INF] [45] Jellyfin.Api.Controllers.DynamicHlsController: Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
[19:47:49] [INF] [3] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 3000000 -probesize 1G -init_hw_device vaapi=va:/dev/dri/renderD128,driver=i965 -noautorotate -i "http://XXXX:[email protected]:9981/stream/channelid/XXXX" -map_metadata -1 -map_chapters -1 -threads 4 -sn -codec:v:0 h264_vaapi -rc_mode CBR -b:v 19616000 -maxrate 19616000 -bufsize 39232000 -sei -a53_cc -force_key_frames:0 "expr:gte(t,n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,yadif=0:-1:0,scale=trunc(min(max(iw\,ih*a)\,1920)/2)*2:trunc(ow/a/2)*2,format=nv12,hwupload_vaapi" -codec:a:0 libfdk_aac -ab 384000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type fmp4 -hls_fmp4_init_filename "59ed7962c6ddbf4b290f96cbfac90bce-1.mp4" -start_number 0 -hls_base_url "hls/59ed7962c6ddbf4b290f96cbfac90bce/" -hls_segment_filename "/cache/transcodes/59ed7962c6ddbf4b290f96cbfac90bce%d.mp4" -hls_playlist_type event -hls_list_size 0 -y "/cache/transcodes/59ed7962c6ddbf4b290f96cbfac90bce.m3u8"
[19:50:32] [INF] [3] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Jellyfin Web 10.9.6 playing XXXX. Stopped at 0 ms
Tvheadend does output an error after a little bit of trying, here is a log snippet:
Jun 16 14:47:03 XXXX tvheadend[1260]: subscription: 009F: "HTTP" unsubscribing from "XXXX", hostname="10.89.0.5", client="Lavf/60.3.100"
Jun 16 14:47:49 XXXX tvheadend[1260]: mpegts: 605.028MHz in ATSC-T Network - tuning on LG Electronics LGDT3306A VSB/QAM Frontend #0 : ATSC-T #0
Jun 16 14:47:49 XXXX tvheadend[1260]: subscription: 00A0: "HTTP" subscribing on channel "XXXX", weight: 100, adapter: "LG Electronics LGDT3306A VSB/QAM Frontend #0 : ATSC-T #0", network: "ATSC-T Network", mux: "XXXX", service: "XXXX", profile="pass", hostname="10.89.0.5", client="Lavf/60.3.100"
Jun 16 14:48:20 XXXX tvheadend[1260]: pass: Live stream: Write failed -- Resource temporarily unavailable
Jun 16 14:48:20 XXXX tvheadend[1260]: webui: Stop streaming /stream/channelid/XXXX, muxer reported errors
Jun 16 14:48:20 XXXX tvheadend[1260]: subscription: 00A0: "HTTP" unsubscribing from "XXXX", hostname="10.89.0.5", client="Lavf/60.3.100"
Jellyfin transcode log did not output anything unusual but let me know if you'd like it, or if there is anything else I can provide.
Same Here. Logs are similar. Did test with Firefox, Chromium and Jellyfin F-Droid and GPlay App. My server is a KVM arch linux VM with official jellyfin-server 1.9.6 package installed. TVHeadend is working flawlessly in kodi or via direct http url.
Still does not work on Jellyfin 10.9.7. Server is Debian 12, client is Firefox.
According to https://github.com/jellyfin/jellyfin/issues/11930#issuecomment-2143986260, the tvheadend plugin lacks code to "inject compatibility profiles" (whatever that means), so that the transcoding result can be incompatible to the player.
The workaround (users should disable "prefer fMP4" in their settings) works, but is rather inconvenient: I did not find a setting to disable fMP4 globally.
Edit: Worked yesterday after disabling "prefer fMP4", today it does not. Black spinner.
Provided a pull request #91 with some tunings for LiveTV and Recordings. See the issue list in the PR for things still not working. @citronalco if you look at the PR I set the Container type to MPEGTS so you don't need "prefer fMP4" anymore. Give it a try.
Copied the dll from the artifact (https://github.com/jellyfin/jellyfin-plugin-tvheadend/actions/runs/10388813445) into /var/lib/jellyfin/plugins/TVHeadend_12.0.0.0, overwriting the existing one, then restarted Jellyfin.
Unfortunately it does not change anything. Firefox complains "HLS Error: Type: mediaError Details: bufferFullError Fatal: false"
Just to confirm that with Jellyfin 10.9.9 and TvHeadend plugin 12.0.0.0 I also can not stream live TV channels! :(
PS - Meanwhile, after a restore of my old setup (10.8.3 + 11.0.0.0) and a restore back to the new setup (10.9.9 + 12.0.0.0) the stream is working now. In practice this means a reboot (something that I already had done). Lets see if it keeps working in the next times...
I just found out that when switching off HW acceleration my playback issues are gone. More precisely disabling QSV encoding (decoding only work) or switching to VAAPI. Can anybody else confirm that?
Just to clarify: I'm using the TVHeadend 12.0.0.0 plugin from the official repository again.
Software encoding indeed works. With QSV encoding, Firefox complains "HLS Error: Type: mediaError Details: bufferFullError Fatal: false" as written above. VAAPI works perfectly with any media - but not with the TVHeadend plugin, see below. Disabling HW decoding does not change anything.
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] [TVHclient] AccessTicketHandler.GetAccessTicket: New ticket (#12) created for channelId=1872186106
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] User policy for admin. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] RemoteClientBitrateLimit: 14000000, RemoteIP: 192.168.3.61, IsInLocalNetwork: True
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:04 router jellyfin[1852908]: [13:00:04] [INF] Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
Aug 18 13:00:06 router jellyfin[1852908]: [13:00:06] [INF] /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 3000000 -probesize 1G -noautorotate -i "http://USER:[email protected]:9981/stream/channelid/1872186106" -map_metadata -1 -map_chapters -1 -threads 0 -sn -codec:v:0 h264_vaapi -rc_mode VBR -b:v 617723958 -maxrate 617723958 -bufsize 1235447916 -sei -a53_cc -force_key_frames:0 "expr:gte(t,n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,yadif=0:-1:0,scale=trunc(min(max(iw\,ih*a)\,1920)/2)*2:trunc(ow/a/2)*2,format=nv12,hwupload_vaapi" -flags -global_header -codec:a:0 libfdk_aac -ab 384000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url "hls/b8bdf1964e94b30915d55208a32f2a6a/" -hls_segment_filename "/var/lib/jellyfin/transcodes/b8bdf1964e94b30915d55208a32f2a6a%d.ts" -hls_playlist_type event -hls_list_size 0 -y "/var/lib/jellyfin/transcodes/b8bdf1964e94b30915d55208a32f2a6a.m3u8"
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [ERR] FFmpeg exited with code 1
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [ERR] Error processing request. URL GET /videos/e6340256-5a2f-6b92-4a8c-7ac0b8b3a3ba/live.m3u8.
Aug 18 13:00:10 router jellyfin[1852908]: MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1
Aug 18 13:00:10 router jellyfin[1852908]: at MediaBrowser.MediaEncoding.Transcoding.TranscodeManager.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, Guid userId, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Controllers.DynamicHlsController.GetLiveHlsStream(Guid itemId, String container, Nullable`1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable`1 segmentLength, Nullable`1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable`1 enableAutoStreamCopy, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, Nullable`1 breakOnNonKeyFrames, Nullable`1 audioSampleRate, Nullable`1 maxAudioBitDepth, Nullable`1 audioBitRate, Nullable`1 audioChannels, Nullable`1 maxAudioChannels, String profile, String level, Nullable`1 framerate, Nullable`1 maxFramerate, Nullable`1 copyTimestamps, Nullable`1 startTimeTicks, Nullable`1 width, Nullable`1 height, Nullable`1 videoBitRate, Nullable`1 subtitleStreamIndex, Nullable`1 subtitleMethod, Nullable`1 maxRefFrames, Nullable`1 maxVideoBitDepth, Nullable`1 requireAvc, Nullable`1 deInterlace, Nullable`1 requireNonAnamorphic, Nullable`1 transcodingMaxAudioChannels, Nullable`1 cpuCoreLimit, String liveStreamId, Nullable`1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable`1 audioStreamIndex, Nullable`1 videoStreamIndex, Nullable`1 context, Dictionary`2 streamOptions, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 enableSubtitlesInManifest)
Aug 18 13:00:10 router jellyfin[1852908]: at lambda_method1389(Closure, Object)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
Aug 18 13:00:10 router jellyfin[1852908]: at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
Aug 18 13:00:10 router jellyfin[1852908]: at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
Aug 18 13:00:10 router jellyfin[1852908]: at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
Aug 18 13:00:10 router jellyfin[1852908]: at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
Aug 18 13:00:10 router jellyfin[1852908]: at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] User policy for admin. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] RemoteClientBitrateLimit: 14000000, RemoteIP: 192.168.3.61, IsInLocalNetwork: True
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] Deleting partial stream file(s) /var/lib/jellyfin/transcodes/b8bdf1964e94b30915d55208a32f2a6a.m3u8
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] [TVHclient] LiveTvService.GetChannelStream: support for live TV subtitles and multiple audio tracks is enabled
Aug 18 13:00:10 router jellyfin[1852908]: [13:00:10] [INF] Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
Manually executing the ffmpeg command spits out this:
...
[h264 @ 0x556b8e6ece40] decode_slice_header error
[h264 @ 0x556b8e6ece40] no frame!
[h264 @ 0x556b8e6ece40] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x556b8e6ece40] decode_slice_header error
[h264 @ 0x556b8e6ece40] no frame!
[h264 @ 0x556b8e6ece40] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x556b8e6ece40] decode_slice_header error
[h264 @ 0x556b8e6ece40] no frame!
[h264 @ 0x556b8e6ece40] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x556b8e6ece40] decode_slice_header error
[h264 @ 0x556b8e6ece40] no frame!
[h264 @ 0x556b8e6ece40] mmco: unref short failure
Input #0, mpegts, from 'http://USER:[email protected]:9981/stream/channelid/1872186106':
Duration: N/A, start: 34326.463811, bitrate: N/A
Program 1
Metadata:
service_name : ZDF HD
service_provider: ZDFvision
Stream #0:1[0x17de]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn
Stream #0:2[0x17e8](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream #0:3[0x17e9](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s (visual impaired) (descriptions)
Stream #0:4[0x17eb](mul): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s (hearing impaired)
Stream #0:5[0x17f2](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
Stream #0:6[0x17f3](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
No Program
Stream #0:0[0x12]: Data: epg
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
Stream #0:2 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[h264 @ 0x556b8e6e4380] co located POCs unavailable
[h264 @ 0x556b8eefb480] mmco: unref short failure
[h264 @ 0x556b8eefb480] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x556b8ef37380] mmco: unref short failure
Output #0, hls, to '/var/lib/jellyfin/transcodes/1bd39a6d0b2d3d373df99d563b962065.m3u8':
Metadata:
encoder : Lavf60.3.100
Stream #0:0: Video: h264 (High), vaapi(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 617723 kb/s, 50 fps, 90k tbn
Metadata:
encoder : Lavc60.3.100 h264_vaapi
Stream #0:1: Audio: aac, 48000 Hz, 5.1, s16, 384 kb/s
Metadata:
encoder : Lavc60.3.100 libfdk_aac
[h264_vaapi @ 0x556b8e6e2240] Failed to end picture encode issue: 24 (internal encoding error).
[h264_vaapi @ 0x556b8e6e2240] Encode failed: -5.
[vost#0:0/h264_vaapi @ 0x556b8e6f51c0] Error submitting video frame to the encoder
[libfdk_aac @ 0x556b8e6e3a00] 2 frames left in the queue on closing
I tried ZDF HD with 1.9.9 and this plugin: link ... and it worked with vaapi enabled.
I also changed something in the backend (not sure if this is still needed):
--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs
+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs
@@ -1569,7 +1569,12 @@ public class DynamicHlsController : BaseJellyfinApiController
var segmentContainer = outputExtension.TrimStart('.');
var inputModifier = _encodingHelper.GetInputModifier(state, _encodingOptions, segmentContainer);
- if (string.Equals(segmentContainer, "ts", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(state.MediaSource.Container, "mpegts", StringComparison.OrdinalIgnoreCase))
+ {
+ // wORKAROUND: Since fmp4 results in video/audio out of sync
+ segmentFormat = "mpegts";
+ }
+ else if (string.Equals(segmentContainer, "ts", StringComparison.OrdinalIgnoreCase))
https://www.sarkasti.eu/TVHeadEnd.dll works with VAAPI and QSV. With "Prefer fMP4-HLS" disabled.
Can you please provide your working QSV ffmpeg options line from the FFMpeg.Transcode* trace.
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 2000000 -probesize 1G -init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -noautorotate -i "http://192.168.0.8:9981/stream/channelid/1598261154?ticket=9274951adfee9d7bc8e7fcbe69eb9f623e51abaf" -map_metadata -1 -map_chapters -1 -threads 2 -sn -codec:v:0 h264_qsv -preset veryfast -look_ahead 0 -b:v 139616000 -maxrate 139616000 -bufsize 279232000 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,yadif=0:-1:0,format=nv12" -flags -global_header -codec:a:0 libfdk_aac -ab 384000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url "hls/54abcbe966a26098f6bf216cb99a0614/" -hls_segment_filename "/transcodes/54abcbe966a26098f6bf216cb99a0614%d.ts" -hls_playlist_type event -hls_list_size 0 -y "/transcodes/54abcbe966a26098f6bf216cb99a0614.m3u8"
@lomion0815
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 2000000 -probesize 1G -init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -noautorotate -i "http://USER:[email protected]:9981/stream/channelid/1872186106" -map_metadata -1 -map_chapters -1 -threads 0 -sn -codec:v:0 h264_qsv -preset veryfast -look_ahead 0 -b:v 20000000 -maxrate 20000000 -bufsize 40000000 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,yadif=0:-1:0,scale=trunc(min(max(iw\,ih*a)\,1920)/2)*2:trunc(ow/a/2)*2,format=nv12" -flags -global_header -codec:a:0 libfdk_aac -ab 384000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url "hls/96b1110848b69862b528fc3e54c9ad23/" -hls_segment_filename "/var/lib/jellyfin/transcodes/96b1110848b69862b528fc3e54c9ad23%d.ts" -hls_playlist_type event -hls_list_size 0 -y "/var/lib/jellyfin/transcodes/96b1110848b69862b528fc3e54c9ad23.m3u8"
EDIT: This is with https://www.sarkasti.eu/TVHeadEnd.dll
Exactly the same parameters (beside your scale the video). So should be an issue on the client side ... a timeout when waiting for the first HLS chunk ... Error:
HLS Error: Type: networkError Details: levelLoadTimeOut Fatal: false
ffmpeg command lines from https://www.sarkasti.eu/TVHeadEnd.dll and the official plugin differ in the bitrates.
As the error message is HLS Error: Type: mediaError Details: bufferFullError Fatal: false, this makes me think that the HLS stream gets somewhat set up incompatible to Firefox.
Searching for the error message in https://github.com/jellyfin shows that issues looking similar already got fixed several times in the past:
https://github.com/jellyfin/jellyfin-web/issues/1256 https://github.com/jellyfin/jellyfin-web/issues/2223 https://github.com/jellyfin/jellyfin-web/issues/4866 https://github.com/jellyfin/jellyfin-web/issues/4212
It was in fact the missing I frames because I had to disable Probing the stream before starting transcoding the framerate of the stream is not known. Since the framerate is used to calculate the "frequency" of forced I frames some default mechanism (of ffmpeg or the HW codec) jumped in which resulted in filling up the buffer before receiving a I frame.
Here is a fix/workaround for it in the backend side:
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 066fb85ec..16f5bc1dc 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1557,19 +1557,21 @@ namespace MediaBrowser.Controller.MediaEncoding
" -force_key_frames:0 \"expr:gte(t,n_forced*{0})\"",
segmentLength);
+ var gobValue = Math.Ceiling(segmentLength * 50.0);
var framerate = state.VideoStream?.RealFrameRate;
if (framerate.HasValue)
{
- // This is to make sure keyframe interval is limited to our segment,
- // as forcing keyframes is not enough.
- // Example: we encoded half of desired length, then codec detected
- // scene cut and inserted a keyframe; next forced keyframe would
- // be created outside of segment, which breaks seeking.
- gopArg = string.Format(
- CultureInfo.InvariantCulture,
- " -g:v:0 {0} -keyint_min:v:0 {0}",
- Math.Ceiling(segmentLength * framerate.Value));
+ gobValue = Math.Ceiling(segmentLength * framerate.Value);
}
+ // This is to make sure keyframe interval is limited to our segment,
+ // as forcing keyframes is not enough.
+ // Example: we encoded half of desired length, then codec detected
+ // scene cut and inserted a keyframe; next forced keyframe would
+ // be created outside of segment, which breaks seeking.
+ gopArg = string.Format(
+ CultureInfo.InvariantCulture,
+ " -g:v:0 {0} -keyint_min:v:0 {0}",
+ gobValue);
// Unable to force key frames using these encoders, set key frames by GOP.
if (string.Equals(codec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
I will have a look if we can set the framerate from the plugin instead ...
And here the patch for the plugin (no need to change the backend with this):
diff --git a/TVHeadEnd/LiveTvService.cs b/TVHeadEnd/LiveTvService.cs
index b618c96..688e13c 100644
--- a/TVHeadEnd/LiveTvService.cs
+++ b/TVHeadEnd/LiveTvService.cs
@@ -451,6 +451,7 @@ public async Task<MediaSourceInfo> GetChannelStream(string channelId, string med
{
i.IsInterlaced = true;
}
+ i.RealFrameRate = 50.0F;
}
}
@@ -475,7 +476,8 @@ public async Task<MediaSourceInfo> GetChannelStream(string channelId, string med
// Set the index to -1 because we don't know the exact index of the video stream within the container
Index = -1,
// Set to true if unknown to enable deinterlacing
- IsInterlaced = true
+ IsInterlaced = true,
+ RealFrameRate = 50.0F
},
new MediaStream
{
@@ -622,7 +624,8 @@ public async Task<MediaSourceInfo> GetRecordingStream(string recordingId, string
// Set the index to -1 because we don't know the exact index of the video stream within the container
Index = -1,
// Set to true if unknown to enable deinterlacing
- IsInterlaced = true
+ IsInterlaced = true,
+ RealFrameRate = 50.0F
},
new MediaStream
{
diff --git a/TVHeadEnd/RecordingsChannel.cs b/TVHeadEnd/RecordingsChannel.cs
index cab18aa..7b082b4 100644
--- a/TVHeadEnd/RecordingsChannel.cs
+++ b/TVHeadEnd/RecordingsChannel.cs
@@ -293,7 +293,8 @@ private ChannelItemInfo ConvertToChannelItem(MyRecordingInfo item)
// Set the index to -1 because we don't know the exact index of the video stream within the container
Index = -1,
// Set to true if unknown to enable deinterlacing
- IsInterlaced = true
+ IsInterlaced = true,
+ RealFrameRate = 50.0F
},
new MediaStream
You can find a patched plugin here
@lomion0815 The patched plugin works for me. Thanks!
Honestly I have no clue in which repo/branch your patches apply cleanly... Wanted to give https://github.com/jellyfin/jellyfin-plugin-tvheadend/pull/72 and https://github.com/jellyfin/jellyfin-plugin-tvheadend/pull/68 a try. Especially the latter one. But I can wait until your changes got merged. No worries.
They are merged to master already.
Just checking if these fixes were ever released for the plugin? I’m seeing a similar issue with the latest versions of Jellyfin and tvheadend plugin where Firefox won’t play without fmp4 disabled and having the audio sync issues on chrome browsers when fmp4 is preferred.
Looks like this might be the fix?
https://github.com/jellyfin/jellyfin-plugin-tvheadend/pull/95