Skip to content

SDI Coder

Overview

SDI Coder is a module within mcaster designed for capturing video and audio through SDI cards. The module provides high-quality reception of professional video signals and is one of the main stream input options in the mcaster system.

SDI captured stream

Supported Capture Cards

Dektec

  • Full support for all Dektec models
  • Automatic signal parameter detection
  • Support for all SDI standards

Blackmagic Design

  • Compatibility with Blackmagic cards
  • Support for DeckLink series
  • Integration with Blackmagic SDK

V4L Compatible Cards

  • Streamlabs — streaming cards
  • Softlab — professional capture cards
  • Magewell — USB and PCI capture cards
  • Any other cards with V4L2 support

Supported Formats

SDI-SD (Standard Definition)

  • Resolution: 480i, 576i
  • Frame rates: 25, 29.97, 30 fps
  • Features: Analog teletext support (zvbi)
  • Application: Archive materials, SD broadcasting

SDI-HD (High Definition)

  • Resolutions: 720p, 1080i, 1080p
  • Frame rates: 23.976, 24, 25, 29.97, 30, 50, 59.94, 60 fps
  • Standards: HD-SDI, 3G-SDI

SDI-UHD (Ultra High Definition)

  • Resolutions: 4K (2160p), 8K
  • Standards: 6G-SDI, 12G-SDI
  • Application: Modern UHD broadcasting

Input Signals

Video

  • Main SDI video signal
  • Automatic parameter detection
  • Support for various color spaces

Multichannel Audio

  • Channels: up to 16 audio channels
  • Formats: PCM, AES/EBU
  • Sample rate: 48 kHz (standard), 96 kHz (optional)
  • Bit depth: 16, 20, 24 bit

Teletext and Subtitles

  • SDI-SD: Analog teletext (zvbi)
  • SDI-HD: Digital subtitles
  • Formats: DVB, CEA-608, CEA-708
  • Encodings: UTF-8, Latin-1

CEA-608/708 Closed Captions

Closed captions (CC) are text representation of the audio part of a TV program, movie, etc. It is a transcription or translation of the dialogue, sound effects, some relevant musical cues, and other relevant audio information in case when sound is unavailable or not clearly audible. Initially, closed captions were designed for deaf and hard of hearing people.

Mcaster is able to detect CEA-608/708 closed captions in SDI source streams and to read them. It is done automatically, so there's no need to configure it explicitly. The module reads the CEA-608/708 captions from an SDI stream, performs repackaging and then carries them within the MPEG-TS stream as an H.264 SEI NALU.

Note

H.264 file consists of a number of NAL Units, i.e., Network Abstraction Layer Units, SEI* refers to Supplemental Enhancement Information.

CEA-608 is a streaming, character-based format that allows for the transmission of up to 4 simultaneous channels of data. Mcaster adds 4 text tracks to those 4 channels (one for every channel). As a result, we have 4 text tracks and one video track carrying CEA-608/708 closed captions. You can later play those text tracks via WebVTT or TTML together with HLS, DASH, etc. video streams.

VBI Teletext (Important for Legacy Broadcasting Systems)

VBI teletext is a critically important feature for legacy broadcasting systems that still transmit teletext and SD quality. VBI (Vertical Blanking Interval) is a gap in the sequence of lines which is used in analog television. During VBI no picture information is transmitted, but this area may contain such information as teletext or closed captions.

Mcaster allows reading EBU Teletext and subtitles (EBU Teletext subtitle data) from VBI in source streams received from an SDI card. Mcaster then retransmits them to MPTS or SPTS output.

When receiving video from an SDI card, Mcaster:

  1. Decodes the received data
  2. Reads the information about teletext from VBI
  3. Compresses the data to be further transmitted over the Internet
  4. Packages the stream with the teletext data into an MPEG-TS stream
VBI Teletext Configuration

To enable teletext reading, use the ttxt_descriptors parameter:

stream example_stream {
    input v4l2:// audio_device=plughw:1,0 ttxt_descriptors=0x100:rus:initial,0x888:rus:subtitle vbi_debug=true vbi_device=/dev/vbi0 video_device=/dev/video0;
}

For Decklink cards:

stream example_stream {
    input decklink://0 pixel=10 ttxt_descriptors=0x100:rus:initial,0x888:rus:subtitle;
}

For Decklink cards with NVENC transcoding:

stream example-stream {
  input decklink://2 pixel=10 ttxt_descriptors=0x100:rus:initial,0x888:rus:subtitle;
  transcoder deviceid=0 external=false hw=nvenc vb=5000k vcodec=h264 open_gop=false preset=veryfast size=3840x2160:fit:#000000 ab=128k split_channels=false;
}
Teletext Parameters

The ttxt_descriptors require the following parameters:

  • page — page number according to the format 0x[teletext_magazine_number][teletext_page_number]
  • lang — the language of teletext according to the ISO 639-2 standard
  • type — teletext page type:
  • initial — initial teletext page
  • subtitle — page with subtitles
  • impaired — teletext subtitle page for hearing impaired people

Example: ttxt_descriptors=0x100:rus:initial,0x888:rus:subtitle

Note

This feature is especially important for integration with legacy broadcasting systems that continue to use analog teletext in SD quality.

Timestamp Correction Subsystem

Automatic Alignment

  • Timestamp jitter: Automatic stabilization
  • Algorithms: Adaptive filtering, median filtering
  • Accuracy: ±1 μs

Lost Frame Correction

  • Detection: Automatic identification of missing frames
  • Recovery: Duplication of previous frame or interpolation
  • Logging: Recording all corrections in log

Correction Settings

timestamp_correction:
  enabled: true
  jitter_threshold: 1000  # microseconds
  frame_drop_detection: true
  interpolation_method: "duplicate"  # duplicate, interpolate
  log_corrections: true

Module Configuration

Basic Settings

sdi_coder:
  device: "/dev/video0"
  input_format: "auto"  # auto, 1080i50, 720p60, etc.
  audio_channels: 8
  enable_teletext: true
  timestamp_correction: true

Capture Parameters

capture_settings:
  video_buffer_size: 10  # seconds
  audio_buffer_size: 5   # seconds
  drop_frames_on_overflow: true
  sync_mode: "hardware"  # hardware, software

Output Settings

output_settings:
  format: "mpegts"
  bitrate: "auto"  # auto or specific value
  gop_size: 30
  audio_codec: "aac"
  video_codec: "h264"

Integration with mcaster

As Stream Source

SDI Coder can be configured as a source for: - Live streaming - DVR recording - Transcoding - Network distribution

Stream Configuration Example

streams:
  sdi_main:
    source: "sdi_coder:///dev/video0"
    output: "rtmp://server/live/stream"
    transcoder:
      video:
        codec: "h264"
        bitrate: "5000k"
        resolution: "1920x1080"
      audio:
        codec: "aac"
        bitrate: "128k"
        channels: 2

Monitoring and Diagnostics

Capture Statistics

  • Frame rate (current/average)
  • Video and audio bitrate
  • Number of timestamp corrections
  • Synchronization status

Logging

logging:
  level: "info"  # debug, info, warning, error
  log_timestamp_corrections: true
  log_frame_drops: true
  log_device_status: true

Prometheus Metrics

  • sdi_coder_fps — frame rate
  • sdi_coder_bitrate — bitrate
  • sdi_coder_timestamp_corrections — number of corrections
  • sdi_coder_frame_drops — dropped frames

Troubleshooting

Common Issues

No Signal

  1. Check SDI cable connection
  2. Ensure correct device selection
  3. Check input signal format

Synchronization Issues

  1. Enable timestamp correction
  2. Check SDI signal quality
  3. Configure buffering parameters

Audio Issues

  1. Check audio channel settings
  2. Ensure audio format support
  3. Check audio/video synchronization

Diagnostic Commands

# Check available devices
v4l2-ctl --list-devices

# Information about current signal
v4l2-ctl --device=/dev/video0 --all

# Capture test
ffmpeg -f v4l2 -i /dev/video0 -t 10 test.mp4

System Requirements

Hardware Requirements

  • CPU: Minimum 4 cores for HD, 8 cores for UHD
  • RAM: 8 GB for HD, 16 GB for UHD
  • Network: Gigabit Ethernet
  • Storage: SSD for buffering

Software Requirements

  • Linux kernel 4.19+
  • V4L2 support
  • FFmpeg 4.0+
  • Appropriate drivers for SDI card

Conclusion

SDI Coder provides a professional solution for capturing SDI signals in the mcaster system. The module ensures high reliability, automatic timestamp correction, and support for a wide range of equipment, making it an ideal choice for professional broadcasting.