Add support for VP8 and VP9 video encoders#6769
Conversation
|
Please merge this, scrcpy is still currently unusable on recent Onyx Boox devices 🙏 |
|
Thank you for the reminder. LGTM, I'll merge this probably for scrcpy 4.1. |
|
I made the following changes:
Please test/review the |
|
Thanks for the updates. I tested the Available encoders: VP8 works and is usable: ./run build-auto --video-codec=vp8 --max-size=1600 --video-bit-rate=32M --max-fps=5VP8 recording to MKV also works: ./run build-auto --video-codec=vp8 --record=file-vp8.mkvVP9 is constrained to a very low resolutionVP9 streaming starts, but on the ./run build-auto --video-codec=vp9 --max-size=1600 --video-bit-rate=32M --max-fps=5This makes the stream very blurry. I added temporary debug logs around For comparison, my original branch without the new encoder maximum size constraint streams VP9 at ./run build-auto-oldcheck --video-codec=vp9 --max-size=1600 --video-bit-rate=32M --max-fps=5So this looks like a regression related to the new encoder size constraint logic from #6766. For this VP9 encoder, it computes a max landscape size of VP9 recording to MKV failsVP9 recording to MKV fails: ./run build-auto --video-codec=vp9 --record=file.mkvThis looks similar to the VP8 config-packet issue fixed in c0fe9d8. I tested this local change: recorder->video_expects_config_packet =
ctx->codec_id != AV_CODEC_ID_VP8
&& ctx->codec_id != AV_CODEC_ID_VP9;With this change, VP9 recording works. |
Some encoders (especially software encoders) report incorrect capabilities. #6849 adds an option
Oh, that does not happen with my device (Pixel 8) when recording to VP9. But not expecting a config packet also works, so I will make that change. Thank you. |
Summary
This PR adds support for VP8 and VP9 video codecs. This is primarily intended as a fallback for devices where the manufacturer has intentionally disabled H.264 (AVC) and H.265 (HEVC) encoders in the firmware.
The Problem (Onyx Boox Note X case)
On recent Onyx Boox devices (e.g., Note X with current firmware), the vendor has disabled both hardware and software H.264/H.265 encoders. This makes
scrcpyunusable as it cannot find any compatible video encoder.Evidence
In
/vendor/etc/media_codecs.xml, all H.264/H.265 encoders are commented out:/vendor/etc/media_codecs.xml
Even the default Android software H.264 encoder in
media_codecs_google_video.xmlis disabled. Only VP8 and VP9 software encoders remain available:media_codecs_google_video.xml
Known Limitations (Latency)
Since these encoders are software-based on the affected devices, there is a noticeable increase in latency compared to hardware-accelerated H.264.
However, this latency can be significantly mitigated by reducing the stream resolution and frame rate (e.g., using
--max-size=1024 --max-fps=15). In my testing on the Onyx Boox Note X, these optimizations make the device much more responsive while maintaining a stable and clear stream. Given that the alternative is a total lack of functionality, this fallback is a necessary and usable compromise.Testing Environment
2026-02-11_13-07_4.1.1-rel_0210_8841760b67)Fixes #6763