VideoRtp¶
source extra: video-rtp
Consume RTP video streams using PyAv.
- Node type:
VideoRtp- Input:
–
- Output:
ImagePayload- Extra:
video-rtp
$ pip install "juturna-nodes[video-rtp]"
How it works¶
On warmup the node writes an SDP file, _session_in.sdp, in its pipeline
folder, describing a stream on rec_host:rec_port with payload_type and
codec at a 90000 Hz clock. On start, a worker opens that SDP with PyAV,
decodes every packet and converts each frame to RGB. Decoding uses slice
threads, so no frame is held back in the decoder or lost when the stream
stops. The frames go through the node queue, so update() numbers them and
transmits them in order.
Packets that cannot be decoded are skipped, with a warning in the log
(error decoding packet: ...). This is common until the first keyframe
arrives.
Opening the input and reading from it both time out after
JUTURNA_THREAD_JOIN_TIMEOUT seconds (2 s by default). When no packet arrives
for that long, the input is closed and opened again: the node waits for the
stream to come back, and only logs demux terminate while reading False at
DEBUG level. Any other error is logged as source unavailable (...), retrying... and the node tries again after 2 s. stop() returns within a few
seconds, also when no sender has ever connected.
The packets read while the stream is probed are kept, so a VP8 stream is transmitted whole, also after a pause. Packets without a decoding timestamp, such as the keyframe of an H.264 stream with B-frames, are decoded too. With B-frames the decoder holds the last frames back until the next ones arrive, so they are lost when the stream stops or pauses for more than 2 s; after such a pause an H.264 stream gives no frames until its next keyframe.
The time to the first frame depends on the sender’s keyframe interval. When the node joins a stream that is already running, every packet fails to decode until the next keyframe arrives. With libx264’s default GOP of 250 frames, that can take about 8 s at 30 fps.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Address the stream is received on |
|
|
|
UDP port of the stream; |
|
|
|
RTP payload type of the stream |
|
|
|
Encoding name written in the SDP |
|
|
|
Not used: the SDP always declares a 90000 Hz clock |
The node configuration reports host and port, so the port picked with
"auto" can be read and given to the sender.
Input message¶
The node has no input: it reads the RTP stream.
Output message¶
Field |
Content |
|---|---|
|
The frame, |
|
Frame size |
|
Not set ( |
|
|
|
Wall-clock time the frame was decoded, as |
|
Number of frames transmitted by the node, from |
meta is empty, and the message has no timers.
Limits¶
The end of a stream is not propagated downstream: the node only stops transmitting.
The SDP carries
a=fmtp:<payload_type> packetization-mode=1only whencodecis H.264 (H264, any case); other codecs get nofmtpline.
License¶
Code: this node is part of juturna-nodes, MIT (its
LICENSEfile).PyAV: BSD-3-Clause (the
License-Expressionof av on PyPI).FFmpeg: effectively GPL. The PyAV wheels on PyPI bundle their own FFmpeg: av 19.0.2 ships FFmpeg 9.0.2 from the pyav-ffmpeg 9.0.2-4 build, which links x264 and x265 (GPL-2.0-or-later). The FFmpeg legal page says that when its GPL parts are used, “the GPL applies to all of FFmpeg”. The libraries still report “LGPL version 3 or later” only because a pyav-ffmpeg patch to FFmpeg’s
configuremoves x264 and x265 out of the libraries that need--enable-gpl. A PyAV built from source against an LGPL build of FFmpeg (without x264, x265 or other GPL parts) avoids the GPL. (Checked on 2026-11-18 on av 19.0.2.)
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
rec_host = "127.0.0.1"
rec_port = "auto"
payload_type = 96
codec = "vp8"
encoding_clock_chan = 90000
[meta]
Pipeline usage¶
{
"name": "video_rtp",
"type": "VideoRtp",
"configuration": {}
}
Reference¶
- class VideoRtp(
- rec_host: str,
- rec_port: int | str,
- payload_type: int,
- codec: str,
- encoding_clock_chan: int,
- **kwargs,
Node implementation class