1 @chapter Bitstream Filters
2 @c man begin BITSTREAM FILTERS
4 When you configure your Libav 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 av* 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 extract_extradata
26 Extract the in-band extradata.
28 Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers,
29 or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part
30 of the bitstream containing the coded frames) or "out of band" (e.g. on the
31 container level). This latter form is called "extradata" in Libav terminology.
33 This bitstream filter detects the in-band headers and makes them available as
38 When this option is enabled, the long-term headers are removed from the
39 bitstream after extraction.
42 @section h264_metadata
44 Modify metadata embedded in an H.264 stream.
48 Insert or remove AUD NAL units in all access units of the stream.
55 @item sample_aspect_ratio
56 Set the sample aspect ratio of the stream in the VUI parameters.
59 @item video_full_range_flag
60 Set the video format in the stream (see H.264 section E.2.1 and
63 @item colour_primaries
64 @item transfer_characteristics
65 @item matrix_coefficients
66 Set the colour description in the stream (see H.264 section E.2.1
67 and tables E-3, E-4 and E-5).
69 @item chroma_sample_loc_type
70 Set the chroma sample location in the stream (see H.264 section
71 E.2.1 and figure E-1).
74 Set the tick rate (num_units_in_tick / time_scale) in the VUI
75 parameters. This is the smallest time unit representable in the
76 stream, and in many cases represents the field rate of the stream
77 (double the frame rate).
78 @item fixed_frame_rate_flag
79 Set whether the stream has fixed framerate - typically this indicates
80 that the framerate is exactly half the tick rate, but the exact
81 meaning is dependent on interlacing and the picture structure (see
82 H.264 section E.2.1 and table E-6).
88 Set the frame cropping offsets in the SPS. These values will replace
89 the current ones if the stream is already cropped.
91 These fields are set in pixels. Note that some sizes may not be
92 representable if the chroma is subsampled or the stream is interlaced
93 (see H.264 section 7.4.2.1.1).
96 Insert a string as SEI unregistered user data. The argument must
97 be of the form @emph{UUID+string}, where the UUID is as hex digits
98 possibly separated by hyphens, and the string can be anything.
100 For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
101 insert the string ``hello'' associated with the given UUID.
105 @section h264_mp4toannexb
107 @section h264_redundant_pps
109 This applies a specific fixup to some Bluray streams which contain
110 redundant PPSs modifying irrelevant parameters of the stream which
111 confuse other transformations which require correct extradata.
113 A new single global PPS is created, and all of the redundant PPSs
114 within the stream are removed.
116 @section hevc_metadata
118 Modify metadata embedded in an HEVC stream.
122 Insert or remove AUD NAL units in all access units of the stream.
129 @item sample_aspect_ratio
130 Set the sample aspect ratio in the stream in the VUI parameters.
133 @item video_full_range_flag
134 Set the video format in the stream (see H.265 section E.3.1 and
137 @item colour_primaries
138 @item transfer_characteristics
139 @item matrix_coefficients
140 Set the colour description in the stream (see H.265 section E.3.1
141 and tables E.3, E.4 and E.5).
143 @item chroma_sample_loc_type
144 Set the chroma sample location in the stream (see H.265 section
145 E.3.1 and figure E.1).
148 Set the tick rate in the VPS and VUI parameters (num_units_in_tick /
149 time_scale). Combined with @option{num_ticks_poc_diff_one}, this can
150 set a constant framerate in the stream. Note that it is likely to be
151 overridden by container parameters when the stream is in a container.
153 @item num_ticks_poc_diff_one
154 Set poc_proportional_to_timing_flag in VPS and VUI and use this value
155 to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and
156 E.3.1). Ignored if @option{tick_rate} is not also set.
162 Set the conformance window cropping offsets in the SPS. These values
163 will replace the current ones if the stream is already cropped.
165 These fields are set in pixels. Note that some sizes may not be
166 representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
170 @section imx_dump_header
174 Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
176 MJPEG is a video codec wherein each video frame is essentially a
177 JPEG image. The individual frames can be extracted without loss,
181 avconv -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
184 Unfortunately, these chunks are incomplete JPEG images, because
185 they lack the DHT segment required for decoding. Quoting from
186 @url{http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml}:
188 Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
189 commented that "MJPEG, or at least the MJPEG in AVIs having the
190 MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
191 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
192 and it must use basic Huffman encoding, not arithmetic or
193 progressive. . . . You can indeed extract the MJPEG frames and
194 decode them with a regular JPEG decoder, but you have to prepend
195 the DHT segment to them, or else the decoder won't have any idea
196 how to decompress the data. The exact table necessary is given in
199 This bitstream filter patches the header of frames extracted from an MJPEG
200 stream (carrying the AVI1 header ID and lacking a DHT segment) to
201 produce fully qualified JPEG images.
204 avconv -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
205 exiftran -i -9 frame*.jpg
206 avconv -i frame_%d.jpg -c:v copy rotated.avi
209 @section mjpega_dump_header
213 @section mpeg2_metadata
215 Modify metadata embedded in an MPEG-2 stream.
218 @item display_aspect_ratio
219 Set the display aspect ratio in the stream.
221 The following fixed values are supported:
227 Any other value will result in square pixels being signalled instead
228 (see H.262 section 6.3.3 and table 6-3).
231 Set the frame rate in the stream. This is constructed from a table
232 of known values combined with a small multiplier and divisor - if
233 the supplied value is not exactly representable, the nearest
234 representable value will be used instead (see H.262 section 6.3.3
238 Set the video format in the stream (see H.262 section 6.3.6 and
241 @item colour_primaries
242 @item transfer_characteristics
243 @item matrix_coefficients
244 Set the colour description in the stream (see H.262 section 6.3.6
245 and tables 6-7, 6-8 and 6-9).
249 @section mp3_header_compress
251 @section mp3_header_decompress
256 This bitstream filter passes the packets through unchanged.
258 @section remove_extradata
260 @section trace_headers
262 Log trace output containing all syntax elements in the coded stream
263 headers (everything above the level of individual coded blocks).
264 This can be useful for debugging low-level stream issues.
266 Supports H.264, H.265 and MPEG-2.
268 @section vp9_superframe
270 Combine VP9 frames into superframes.
272 @section vp9_superframe_split
274 Split VP9 superframes into single frames.
276 @section vp9_raw_reorder
278 Given a VP9 stream with correct timestamps but possibly out of order,
279 insert additional show-existing-frame packets to correct the ordering.
281 @c man end BITSTREAM FILTERS