2024-11-08, 06:26 PM
I'll provide a log in just a few but writing this out will take me a minute so I wanted to get that done.
The media in question is downscaled (4K --> 1080p), encoded using av1_qsv (g:q 22) with jellyfin-ffmpeg7, HDR metadata retained, DV removed using dovi_tool (if applicable), audio converted to 256k Opus. The overall bitrate for most of these is 2000-6000 kbps. The media is direct playing, no PGS/ASS/VOB subs enabled. This does not happen with every piece of media given the aforementioned treatment, but enough of them to be problematic.
The audio works just fine throughout viewing, but the video stream appears to get "stuck". Quick FF using right direction on remote will generally bring the video in sync with the audio at that timestamp, but it always sticks again (i.e., freeze-frame). If you leave the session alone, eventually the video "fast forwards" itself to catch up with the audio, only to freeze again momentarily. We're talking 30s to 2m of freeze frame, all frames displayed and screaming at a couple hundred frames per second to catch up with the audio. To be clear: this is 100% not a network issue. I can stream 20 mbps 4K content, even remuxes at 60+ mbps without issue. This seems to be a problem with the media, the encoding process, or how the WebOS client is handling the media. It's extremely odd to me...
I have tested with my Android phone, friends have utilized several different iPhone models, and even a Roku 4K stick -- on a TV which requires tonemapping -- and the media plays without issue. My phone is a Pixel 6, which supports HDR so there is no tonemapping or transcoding. The reason for treating media in this fashion is that the majority of clients support HDR, phones that support HDR are commonly-used hardware, and the bitrate (read: file size) to visual clarity is absolutely unrivaled.
So my question here relates to why this might be happening -- not enough keyframes? Chroma issues from downscaling? Has anybody seen this behavior before with any kind of content and found a fix?
ffmpeg command for anybody interested:
The media in question is downscaled (4K --> 1080p), encoded using av1_qsv (g:q 22) with jellyfin-ffmpeg7, HDR metadata retained, DV removed using dovi_tool (if applicable), audio converted to 256k Opus. The overall bitrate for most of these is 2000-6000 kbps. The media is direct playing, no PGS/ASS/VOB subs enabled. This does not happen with every piece of media given the aforementioned treatment, but enough of them to be problematic.
The audio works just fine throughout viewing, but the video stream appears to get "stuck". Quick FF using right direction on remote will generally bring the video in sync with the audio at that timestamp, but it always sticks again (i.e., freeze-frame). If you leave the session alone, eventually the video "fast forwards" itself to catch up with the audio, only to freeze again momentarily. We're talking 30s to 2m of freeze frame, all frames displayed and screaming at a couple hundred frames per second to catch up with the audio. To be clear: this is 100% not a network issue. I can stream 20 mbps 4K content, even remuxes at 60+ mbps without issue. This seems to be a problem with the media, the encoding process, or how the WebOS client is handling the media. It's extremely odd to me...
I have tested with my Android phone, friends have utilized several different iPhone models, and even a Roku 4K stick -- on a TV which requires tonemapping -- and the media plays without issue. My phone is a Pixel 6, which supports HDR so there is no tonemapping or transcoding. The reason for treating media in this fashion is that the majority of clients support HDR, phones that support HDR are commonly-used hardware, and the bitrate (read: file size) to visual clarity is absolutely unrivaled.
So my question here relates to why this might be happening -- not enough keyframes? Chroma issues from downscaling? Has anybody seen this behavior before with any kind of content and found a fix?
ffmpeg command for anybody interested:
Code:
MEDIA="MEDIA" && INPUT="INPUT" && \
cd "/mnt/media/luxe/downloads/complete/re-encode" && \
mkdir -p "/mnt/media/luxe/import/${MEDIA}" && \
# dv_rm is an alias for --> jffmpeg -init_hw_device qsv=qs:/dev/dri/renderD129 -i "$1" -c:v copy -bsf:v hevc_mp4toannexb -f hevc - | dovi_tool remove -;
dv_rm "${INPUT}" && \
jffmpeg -init_hw_device qsv=qs:/dev/dri/renderD129 -hwaccel qsv -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 -filter_hw_device qs \
-analyzeduration 200M -probesize 1G \
-i "BL.hevc" -i "${INPUT}" \
-map 0 -map 1:a:0 -map 1:s:0 -map 1:s:1 \
-c copy -c:v:0 "av1_qsv" -preset "veryslow" -low_delay_brc 1 -extbrc 1 -look_ahead_depth 100 \
-global_quality:v:0 22 \
-filter:v:0 "hwupload=extra_hw_frames=64,vpp_qsv=scale_mode=2:w=1920:h=-1:denoise=6" \
-filter:s "hwupload=extra_hw_frames=64,vpp_qsv=scale_mode=2:w=1920:h=-1:denoise=6" \
-c:a libopus -b:a 256k -ac 6 -filter:a aformat=channel_layouts="7.1|5.1|stereo" \
-metadata title="${MEDIA}" -metadata:s:v:0 title='AV1 Encoding by bitmap' \
-metadata:s:a:0 title='5.1 Surround' -metadata:s:a:0 language='eng' -disposition:a:0 default \
-metadata:s:s:0 title='English' -metadata:s:s:0 language='eng' -disposition:s:0 0 \
-metadata:s:s:1 title='English (SDH)' -metadata:s:s:1 language='eng' -disposition:s:1 0 \
"/mnt/media/luxe/import/${MEDIA}/${MEDIA} [Bluray-1080p AV1 HDR OPUS 5.1][EN][EN]-RLSGRP.mkv" && rm BL*.hevc
Jellyfin 10.10.0 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage