Skip to content

fix(video): re-tag YCgCo recordings before scaling analyzer clips - #235

Open
sergeikolos-idt wants to merge 1 commit into
google:mainfrom
sergeikolos-idt:fix/video-ycgco-colorspace
Open

sergeikolos-idt wants to merge 1 commit into
google:mainfrom
sergeikolos-idt:fix/video-ycgco-colorspace

Conversation

@sergeikolos-idt

Copy link
Copy Markdown

Summary

On some real devices the scrcpy screen recording is tagged color_space=ycgco, color_trc=log316. We saw this on a Nothing A063 (Android 15) with scrcpy 3.3.3. swscale cannot convert from YCgCo, so the scale filter in render_timeline_clip fails the whole filter graph:

Impossible to convert between the formats supported by the filter 'Parsed_setpts_1' and the filter 'auto_scale_0'
Error reinitializing filters!
Conversion failed!   (rc 178)

As a result, every video_analyzer and analyze_audio_only call on such a device fails after all retries ("Failed to trim video segment after retries"). In our run the Flash agent spent about 4 minutes in these retries while a live phone call stayed open.

Change

  • artemis/utils/video.py: put setparams=colorspace=bt709:color_trc=bt709:color_primaries=bt709 before trim/scale for recording pieces. The pixels do not change. Only the colour metadata changes, which swscale uses to choose a conversion.
  • tests/unit/test_unified_controller_video.py: a new test renders a clip from a recording tagged YCgCo/log316 with h264_metadata. The test fails on main with the error above and passes with this change.

Testing

  • pytest tests/unit/test_unified_controller_video.py: 23 passed. The new test fails without the fix.
  • ruff format --check and ruff check on the changed files: clean.
  • Full pytest: the same 80 pre-existing failures as on a clean main in this environment (flash step summarizer, video analyzer agent tests). This change adds no new failures.
  • I re-rendered the 155–167 s window from the real failing recording: rc 178 before the fix, a valid clip after it.

🤖 Generated with Claude Code

Some devices (seen on a Nothing A063 / Android 15 with scrcpy 3.3.3) tag the
screen recording as color_space=ycgco, color_trc=log316. swscale cannot
convert from YCgCo, so the scale filter in render_timeline_clip fails the
whole graph ("Impossible to convert between the formats supported by the
filter 'Parsed_setpts_1' and the filter 'auto_scale_0'", rc 178). Every
video_analyzer and analyze_audio_only call then fails after all retries.

Re-tag the input as BT.709 with setparams before trim/scale. Pixels are not
changed; only the colour metadata that swscale uses to pick a conversion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant