Summary
An Android device without an H.265 encoder never shows a picture over Wi-Fi. Over Wi-Fi Pinky asks for H.265, and on a TCL Smart TV Pro (Android 14), whose only encoders are software h264, av1 and vp8, the scrcpy server fails in MediaCodec.createEncoderByType before it writes the codec header:
No picture: open the video stream: scrcpy: read codec: EOF; server log:
[server] ERROR: Could not create default video encoder for h265 | ...
java.lang.IllegalArgumentException: Failed to initialize video/hevc, error 0xfffffffe (NAME_NOT_FOUND)The existing H.265 → H.264 fallback (sessionWith, hevcWorks) only covers a session that started and then ended before its first frame. Here scrcpy.Start itself fails, so noHEVC is never set and every try fails the same way.
scrcpy:startErrorreturns an*EncoderError(same message, withUnwrap) when the server's log shows the video encoder failed (VideoFailure, the existingencoderErrorRE).android:sessionWithandOpenDisplaytreat that error on an H.265 start like the existing fallback: log it, setnoHEVC, and start again once with H.264.
Evidence
TCL Smart TV Pro, Android 14, over wireless debugging, with a temporary device-tagged test that opens the device with VideoCodec: "h265" and reads the stream's first packet (not committed):
- Before: fails with
scrcpy: read codec: EOF; server log: ... Could not create default video encoder for h265, the error the app shows. - After:
the H.265 encoder failed (Exception on thread Thread[video,5,main]); using H.264, then the session starts, and the stream ish264at 1920x1080 with packets flowing. go build ./... && go vet ./... && go test ./...pass on macOS (arm64).
Merge Danger
Door: two-way
Blast Radius: Android sessions whose start fails with an encoder error in the server's log. Successful starts and other start failures return the same error as before. Only an H.265 start retries, once.
Suggested notes for CHANGELOG.md:
- Android devices without an H.265 encoder, such as some TVs, now show a picture over Wi-Fi instead of "No picture: … read codec: EOF".
Suggested notes for CHANGELOG.zh-CN.md:
- 没有 H.265 编码器的 Android 设备(例如部分电视)通过 Wi-Fi 连接时也能显示画面了,不再提示「No picture: … read codec: EOF」。
Reviewer: @DIYgod, owner of the repo.