LinuxCommandLibrary

ffmpeg-bitstream-filters

Modify video/audio bitstreams without re-encoding

SYNOPSIS

`ffmpeg -i input -bsf:a audio_bitstream_filter -bsf:v video_bitstream_filter output`

PARAMETERS

`input`
    The input file.

`output`
    The output file.

`-bsf[:stream_specifier] bitstream_filter`
    Apply the specified bitstream filter to the designated stream. The stream specifier allows targeting specific audio (`-bsf:a`) or video (`-bsf:v`) streams. If no stream specifier is given, it's applied globally.

`-bitstream_filters`
    Show available bitstream filters.

DESCRIPTION

The `ffmpeg-bitstream-filters` command within the FFmpeg suite provides a way to manipulate audio and video bitstreams without full decoding and encoding. This is useful for tasks such as removing padding, modifying specific metadata, or correcting minor bitstream errors efficiently. Bitstream filters operate at a lower level than regular FFmpeg filters, directly modifying the compressed data. This results in faster processing times and reduced computational cost compared to full transcoding.

Typical use cases include injecting Extradata, changing parameter sets, or working around encoder bugs. The specific bitstream filters available depend on the FFmpeg build and enabled libraries. They are invoked through the `-bsf` option in `ffmpeg`, `ffplay`, or `ffprobe`. Understanding the bitstream structure and the target codec is crucial for effectively using these filters.

CAVEATS

Incorrectly applied bitstream filters can corrupt the output file, rendering it unplayable or causing other issues. It is crucial to understand the purpose and limitations of each filter before using it. Bitstream filters are not a replacement for proper encoding or transcoding and may not be suitable for all tasks. Some filters are codec-specific, and attempting to use them on incompatible streams will result in errors.

LISTING AVAILABLE FILTERS

To get a list of the available bitstream filters in your FFmpeg installation, run `ffmpeg -bitstream_filters`. This will output a list of filters that you can then use with the `-bsf` option.

EXAMPLES

Example for removing parameter sets from an h264 stream: `ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannexb output.mp4`
Example injecting an Extradata to an aac stream: `ffmpeg -i input.mp4 -c copy -bsf:a aac_adtstoasc output.mp4`

SEE ALSO

ffmpeg(1), ffprobe(1), ffplay(1)

Copied to clipboard