Repository navigation
fix(ffmpeg): frame threading for software H.264/HEVC decode; log CPU fallback (#96) - #121
Merged
Merged
Conversation
…fallback (#96) UTV forced slice-only threading on every FFmpeg decoder (980befe). H.264 and HEVC files often have one slice per frame, so software decoding used one core. Intra-only codecs (ProRes, DNxHR) and hardware decoders keep slice threading; other codecs get FFmpeg's default frame + slice threading, as upstream OpenRV does. A 4K60 HEVC clip with hardware decoding off went from 23 to 40 fps in UTV on an M-series Mac. When a codec UTV can hardware-decode ends up on the CPU, log once why: turned off in Preferences, no hardware decoder could be opened (listing the methods the FFmpeg build has), or the GPU decoder can't decode the stream. The get_format fallback now picks the first software format instead of the first entry, which can be another hardware format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
mcoliver
force-pushed
the
fix/96-hevc-decode-threads
branch
from
October 13, 2026 17:13
d6e46a2 to
6e807f5
Compare
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #96 (Windows HEVC 4K60 doesn't play smoothly).
What changes
Software decode threading. UTV has set
thread_type = FF_THREAD_SLICEon every FFmpeg decoder since 980befe. Upstream OpenRV leaves FFmpeg's default (frame + slice). H.264 and HEVC files from cameras usually have one slice per frame, so slice-only threading decodes them on one core. Now:AV_CODEC_PROP_INTRA_ONLY) keep slice threading;EAGAIN, the same as upstream, so the frame-threading delay is handled.Logging. When a codec UTV can hardware-decode (ProRes, H.264, HEVC, VP9, AV1) is decoded on the CPU, the log says why, once per codec:
INFO: Decoding 'hevc' on the CPU: hardware decoding is turned off in Preferences > Caching.INFO: Decoding 'hevc' on the CPU: no hardware decoder could be opened for it (this FFmpeg build has dxva2, d3d11va, d3d12va).INFO: Decoding 'hevc' on the CPU: the cuda hardware decoder can't decode this stream.(FFmpeg opened the GPU decoder but fell back, e.g. an unsupported profile)get_formatfallback. When the chosen hardware format isn't offered, it now returns the first software format instead ofpixelFormats[0], which is usually another hardware format with no device context.Testing (macOS, M-series)
hevc_4k60P_main_dji_mavic3.mov(the clip from #96), 35 s of playback,RV_PLAYBACK_DIAG=1:UTV_HWACCEL=none(CPU)ffmpeg -f nullon the same clip: 33 fps with-thread_type slice, 115 fps with-thread_type frame.Using videotoolbox hardware acceleration for 'hevc' decoding.UTV_HWACCEL=noneandUTV_HWACCEL=cuda(not in this build) print the first two messages above.Not tested: Windows, Linux, or any NVIDIA/AMD GPU.