castdisplay
What each module in castdisplay holds, what its displays take, and how each way of casting does on each runtime.
Modules
Module |
What it holds |
Runs on |
|---|---|---|
|
|
ESP32-P4 with |
|
|
ESP32-P4 with |
|
|
anything with sockets; |
|
|
ESP32-P4 with |
|
|
MicroPython, CPython |
|
the |
ESP32-P4 with |
|
|
CPython with ffmpeg |
|
|
MicroPython, CPython |
CastDisplay
CastDisplay(sink, width=720, height=720, kind="windows", canvas=None, fps=30, bitrate=3_000_000, name=None, log=None, audio=None, audio_format=(24000, 2), audio_loop=False)
Argument |
Meaning |
|---|---|
|
the TV’s or laptop’s address |
|
the picture, multiples of 16 |
|
|
|
|
|
the stream’s |
|
what the sink lists the cast as; |
|
where session messages go (default: nowhere) |
|
|
|
|
|
play a desktop’s audio file over and over |
stats() returns frames encoded and sent, fps, sessions and
idr_requests (the keyframes the sink asked for after a loss). pcm_out() is
a speaker on the cast, touch_read() and keypad_read() are the laptop’s
input, and close() ends the cast and gives the encoder back. The session
rejoins by itself when the sink goes away.
HlsDisplay
HlsDisplay(tv=None, width=1280, height=720, fps=20, bitrate=2_000_000, port=8090, segments=4, log=print)
tv is a Roku’s address, woken and told to play the stream through the
Companion channel, or None to serve only. url is the playlist’s address.
The playlist lists segments one-second segments; a player starts at the
oldest, so each adds about a second of delay. stats() and close() work as
in CastDisplay.
Each method on each runtime
Frames a second reaching the screen, for testris and for the LVGL
lv_test_timer.
Runtime |
Companion channel |
Miracast to a Roku |
Miracast to Windows |
HLS |
|---|---|---|---|---|
|
11.0, 9.1 |
30, 30 |
30 |
plays |
|
closes, 13.6 |
30, 30 |
30 |
plays |
|
13.4, 11.3 |
no H.264 |
no H.264 |
no H.264 |
|
7.7, 7.8 |
no H.264 |
no H.264 |
no H.264 |
ESP32-P4 4” panel |
2.2, 2.1 |
-, 29 |
30 |
plays |
ESP32-S3 LCD-7 |
1.8, 1.7 |
no H.264 |
no H.264 |
no H.264 |
A dash is a figure not measured. On Windows CPython, testris over the Companion channel closes the cast a moment after it starts.
No H.264 is by design: desktop MicroPython and the S3 have no H.264 encoder,
so CastDisplay and HlsDisplay stop there with an error that says so.
Sound, recorded from a TV’s speakers by a microphone:
Runtime |
Miracast to a Roku, app sound |
Companion channel ( |
|---|---|---|
|
plays, no drift, no gaps |
plays, 4.2 s behind |
|
plays, no drift, no gaps |
plays, 5.4 s behind |
|
no H.264 |
plays, 3.5 s behind |
|
no H.264 |
plays, 4.8 to 5.2 s behind |
ESP32-P4 (the panel) |
plays, no drift, no gaps |
plays, 4.3 s behind |
The ESP32-P4 Wi-Fi 6 dev kit can’t cast sound: its Wi-Fi barely sends while its speaker runs, and the TV gives up on the session.