Fix FFV1 writing: BGR0 instead of a format the encoder rejects#71
Merged
Conversation
VideoWriter::open() forced FFV1 to AV_PIX_FMT_GBRP, which the FFV1 encoder does not accept: [ffv1] Specified pixel format gbrp is not supported by the ffv1 encoder gbrp -> FAIL: Invalid argument yuv444p -> OK (direct avcodec_open2 probe against libavcodec 62; the encoder advertises gbrp9le and wider, but not plain 8-bit gbrp) So avcodec_open2 always failed and FFV1 output never worked at all. BGR0 keeps the stated intent -- stay in RGB, no YUV conversion, no chroma subsampling -- and matches the BGR24 cv::Mat input channel-for-channel. The two tests covering FFV1 called SKIP() when open() failed, guessing at a missing codec. FFV1 is built into ffmpeg and was present the whole time; it was the pixel format we handed it that was wrong. Combined with ctest reporting "100% tests passed" regardless of skips, a green build hid a completely broken path. Both are now REQUIRE: a present-but-unusable encoder is a bug, not an environment quirk. The round-trip check allowed a tolerance of 2, justified by the GBRP path that never ran. BGR0 never leaves RGB, so it is bit-exact and the test now asserts equality. Suite goes from 37 passed / 2 skipped to 39 passed / 0 skipped. Fixes #70 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 19, 2026
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.
Fixes #70.
VideoWriter::open()forced FFV1 toAV_PIX_FMT_GBRP. The FFV1 encoder does not accept it:(direct
avcodec_open2probe against libavcodec 62 — the encoder advertisesgbrp9leand wider, but not plain 8-bitgbrp)avcodec_open2therefore always failed and FFV1 output never worked at all.BGR0keeps the stated intent — stay in RGB, no YUV conversion, no chroma subsampling — and matches the BGR24cv::Matinput channel-for-channel.How this stayed hidden
The two tests covering FFV1 called
SKIP()whenopen()failed:The message guesses at a missing codec. FFV1 is built into ffmpeg and was present the whole time; the format we handed it was wrong. Combined with
ctestreporting "100% tests passed" regardless of skips (#66), a green build hid a completely dead code path.Both are now
REQUIRE. A present-but-unusable encoder is a bug, not an environment quirk.Stronger assertion
The round-trip test allowed a tolerance of 2, with a comment attributing it to GBRP round-tripping through the scaler — a path that never actually ran.
BGR0never leaves RGB, so the round trip is bit-exact, and the test now checks equality:Passes.
Result
Suite goes from 37 passed / 2 skipped to 39 passed / 0 skipped — 1129 assertions, no skips.
I found this by investigating why those two tests skipped rather than working around them, while implementing the skip guard for #66. The skip check itself is a follow-up PR; it would have failed CI while this bug was live, which is the correct behaviour but needed this fixed first.
🤖 Generated with Claude Code