Preserve CEA-708 Captions with FFmpeg
Transcoding video files often strips embedded CEA-708 closed captions
because modern video encoders discard Supplemental Enhancement
Information (SEI) user data by default. This guide provides actionable
FFmpeg commands to retain CEA-708 closed captions during transcoding,
explaining how to use the -a53cc flag for H.264 video, how
to handle discrete subtitle streams, and how to verify that captions
survive the encoding process.
1. Identify the Caption Format
CEA-708 captions are typically stored in one of two ways:
- Embedded in the video bitstream as ATSC A/53 SEI user data (common in broadcast MPEG-2 and H.264 transport streams).
- As a discrete subtitle/data stream within a container (such as MXF or MKV).
Run ffprobe to determine how the input file stores
captions:
ffprobe -hide_banner input.ts- If you see a stream designated as
Subtitle: eia_608orSubtitle: cea_708, the captions exist as an independent stream. - If you do not see a subtitle stream, but the video is broadcast-derived, the captions are likely embedded inside the video stream's SEI packets.
2. Preserving
Embedded Captions with libx264
When re-encoding video to H.264 using libx264, FFmpeg
will drop A/53 closed captions unless explicitly instructed to parse and
re-inject them.
Use the -a53cc 1 option to enable ATSC A/53 closed
caption preservation:
ffmpeg -i input.ts -c:v libx264 -a53cc 1 -crf 20 -c:a copy output.mp4How it works:
-a53cc 1: Forceslibx264to preserve the incoming A/53 closed caption data (which carries CEA-608 and CEA-708) and write it into the output video's SEI NAL units.-c:a copy: Copies audio streams without re-encoding, saving processing time and avoiding generational loss.
3. Preserving Captions Located in a Separate Stream
If the source file stores CEA-708 as a distinct stream (common in formats like MXF or Matroska), you must map the stream explicitly and copy the codec data without re-encoding:
ffmpeg -i input.mxf -map 0:v -map 0:a -map 0:s -c:v libx264 -crf 20 -c:a copy -c:s copy output.mkvImportant Container Limitations:
- The MP4 container format does not support raw
CEA-708 caption streams; it only supports embedded SEI caption data or
timed text formats like
mov_text. - The MPEG-TS (
.ts) and Matroska (.mkv) formats offer broad native support for discrete caption tracks.
4. Embedding Discrete Captions into H.264 SEI
If the input contains a discrete CEA-708/CEA-608 stream and the
target format is an MP4 container, use the subcc filter to
extract and embed the captions directly into the H.264 bitstream:
ffmpeg -f lavfi -i "movie=input.mp4[out0+subcc]" -map 0:v -map 0:a -c:v libx264 -a53cc 1 -c:a copy output.mp45. Verifying the Preserved Captions
Standard media players do not always display embedded SEI captions
correctly. Use FFmpeg's subcc filter to verify that
captions are present in the transcoded file without fully decoding the
video:
ffmpeg -f lavfi -i "movie=output.mp4[out0+subcc]" -map 0:s -f null -If captions were preserved successfully, the terminal output will show a continuous stream of processed subtitle frames rather than an empty stream error.