1 @chapter Bitstream Filters
2 @c man begin BITSTREAM FILTERS
4 When you configure your FFmpeg build, all the supported bitstream
5 filters are enabled by default. You can list all available ones using
6 the configure option @code{--list-bsfs}.
8 You can disable all the bitstream filters using the configure option
9 @code{--disable-bsfs}, and selectively enable any bitstream filter using
10 the option @code{--enable-bsf=BSF}, or you can disable a particular
11 bitstream filter using the option @code{--disable-bsf=BSF}.
13 The option @code{-bsfs} of the ff* tools will display the list of
14 all the supported bitstream filters included in your build.
16 Below is a description of the currently available bitstream filters.
18 @section aac_adtstoasc
22 @section dump_extradata
24 @section h264_mp4toannexb
26 Convert an H.264 bitstream from length prefixed mode to start code
27 prefixed mode (as defined in the Annex B of the ITU-T H.264
30 This is required by some streaming formats, typically the MPEG-2
31 transport stream format ("mpegts").
33 For example to remux an MP4 file containing an H.264 stream to mpegts
34 format with @command{ffmpeg}, you can use the command:
37 ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
40 @section imx_dump_header
44 Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
46 MJPEG is a video codec wherein each video frame is essentially a
47 JPEG image. The individual frames can be extracted without loss,
51 ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
54 Unfortunately, these chunks are incomplete JPEG images, because
55 they lack the DHT segment required for decoding. Quoting from
56 @url{http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml}:
58 Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
59 commented that "MJPEG, or at least the MJPEG in AVIs having the
60 MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
61 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
62 and it must use basic Huffman encoding, not arithmetic or
63 progressive. . . . You can indeed extract the MJPEG frames and
64 decode them with a regular JPEG decoder, but you have to prepend
65 the DHT segment to them, or else the decoder won't have any idea
66 how to decompress the data. The exact table necessary is given in
69 This bitstream filter patches the header of frames extracted from an MJPEG
70 stream (carrying the AVI1 header ID and lacking a DHT segment) to
71 produce fully qualified JPEG images.
74 ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
75 exiftran -i -9 frame*.jpg
76 ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
79 @section mjpega_dump_header
83 @section mp3_header_compress
85 @section mp3_header_decompress
89 @section remove_extradata
91 @c man end BITSTREAM FILTERS