filter_units
Remove units with types in or not in a given set from the stream.
- pass_types
List of unit types or ranges of unit types to pass through while removing all others. This is specified as a ’|’-separated list of unit type values or ranges of values with ’-’.
- remove_types
Identical to pass_types, except the units in the given set removed and all others passed through.
The types used by pass_types and remove_types correspond to NAL unit types (nal_unit_type) in H.264, HEVC and H.266 (see Table 7-1 in the H.264 and HEVC specifications or Table 5 in the H.266 specification), to marker values for JPEG (without 0xFF prefix) and to start codes without start code prefix (i.e. the byte following the 0x000001) for MPEG-2. For VP8 and VP9, every unit has type zero.
Extradata is unchanged by this transformation, but note that if the stream contains inline parameter sets then the output may be unusable if they are removed.
For example, to remove all non-VCL NAL units from an H.264 stream:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=pass_types=1-5' OUTPUT
To remove all AUDs, SEI and filler from an H.265 stream:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
To remove all user data from a MPEG-2 stream, including Closed Captions:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=178' OUTPUT
To remove all SEI from a H264 stream, including Closed Captions:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=6' OUTPUT
To remove all prefix and suffix SEI from a HEVC stream, including Closed Captions and dynamic HDR:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=39|40' OUTPUT