This article describes setting up an encoding scenario in which both an initial stream and an output stream are UDP. The source stream can be UDP SPTS or MPTS, and also UDP unicast. Several types of UDP output streams are - SPTS, MPTS, MBTS.
A schema of typical usage:
1. Set up default input interface
Open the Management UI of the transcoder http://IP_address/ and login (defaults login/pass are admin/2bechanged). Go to "Settings"->"Network settings" menu and choose "Default input interface" where you have input multicast. The Encoder will know where to find the multicast source.
2. Setup a source
On the “Sources” menu, click “Add New Source”.
Enter the source name.
For UDP multicast input you have to select the type of source from the “Source” drop-down list - “UDP TS stream."
Enter values in “Source address” and “Source port” for the input multicast group.
If you receive the multicast group that is not from the “Default input interface,” you have to set the IP address of the ingress interface of the server before the address of the multicast group via colon (for example 192.168.1.100:126.96.36.199).
When you have set the source address and port you should click “Scan for available services” to get all services and tracks. Wait for a few seconds and if there are no error messages, you will see a window with the list of all services, which the encoder finds:
After the scanning, you will see active services from the "Service ID" drop-down list. They should have the status “on the air”. Select a service you need or choose "auto" to use the first available service:
You can select "Video PID" and "Audio PID" after choosing Service ID. If your input multicast stream has several audio tracks you can choose them one by one.
"Data track" (optional) allows selecting PIDs for subtitles or teletext to pass them through to the output. Set "disabled" if you do not have any data tracks.
CC Passthrough (optional) – check if you want to pass through closed captions subtitles to output.
"Advanced Source Settings" (optional) allows to setup:
"Interlace mode" - Use auto by default, and try other modes if you see interlace artifacts in the output signal.
"Audio Gain" - Allows you to increase or decrease the source volume level in DB.
"Video Cropping" - Cropping the picture from all sides in pixels. Set by four values (pixels to crop from a side) via space - right, left, top, and bottom.
"Blackmagic Device Mode" - This setting is used for BlackMagic SDI inputs only, otherwise set it to "Disabled."
"Backup" - Allows you to set up an alternate source stream. The Encoder will migrate to this source in case the main source will be not available.
"Overlay" - Apply overlay, persistent logo/image, text or video to the source stream.
3. Create the video template for UDP
Go to the “Templates” menu. You have two options here:
- Download “Reference Cloud Templates”
- Add new template manually
For the first option click “Get Reference Cloud Templates”, select needed templates and click “Install selected”. The chosen templates immediately will be downloaded and installed.
To set up your own template click “Add New Template”.
Enter the template name you want and select the “Codec” for the output stream. The “Description” field is optional. Click a radio button with “Resolution” you need and specify “Bitrate” in kbit/s for your first stream in the template. If you do not want change FPS type "0" for “FPS” field, otherwise type FPS you need for the output.
Optimization can take one of seven values: "TU1"-"TU7". In most cases, it is enough to set up a value between "TU7" (best speed) and "TU4" (balanced). If you set "TU1" (best quality), then the performance decreases and you will be able to setup less number of inputs (sources).
Select “Codec profile” from the drop-down list. “Baseline” profile is more simple and universal and usually used for mobile applications. Use “Main” for digital television with standard resolutions; use “High” profile for high-quality broadcasting with high resolutions and bitrates.
Select “Codec level”. Recommended values are "3" or "3.1" for baseline profile, "4" or "4.1" for the main profile and "4.1"-"5.2" for the high profile.
Choose “Rate control” (constant or variable output bitrate) or leave CBR by default.
Set “B-Frames count” from "0" to "2". Use "0" for baseline profile and "1" or "2" for the main or high profiles. A big value of B-frames will decrease the encoder performance.
Set “GOP Length” in frames. The value has to be multiple to the output FPS, for UDP output usually FPS*2 or FPS*1.
Expand “Advanced Template Settings” and set "HRD Buffer Length" and "HRD Initial Delay" parameters equal 1/10 of the bitrate value.
As soon as you are done with Stream 1, click “Add new stream” and setup Stream 2 parameters if you need multi-bitrate UDP output stream.
4. Create an audio template
To create an audio template, go to the “Audio templates” menu from WEB UI and click “Add New Audio Template”.
Select a codec and set «Sample rate» and «Bitrate» parameters. The recommended values are:
- Sample rate: 24000, 44100, 48000
- Bitrate: for AAC - 48, 64, 128, 192; for AAC HE - 48, 64, 128; for MP2, MP3 - 64, 128, 192
5. Set up an output stream
Click on the “Output streams” menu and then “Add New Output Stream”. Type a description if you need.
Start mode – "Auto" for automatic output beginning during the source start, "Manual" for manual output beginning after the source will start.
Channel – select a channel from the drop-down list
Template – select a template you have created for UDP output. If you are going to create additional output for already transcoding source, choose the same template as for an existing output
Audio template – select an audio template
Format - select one of UDP formats (SPTS for classic UDP output)
Differences of UDP formats:
- SPTS - single program transport stream, most popular, UDP output stream with only a program, each bitrate in a template presented by own IP:PORT pair
- MPTS - multiprogram transport stream, UDP output stream with several programs, all bitrates in a template presented by one IP:PORT pair
- MBTS - multi-bitrate transport stream, UDP output stream with one program and several video tracks, all bitrates in a template presented by one IP:PORT pair
After UDP format choosing, you will see so many strings of additional parameters (Multicast group – Port – Output bitrate) how many streams are in the chosen video template. Each string corresponds to the stream in the chosen template in the same order. When you don’t want to create UDP streams for all the streams in the template you can disable not needed streams by clicking “X”. Each string should have its unique pair address:port.
If you are choosing the CBR type of output, you should set the "Multicast bitrate" values with some overhead. It should be calculated from stream bitrate in the chosen template plus ~20-30%. For example, we are using the following template:
and we are going to use streams #1 and #3 (6500 and 1500 from the template). Set the output Multicast bitrate in the output stream 7500 and 2100 (including the overhead). The streams #2 and #4 we disable by clicking “X”.
If you are choosing a VBR type of UDP output, you should not calculate Multicast bitrate, the values will set to "0" automatically
Save the output stream settings and start the source at the "Source" menu.
The differences between CBR and VBR (StreamGuru analyzer):
6. Troubleshoot UDP Output
Use VLC for UDP output playback visually. See encoder’s log for warnings and errors. The most popular warning «too low target CBR bitrate (<value>)» means you should increase the corresponding Multicast bitrate value in the output stream and restart the source.