jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.73k stars 466 forks source link

Playback stops on Android TV after approx. 2min for some media #3293

Closed qdrop17 closed 4 months ago

qdrop17 commented 10 months ago

Hi everyone. My issue is, that the playback randomly stops after about 2 minutes when playing a 1080p file. The GPU acceleration is never triggered (as seen in the ffmpeg command). I think this is due to the fact, that Jellyfin only remuxes this stream, without transcoding the video - correct?

Changing the streaming quality on the Android TV app suddenly continues the stream for another 2 minutes. After this, the playback stops again.

Weirdly enough, there are no issues when watching a 4K HDR file: This properly triggers the GPU acceleration / transcoding and there are not issues.

VAinfo

$docker exec -it e9525a12fc40 /usr/lib/jellyfin-ffmpeg/vainfo --display drm --device /dev/dri/renderD128
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_20
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Mesa Gallium driver 23.2.1 for AMD Radeon Vega 10 Graphics (raven, LLVM 15.0.7, DRM 3.49, 6.2.16-19-pve)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

Media Info of the file

Video Title: 1080p H264 SDR Codec: H264 AVC: Yes Profile: High Level: 41 Resolution: 1920x1080 Aspect ratio: 16:9 Interlaced: No Framerate: 25 Bitrate: 8098 kbps Bit depth: 8 bit Video range: SDR Video range type: SDR Color space: bt709 Color transfer: bt709 Color primaries: bt709 Pixel format: yuv420p Ref frames: 1 NAL: 4

Audio Title: Ger - Dolby Digital+ - 5.1 - Default Language: ger Codec: EAC3 Layout: 5.1 Channels: 6 ch Bitrate: 192 kbps Sample rate: 48000 Hz Default: Yes Forced: No External: No

Logs

[23:09:27] [INF] [21] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for qdrop. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[23:09:27] [INF] [21] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile=AndroidTV-libVLC, Path=/data/file.1080p.web.h264.mkv, AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) media:/videos/379f964f-5aa0-b612-ce77-7ffd55d129d2/stream.mkv?MediaSourceId=379f964f5aa0b612ce777ffd55d129d2&Static=true&VideoCodec=h264&AudioCodec=eac3&AudioStreamIndex=1&api_key=<token>&SubtitleMethod=Encode&Tag=f5714844354472b3500b39629e7850c2
[23:09:27] [INF] [22] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for qdrop. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[23:09:27] [INF] [22] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile=AndroidTV-ExoPlayer, Path=/data/file.1080p.web.h264.mkv, AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=Transcode, TranscodeReason=AudioCodecNotSupported ) media:/videos/379f964f-5aa0-b612-ce77-7ffd55d129d2/master.m3u8?MediaSourceId=379f964f5aa0b612ce777ffd55d129d2&VideoCodec=hevc,h264,h264&AudioCodec=aac,mp3&AudioStreamIndex=1&VideoBitrate=119616000&AudioBitrate=384000&MaxFramerate=25&api_key=<token>&SubtitleMethod=Encode&RequireAvc=false&Tag=f5714844354472b3500b39629e7850c2&SegmentContainer=ts&BreakOnNonKeyFrames=False&h264-level=41&h264-videobitdepth=8&h264-profile=high&h264-maxrefframes=4&aac-audiochannels=2&TranscodeReasons=AudioCodecNotSupported
[23:09:28] [INF] [10] Jellyfin.Api.Helpers.TranscodingJobHelper: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -fflags +genpts  -i file:"/data/file.1080p.web.h264.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 copy -bsf:v h264_mp4toannexb -start_at_zero -codec:a:0 libfdk_aac -ac 2 -ab 384000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/data/transcodes/2e8b28a69c4b60cd818b045bb24e38f0%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcodes/2e8b28a69c4b60cd818b045bb24e38f0.m3u8"
[23:09:28] [INF] [28] Jellyfin.Api.Helpers.TranscodingJobHelper: Stopping ffmpeg process with q command for /config/data/transcodes/2e8b28a69c4b60cd818b045bb24e38f0.m3u8
[23:09:28] [INF] [28] Jellyfin.Api.Helpers.TranscodingJobHelper: FFmpeg exited with code 0
[23:09:28] [INF] [28] Jellyfin.Api.Helpers.TranscodingJobHelper: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -ss 00:09:52.000 -fflags +genpts  -i file:"/data/file.1080p.web.h264.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 copy -bsf:v h264_mp4toannexb -start_at_zero -codec:a:0 libfdk_aac -ac 2 -ab 384000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 6 -hls_segment_type mpegts -start_number 74 -hls_segment_filename "/config/data/transcodes/2e8b28a69c4b60cd818b045bb24e38f0%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcodes/2e8b28a69c4b60cd818b045bb24e38f0.m3u8"
[23:10:05] [INF] [10] Jellyfin.Api.Helpers.TranscodingJobHelper: FFmpeg exited with code 0
[23:10:25] [INF] [27] Emby.Server.Implementations.HttpServer.WebSocketManager: WS 192.168.7.7 request
[23:11:11] [INF] [35] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[23:11:23] [INF] [17] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[23:11:35] [INF] [17] Emby.Server.Implementations.Session.SessionWebSocketListener: Lost 1 WebSockets.

What's interesting: The ffmpeg log end with this:

[hls @ 0x564006ac5800] Opening '/config/data/transcodes/d91077855573cf3dca4ab7ba0d1e96de374.ts' for writing
[hls @ 0x564006ac5800] Opening '/config/data/transcodes/d91077855573cf3dca4ab7ba0d1e96de375.ts' for writing
[hls @ 0x564006ac5800] Opening '/config/data/transcodes/d91077855573cf3dca4ab7ba0d1e96de376.ts' for writing
[hls @ 0x564006ac5800] Opening '/config/data/transcodes/d91077855573cf3dca4ab7ba0d1e96de377.ts' for writing
frame=40063 fps=1278 q=-1.0 Lsize=N/A time=00:26:42.53 bitrate=N/A speed=51.1x    
video:1516165kB audio:74746kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Stats for Nerds Screenshots image

...but in the webplayer, the issue does not occur.

Server System (please complete the following information):

Client System (please complete the following information):

Any help is highly appreciated.

qdrop17 commented 10 months ago

Update: Switching the player inside the Jellyfin App from ExoPlayer to Automatic seems to resolve the issue. But then, my TV fails to start HDR mode for other streams with are HDR... ;-)

jellyfin-bot commented 4 months ago

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 master branch, 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.