VideoPlayerVideo: only double the frame rate for interlaced streams - #79
Merged
Portisch merged 1 commit intoAug 30, 2026
Merged
Conversation
OpenStream() rewrote every 25 or 29.97 fps stream to 50 or 59.94 and asserted SetVideoInterlaced(true) from the container fps hint alone, so a progressive 25p file was declared 50fps interlaced before a frame was decoded. VideoPlayer.cpp already performs the same doubling with the same constants, gated on hint.interlaced. Gate this copy the same way so the two agree. Neither self-correcting path recovers on Amlogic: CalcFrameRate's skipHalving guard trusts the interlace flag this code just set, and the vfmt rescue reads /sys/class/deinterlace/di0/frame_format, which reads "null" when the deinterlacer is not engaged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Description
CVideoPlayerVideo::OpenStream()rewrites any 25 or 29.97 fps stream to 50 / 59.94 and assertsSetVideoInterlaced(true), from the container fps hint alone — there is no interlace test. A progressive 25p file is declared 50 fps interlaced before a frame is decoded.Neither self-correcting path recovers it on Amlogic.
CalcFrameRate()'sskipHalvingguard trusts the interlace flag this code just set, and logsskipping halve: interlaced stream, keeping fps 50.000000 (measured 25.000000)every window. TheProcessDecoderOutput()rescue requiresm_vfmt == "progressive"from/sys/class/deinterlace/di0/frame_format, but that node readsinterlaceornull— never the wordprogressive— so it cannot fire.Nothing else asserts interlace on this path:
DVDVideoCodecFFmpegsets the flag for software decode, butDVDVideoCodecAmlogicdoes not, so the fps heuristic is the only source.Visible effect: a 25p file plays at 2160p50 with the deinterlacer flagged on, and
videoscreen.whitelistdoublerefreshrate = falsecannot prevent it — the doubling happens inOpenStream(), beforeResolution.cppis consulted, so the setting has nothing left to veto.Fix
CVideoPlayer::OpenStream()already performs the same doubling, with the same constants and the sameSetVideoInterlaced(true), gated onhint.interlaced— and computes the rate asfpsscale / (fpsrate * (hint.interlaced ? 2 : 1)), consulting the flag twice. This gates the second copy the same way, so the two agree:hint.interlacedcomes fromDVDDemuxFFmpegonfield_orderin {TT, BB, TB, BT}.Testing
Homatics Box R 4K Plus (S905X4-K), CoreELEC 22 built from this branch, played over SMB.
field_orderdi0/frame_formatnullttinterlacebbinterlacettinterlaceThe progressive case now logs
framerate: 25.00andDisplay resolution ADJUST : 3840x2160 @ 25.00instead of@ 50.00; the interlaced cases are unchanged, both branches and both field orders.Surveyed 2470 sample files for the regression risk — content that is interlaced but not flagged. 47 interlaced files, all correctly flagged
tt/bb, including h264 1080i inside MKV; zero interlaced-but-unflagged (25 plausible candidates frame-checked). The one case I could construct isx264 --interlacedmuxed straight to MKV, which reportsprogressivewhile frames are interlaced; the same bitstream in MPEG-TS reportstt, and remuxing real interlaced content TS → MKV preserves it.Written by my AI co-author (Claude Code); posted from my account.