Repository navigation
Video capture: x264 lossless is really lossless now, and FFV1 stops warning about its pixel format (#1662) - #1677
Merged
Merged
Conversation
…1662) FFmpeg refused -pix_fmt gbrp for FFV1 and libx264 and picked its own format with a warning; libx264's pick (yuv444p) was not lossless. Each codec now asks for an RGB format its encoder accepts, checked bit-exact through HLAE's exact pipe command on FFmpeg 7.1, 8.1 and 9.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 4, 2026
Open
…fore extractplanes) (#1662) A hudalpha captured with the old x264 lossless option is yuv444p, and extractplanes=r alone stops the render ("Requested planes not available"). One shared graph for the three places; a no-op for RGB alpha. test_ffmpeg() moves to test_support for the tests that share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts, comment fixes (#1662) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Review findingsFable review of 803b340 (SAFE WITH FOLLOW-UPS). The owner kept x264 lossless truly lossless (
The FFmpeg tests pass with FFmpeg 7.1.1, 8.1.4 and 9.1, and fail on the old args and graph (checked by putting them back). Not checked: HUD edges by eye, and capture speed against Ut Video in game. |
…ay skip, bgra too, literal old HUD graph (#1662) Round-2 review of #1677: test_ffmpeg panics when the variable names an FFmpeg that doesn't run; encoder availability comes from -encoders; the round trip pipes bgr24 and bgra and needs three codecs to run; the HUD test compares against the old graph written out; FFV1's keyframe comment says one in twelve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Review findingsRound-2 Fable review of cb09517 (SAFE WITH FOLLOW-UPS, no app-code finding). Dev merged in (9e417d1); fixes in 9bb93c2.
All FFmpeg tests pass with FFmpeg 7.1.1, 8.1.4 and 9.1; a broken DODSTUDIO_TEST_FFMPEG path now fails. |
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.
Release note: Fixed: Video capture mode's "x264 lossless" codec is now really lossless (it was quietly converting to YUV), FFV1 no longer logs a pixel-format warning, and HUD takes captured with the old x264 option render again.
Closes #1662
What changed
CaptureCodec::args(native/src/patch/types.rs) asked FFmpeg for-pix_fmt gbrpwith FFV1 and x264. Neither encoder takes it, so FFmpeg picked its own format and only printed a warning:-c:v utvideo -pix_fmt gbrp-c:v ffv1 -level 3 -pix_fmt gbrp-c:v ffv1 -level 3 -pix_fmt bgr0-c:v libx264 -qp 0 -pix_fmt gbrp-c:v libx264rgb -qp 0 -pix_fmt bgr24-c:v rawvideo -pix_fmt bgr24FFV1 files come out exactly as before (it was already auto-picking bgr0); only the warning goes. x264 lossless now uses
libx264rgb, the RGB encoder, since plainlibx264only takes YUV. Container staysvideo.avifor every codec (scanner::VIDEO_FILE); no.mp4is involved. UI labels and setting ids are unchanged.Old takes: main streams captured with the old x264 option (
yuv444p) still render. HUD takes did not: theirhudalphaisyuv444ptoo, and the HUD merge'sextractplanes=rhas no red plane to take from YUV, so FFmpeg stopped the render ("Requested planes not available"; true on dev before this PR too). The merge is now[1:v]format=gbrp,extractplanes=r[alpha]in one shared constant used by the one-piece and segmented renders (renderer/ffmpeg_args.rs,renderer/segment_plan.rs); for RGB alpha (BMP, Ut Video, FFV1, x264 RGB) the conversion changes no pixel. An old take's matte is still only as good as its lossy YUV capture.Tests:
types_capture_codec_tests.rs: an FFmpeg round trip per codec withcodec.args()the way HLAE pipes frames (no "Incompatible pixel format", framemd5 equal to the input); every-pix_fmtis one its encoder lists; x264 useslibx264rgb; FFV1 asks forbgr0.ffmpeg_args.rs:a_hud_take_renders_with_a_yuv_or_an_rgb_alpha_videoruns the renderer's real HUD inputs and merge on ayuv444palpha (renders) and an RGB alpha (same frames as before).test_support::test_ffmpeg()(DODSTUDIO_TEST_FFMPEG, elseffmpegon PATH), which the take checks and preview frame tests now share instead of keeping their own copies. ADODSTUDIO_TEST_FFMPEGthat doesn't run now fails them instead of skipping. Onlylibx264rgb(and libx264 for the old-take case) may be missing, decided fromffmpeg -encoders; the round trip pipes bothbgr24andbgraand needs at least three codecs to run. They don't run in CI yet ([Chore] FFmpeg-gated Rust tests never run in CI #1687).docs/direct_to_video_capture.mdnotes the old x264 size figure was lossy and gives new measurements; thetake_frames.rscomment no longer says HLAE's codecs are all intra-only.Test done
Pipe replay of HLAE 2.192.4's exact command (prefix from
AfxHookGoldSrc/filming.cpp, see Test direct-to-video capture with FFmpeg 9 (HLAE builds the input arguments) #1660:ffmpeg -f rawvideo -pixel_format {bgr24|bgra} -loglevel repeat+level+warning -framerate 120 -video_size 320x240 -i pipe:0 -vf setsar=sar=1/1,vflip <codec args> video.avi), 60 noisy test-pattern frames piped in as bgr24 and as bgra, on FFmpeg 7.1.1, 8.1.4 and 9.1 (BtbN). Round trip checked with framemd5 (decoded to bgr24) against the vflipped input:In game, Brain account, HLAE 2.192.4,
test-fixtures/ci_fixture.dem,mirv_movie_separate_hud 1,-afxForceAlpha8 1, 120 fps, one ~4 s take per codec, viagame_probe.pyand the hook's remote pipe:No "Incompatible pixel format" in the logs, no crash. Both HUD streams carry content (red channel up to 255). Each take rendered to ProRes 422 (main) and through the HUD merge to ProRes 4444, all exit 0. Capture speed against Ut Video was not measured in game.
Old x264 HUD takes, in game: the same set-up with the pre-PR args (
-c:v libx264 -qp 0 -pix_fmt gbrp) on PRE (151 frames) and POST (65): all three streamsyuv444p, and HLAE's console logged FFmpeg's "Incompatible pixel format" warning (so the new takes' clean logs mean something). Their HUD passes now render to ProRes 4444 with the new merge. Looked at by eye, 6x crops composited over the main stream for all six takes (old x264, FFV1, x264 RGB on PRE and POST): the crosshair, the only HUD element this demo shows, has clean edges, no fringe and nothing see-through. Stills kept out of the repo inlocal\review-images\1662\.FFmpeg tests in
cargo testpass withDODSTUDIO_TEST_FFMPEGset to 7.1.1, 8.1.4 and 9.1. On the old code, the round trip test fails (FFV1 "Incompatible pixel format") and the HUD test fails ("Requested planes not available"), checked by putting the old args and graph back.Size and speed, 600 frames of a real 1280x720 BMP capture (1,582 MB raw), FFmpeg 9.1: Ut Video 806 MB (~950 fps), FFV1 705 MB, libx264rgb 681 MB (~65 fps), old libx264 yuv444p 417 MB (~67 fps, lossy).
cargo test -p native(2,051 passed, after merging dev), clippy (-p native --all-targets -D warnings, 1.98.1) and rustfmt clean. Not tested in VEGAS.Decisions
bgr0, notgbrp10or similar: FFV1 has no 8-bit planar RGB, bgr0 is 8-bit, bit-exact, and is what files already were. A 10-bit format would grow files for nothing.libx264rgbwithbgr24(HLAE's own frame format; bgra input converts losslessly in RGB).Follow-ups filed from the review
disk.rscomment for x264 lossless.-g 1.Other open PRs
#1390 touches
native/src/patch/types.rsbut notCaptureCodec; no interaction.🤖 Generated with Claude Code