Embed CEA-608 Captions in H.264 SEI with FFmpeg

This guide demonstrates how to construct an FFmpeg command to stream live H.264 video with embedded CEA-608 closed captions within the SEI (Supplemental Enhancement Information) NAL units. You will learn the required FFmpeg parameters, how to handle different caption sources, and the exact command-line syntax needed to deliver broadcast-compliant live streams to platforms like YouTube, AWS Elemental MediaLive, or Facebook Live.


The Core Parameter: a53cc

To embed CEA-608 captions into the H.264 video stream as SEI user data, you must use the libx264 encoder with the a53cc option enabled. The A/53 specification defines how closed captions (specifically CEA-608 and CEA-708) are packaged inside the MPEG-2 and H.264 video bitstreams.

By setting -a53cc 1 (or -x264-params a53cc=1), FFmpeg looks for caption side data in the input stream and injects it directly into the output H.264 SEI NAL units.


Scenario 1: Streaming with an External SCC Caption File

If you have a live video input and a synchronized SCC (Scenarist Closed Caption) file containing your CEA-608 data, use the following FFmpeg command to merge them and stream via RTMP:

ffmpeg -re -i input_video.mp4 -i captions.scc \
  -map 0:v:0 -map 0:a:0 -map 1:s:0 \
  -c:v libx264 -pix_fmt yuv420p -profile:v main -g 60 \
  -a53cc 1 \
  -c:a aac -b:a 128k \
  -f flv rtmp://live.server.com/app/stream_key

Command Breakdown:


Scenario 2: Streaming from a Source with Pre-Existing Captions

If your input source already contains caption side data (such as an SDI capture card, an MPEG-TS feed, or an MXF file with EIA-608 data), you do not need an external caption file. FFmpeg will automatically read the side data from the input and write it to the output:

ffmpeg -re -i input_with_captions.ts \
  -c:v libx264 -pix_fmt yuv420p -preset medium \
  -x264-params "a53cc=1" \
  -c:a aac -b:a 128k \
  -f flv rtmp://live.server.com/app/stream_key

Command Breakdown:


Verifying the Captions in the Output

To verify that your output stream successfully contains the CEA-608 SEI captions, you can run a quick diagnostic command on a saved segment of your stream using the ffprobe tool:

ffprobe -show_entries frame=side_data_list -select_streams v -v quiet output.mp4

Look for "side_data_type": "Closed captions" in the JSON output. If this block is present for your video frames, the CEA-608 data has been correctly embedded into the H.264 SEI NAL units.