Video encoding¶
media.transcode.video
The media.transcode.video feature encodes a selected video track into the required output codec and lets you set its bitrate, resolution and GOP structure.
Creating multiple output renditions and the details of processing them together are covered in multibitrate transcoding.
Output codecs¶
The media.transcode.video feature includes encoding to the following output video codecs:
| Video codec | codec value |
|---|---|
| H.264 / AVC | {set: h264} |
| H.265 / HEVC | {set: hevc} |
| AV1 | {set: av1} |
| MPEG-2 Video | {set: mp2v} |
Configuration¶
In transcoder.output, specify the source video track with source, the target codec with codec, and the bitrate with bitrate:
streams:
- name: tv1
inputs:
- udp: {host: 239.0.0.1, port: 5000}
transcoder:
output:
- source: !best_quality video
codec: !set h264
bitrate: 2800000
Source track selection¶
For a single video output, use source: {best_quality: video} to select the video track with the highest declared bitrate. If the input ID is known, use source: {exact: v1}. With a backup source, this ID must identify the intended track on every input.
See the detailed source track selection guide for all selectors, backup switching behavior and examples.
When nothing matches, the live rule creates no output. The live pipeline does not implement the if_missing: blank and substitute modes; they cannot supply a missing signal.
Codecs and parameters¶
codec— the target video codec from the list above.codec: samepreserves the original frames without re-encoding.bitrate— the target bitrate in bits/s.gop_size— GOP length in frames.gop_structure— the frame sequence structure, for exampleiporibbbp.
HEVC¶
streams:
- name: tv1
inputs:
- udp: {host: 239.0.0.1, port: 5000}
transcoder:
output:
- source: !best_quality video
codec: !set hevc
bitrate: 2800000
AV1¶
For software encoding, the server checks available encoders in this order:
- SVT-AV1;
- libaom;
- rav1e.
If none is available, the server tries the default available AV1 encoder. The speed preset is mapped to the selected encoder settings. NVIDIA uses AV1 NVENC; the GPU must support AV1 encoding.
For segmented delivery, the server sets a fixed keyframe interval and disables scene detection in software AV1 encoders. They do not expose open GOP: the server uses closed GOP and logs a warning if open GOP is requested.
Software AV1 uses VBR with a random-access GOP. If CBR is requested, the server continues in VBR and logs a warning. This is an encoder constraint.
Resizing¶
resize |
What it does |
|---|---|
!scale |
exact scaling to the given dimensions |
!fit |
fit preserving aspect ratio (with padding, background color configurable) |
!crop |
crop to the given dimensions |
Verification¶
Check the output video codec and parameters in stream statistics. Then open http://server/streaming/v/tv1/index.m3u8 in a player and verify playback.
Next steps¶
Pixel shape and its interaction with resizing are described in SAR and anamorphic video.