]> git.sesse.net Git - ffmpeg/blob - doc/bitstream_filters.texi
cbs_h264: Add utility functions to insert/delete SEI messages
[ffmpeg] / doc / bitstream_filters.texi
1 @chapter Bitstream Filters
2 @c man begin BITSTREAM FILTERS
3
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}.
7
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}.
12
13 The option @code{-bsfs} of the av* tools will display the list of
14 all the supported bitstream filters included in your build.
15
16 Below is a description of the currently available bitstream filters.
17
18 @section aac_adtstoasc
19
20 @section chomp
21
22 @section dump_extradata
23
24 @section extract_extradata
25
26 Extract the in-band extradata.
27
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.
32
33 This bitstream filter detects the in-band headers and makes them available as
34 extradata.
35
36 @table @option
37 @item remove
38 When this option is enabled, the long-term headers are removed from the
39 bitstream after extraction.
40 @end table
41
42 @section h264_metadata
43
44 Modify metadata embedded in an H.264 stream.
45
46 @table @option
47 @item aud
48 Insert or remove AUD NAL units in all access units of the stream.
49
50 @table @samp
51 @item insert
52 @item remove
53 @end table
54
55 @item sample_aspect_ratio
56 Set the sample aspect ratio of the stream in the VUI parameters.
57
58 @item video_format
59 @item video_full_range_flag
60 Set the video format in the stream (see H.264 section E.2.1 and
61 table E-2).
62
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).
68
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).
72
73 @item tick_rate
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).
83
84 @item crop_left
85 @item crop_right
86 @item crop_top
87 @item crop_bottom
88 Set the frame cropping offsets in the SPS.  These values will replace
89 the current ones if the stream is already cropped.
90
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).
94
95 @item sei_user_data
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.
99
100 For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
101 insert the string ``hello'' associated with the given UUID.
102
103 @end table
104
105 @section h264_mp4toannexb
106
107 @section h264_redundant_pps
108
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.
112
113 A new single global PPS is created, and all of the redundant PPSs
114 within the stream are removed.
115
116 @section hevc_metadata
117
118 Modify metadata embedded in an HEVC stream.
119
120 @table @option
121 @item aud
122 Insert or remove AUD NAL units in all access units of the stream.
123
124 @table @samp
125 @item insert
126 @item remove
127 @end table
128
129 @item sample_aspect_ratio
130 Set the sample aspect ratio in the stream in the VUI parameters.
131
132 @item video_format
133 @item video_full_range_flag
134 Set the video format in the stream (see H.265 section E.3.1 and
135 table E.2).
136
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).
142
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).
146
147 @item tick_rate
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.
152
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.
157
158 @item crop_left
159 @item crop_right
160 @item crop_top
161 @item crop_bottom
162 Set the conformance window cropping offsets in the SPS.  These values
163 will replace the current ones if the stream is already cropped.
164
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).
167
168 @end table
169
170 @section imx_dump_header
171
172 @section mjpeg2jpeg
173
174 Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
175
176 MJPEG is a video codec wherein each video frame is essentially a
177 JPEG image. The individual frames can be extracted without loss,
178 e.g. by
179
180 @example
181 avconv -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
182 @end example
183
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}:
187
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
197 the OpenDML spec."
198
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.
202
203 @example
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
207 @end example
208
209 @section mjpega_dump_header
210
211 @section movsub
212
213 @section mpeg2_metadata
214
215 Modify metadata embedded in an MPEG-2 stream.
216
217 @table @option
218 @item display_aspect_ratio
219 Set the display aspect ratio in the stream.
220
221 The following fixed values are supported:
222 @table @option
223 @item 4/3
224 @item 16/9
225 @item 221/100
226 @end table
227 Any other value will result in square pixels being signalled instead
228 (see H.262 section 6.3.3 and table 6-3).
229
230 @item frame_rate
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
235 and table 6-4).
236
237 @item video_format
238 Set the video format in the stream (see H.262 section 6.3.6 and
239 table 6-6).
240
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).
246
247 @end table
248
249 @section mp3_header_compress
250
251 @section mp3_header_decompress
252
253 @section noise
254
255 @section null
256 This bitstream filter passes the packets through unchanged.
257
258 @section remove_extradata
259
260 @section trace_headers
261
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.
265
266 Supports H.264, H.265 and MPEG-2.
267
268 @section vp9_superframe
269
270 Combine VP9 frames into superframes.
271
272 @section vp9_superframe_split
273
274 Split VP9 superframes into single frames.
275
276 @section vp9_raw_reorder
277
278 Given a VP9 stream with correct timestamps but possibly out of order,
279 insert additional show-existing-frame packets to correct the ordering.
280
281 @c man end BITSTREAM FILTERS