<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>FFmpeg documentation</title> <link rel="stylesheet" href="bootstrap.min.css" /> <link rel="stylesheet" href="style.min.css" /> <meta name="description" content="FFmpeg Bitstream Filters Documentation: "> <meta name="keywords" content="FFmpeg documentation : FFmpeg Bitstream Filters "> <meta name="Generator" content="texi2html 5.0"> <!-- Created on January 13, 2016 by texi2html 5.0 --> <!-- texi2html was written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Many creative people. Send bugs and suggestions to <texi2html-bug@nongnu.org> --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <div style="width: 95%; margin: auto"> <h1 class="titlefont">FFmpeg Bitstream Filters Documentation</h1> <hr> <a name="SEC_Top"></a> <a name="SEC_Contents"></a> <h1>Table of Contents</h1> <div class="contents"> <ul class="no-bullet"> <li><a name="toc-Description" href="#Description">1 Description</a></li> <li><a name="toc-Bitstream-Filters" href="#Bitstream-Filters">2 Bitstream Filters</a> <ul class="no-bullet"> <li><a name="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">2.1 aac_adtstoasc</a></li> <li><a name="toc-chomp" href="#chomp">2.2 chomp</a></li> <li><a name="toc-dump_005fextra" href="#dump_005fextra">2.3 dump_extra</a></li> <li><a name="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">2.4 h264_mp4toannexb</a></li> <li><a name="toc-imxdump" href="#imxdump">2.5 imxdump</a></li> <li><a name="toc-mjpeg2jpeg" href="#mjpeg2jpeg">2.6 mjpeg2jpeg</a></li> <li><a name="toc-mjpega_005fdump_005fheader" href="#mjpega_005fdump_005fheader">2.7 mjpega_dump_header</a></li> <li><a name="toc-movsub" href="#movsub">2.8 movsub</a></li> <li><a name="toc-mp3_005fheader_005fdecompress" href="#mp3_005fheader_005fdecompress">2.9 mp3_header_decompress</a></li> <li><a name="toc-noise" href="#noise">2.10 noise</a></li> <li><a name="toc-remove_005fextra" href="#remove_005fextra">2.11 remove_extra</a></li> </ul></li> <li><a name="toc-See-Also" href="#See-Also">3 See Also</a></li> <li><a name="toc-Authors" href="#Authors">4 Authors</a></li> </ul> </div> <hr size="6"> <a name="Description"></a> <h1 class="chapter"><a href="ffmpeg-bitstream-filters.html#toc-Description">1 Description</a></h1> <p>This document describes the bitstream filters provided by the libavcodec library. </p> <p>A bitstream filter operates on the encoded stream data, and performs bitstream level modifications without performing decoding. </p> <a name="Bitstream-Filters"></a> <h1 class="chapter"><a href="ffmpeg-bitstream-filters.html#toc-Bitstream-Filters">2 Bitstream Filters</a></h1> <p>When you configure your FFmpeg build, all the supported bitstream filters are enabled by default. You can list all available ones using the configure option <code>--list-bsfs</code>. </p> <p>You can disable all the bitstream filters using the configure option <code>--disable-bsfs</code>, and selectively enable any bitstream filter using the option <code>--enable-bsf=BSF</code>, or you can disable a particular bitstream filter using the option <code>--disable-bsf=BSF</code>. </p> <p>The option <code>-bsfs</code> of the ff* tools will display the list of all the supported bitstream filters included in your build. </p> <p>Below is a description of the currently available bitstream filters. </p> <a name="aac_005fadtstoasc"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-aac_005fadtstoasc">2.1 aac_adtstoasc</a></h2> <p>Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter. </p> <p>This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 ADTS header and removes the ADTS header. </p> <p>This is required for example when copying an AAC stream from a raw ADTS AAC container to a FLV or a MOV/MP4 file. </p> <a name="chomp"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-chomp">2.2 chomp</a></h2> <p>Remove zero padding at the end of a packet. </p> <a name="dump_005fextra"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-dump_005fextra">2.3 dump_extra</a></h2> <p>Add extradata to the beginning of the filtered packets. </p> <p>The additional argument specifies which packets should be filtered. It accepts the values: </p><dl compact="compact"> <dt>‘<samp>a</samp>’</dt> <dd><p>add extradata to all key packets, but only if <var>local_header</var> is set in the ‘<samp>flags2</samp>’ codec context field </p> </dd> <dt>‘<samp>k</samp>’</dt> <dd><p>add extradata to all key packets </p> </dd> <dt>‘<samp>e</samp>’</dt> <dd><p>add extradata to all packets </p></dd> </dl> <p>If not specified it is assumed ‘<samp>k</samp>’. </p> <p>For example the following <code>ffmpeg</code> command forces a global header (thus disabling individual packet headers) in the H.264 packets generated by the <code>libx264</code> encoder, but corrects them by adding the header stored in extradata to the key packets: </p><div class="example"> <pre class="example">ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts </pre></div> <a name="h264_005fmp4toannexb"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-h264_005fmp4toannexb">2.4 h264_mp4toannexb</a></h2> <p>Convert an H.264 bitstream from length prefixed mode to start code prefixed mode (as defined in the Annex B of the ITU-T H.264 specification). </p> <p>This is required by some streaming formats, typically the MPEG-2 transport stream format ("mpegts"). </p> <p>For example to remux an MP4 file containing an H.264 stream to mpegts format with <code>ffmpeg</code>, you can use the command: </p> <div class="example"> <pre class="example">ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts </pre></div> <a name="imxdump"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-imxdump">2.5 imxdump</a></h2> <p>Modifies the bitstream to fit in MOV and to be usable by the Final Cut Pro decoder. This filter only applies to the mpeg2video codec, and is likely not needed for Final Cut Pro 7 and newer with the appropriate ‘<samp>-tag:v</samp>’. </p> <p>For example, to remux 30 MB/sec NTSC IMX to MOV: </p> <div class="example"> <pre class="example">ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov </pre></div> <a name="mjpeg2jpeg"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-mjpeg2jpeg">2.6 mjpeg2jpeg</a></h2> <p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets. </p> <p>MJPEG is a video codec wherein each video frame is essentially a JPEG image. The individual frames can be extracted without loss, e.g. by </p> <div class="example"> <pre class="example">ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg </pre></div> <p>Unfortunately, these chunks are incomplete JPEG images, because they lack the DHT segment required for decoding. Quoting from <a href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>: </p> <p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001, commented that "MJPEG, or at least the MJPEG in AVIs having the MJPG fourcc, is restricted JPEG with a fixed – and *omitted* – Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, and it must use basic Huffman encoding, not arithmetic or progressive. . . . You can indeed extract the MJPEG frames and decode them with a regular JPEG decoder, but you have to prepend the DHT segment to them, or else the decoder won’t have any idea how to decompress the data. The exact table necessary is given in the OpenDML spec." </p> <p>This bitstream filter patches the header of frames extracted from an MJPEG stream (carrying the AVI1 header ID and lacking a DHT segment) to produce fully qualified JPEG images. </p> <div class="example"> <pre class="example">ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg exiftran -i -9 frame*.jpg ffmpeg -i frame_%d.jpg -c:v copy rotated.avi </pre></div> <a name="mjpega_005fdump_005fheader"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-mjpega_005fdump_005fheader">2.7 mjpega_dump_header</a></h2> <a name="movsub"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-movsub">2.8 movsub</a></h2> <a name="mp3_005fheader_005fdecompress"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-mp3_005fheader_005fdecompress">2.9 mp3_header_decompress</a></h2> <a name="noise"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-noise">2.10 noise</a></h2> <p>Damages the contents of packets without damaging the container. Can be used for fuzzing or testing error resilience/concealment. </p> <div class="example"> <pre class="example">ffmpeg -i INPUT -c copy -bsf noise output.mkv </pre></div> <a name="remove_005fextra"></a> <h2 class="section"><a href="ffmpeg-bitstream-filters.html#toc-remove_005fextra">2.11 remove_extra</a></h2> <a name="See-Also"></a> <h1 class="chapter"><a href="ffmpeg-bitstream-filters.html#toc-See-Also">3 See Also</a></h1> <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>, <a href="ffserver.html">ffserver</a>, <a href="libavcodec.html">libavcodec</a> </p> <a name="Authors"></a> <h1 class="chapter"><a href="ffmpeg-bitstream-filters.html#toc-Authors">4 Authors</a></h1> <p>The FFmpeg developers. </p> <p>For details about the authorship, see the Git history of the project (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command <code>git log</code> in the FFmpeg source directory, or browsing the online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>. </p> <p>Maintainers for the specific components are listed in the file ‘<tt>MAINTAINERS</tt>’ in the source code tree. </p> </div> </body> </html>