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