avformat/mpeg: demux ivtv captions
[ffmpeg.git] / doc / bitstream_filters.texi
blob1e625ac91362cb65da730eec37037c9becf10d9f
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 The ff* tools have a -bsf option applied per stream, taking a
17 comma-separated list of filters, whose parameters follow the filter
18 name after a '='.
20 @example
21 ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
22 @end example
24 Below is a description of the currently available bitstream filters,
25 with their parameters, if any.
27 @section aac_adtstoasc
29 Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration
30 bitstream.
32 This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
33 ADTS header and removes the ADTS header.
35 This filter is required for example when copying an AAC stream from a
36 raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or
37 to MOV/MP4 files and related formats such as 3GP or M4A. Please note
38 that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
40 @section av1_metadata
42 Modify metadata embedded in an AV1 stream.
44 @table @option
45 @item td
46 Insert or remove temporal delimiter OBUs in all temporal units of the
47 stream.
49 @table @samp
50 @item insert
51 Insert a TD at the beginning of every TU which does not already have one.
52 @item remove
53 Remove the TD from the beginning of every TU which has one.
54 @end table
56 @item color_primaries
57 @item transfer_characteristics
58 @item matrix_coefficients
59 Set the color description fields in the stream (see AV1 section 6.4.2).
61 @item color_range
62 Set the color range in the stream (see AV1 section 6.4.2; note that
63 this cannot be set for streams using BT.709 primaries, sRGB transfer
64 characteristic and identity (RGB) matrix coefficients).
65 @table @samp
66 @item tv
67 Limited range.
68 @item pc
69 Full range.
70 @end table
72 @item chroma_sample_position
73 Set the chroma sample location in the stream (see AV1 section 6.4.2).
74 This can only be set for 4:2:0 streams.
76 @table @samp
77 @item vertical
78 Left position (matching the default in MPEG-2 and H.264).
79 @item colocated
80 Top-left position.
81 @end table
83 @item tick_rate
84 Set the tick rate (@emph{time_scale / num_units_in_display_tick}) in
85 the timing info in the sequence header.
86 @item num_ticks_per_picture
87 Set the number of ticks in each picture, to indicate that the stream
88 has a fixed framerate.  Ignored if @option{tick_rate} is not also set.
90 @item delete_padding
91 Deletes Padding OBUs.
93 @end table
95 @section chomp
97 Remove zero padding at the end of a packet.
99 @section dca_core
101 Extract the core from a DCA/DTS stream, dropping extensions such as
102 DTS-HD.
104 @section dovi_rpu
106 Manipulate Dolby Vision metadata in a HEVC/AV1 bitstream, optionally enabling
107 metadata compression.
109 @table @option
110 @item strip
111 If enabled, strip all Dolby Vision metadata (configuration record + RPU data
112 blocks) from the stream.
113 @item compression
114 Which compression level to enable.
115 @table @samp
116 @item none
117 No metadata compression.
118 @item limited
119 Limited metadata compression scheme. Should be compatible with most devices.
120 This is the default.
121 @item extended
122 Extended metadata compression. Devices are not required to support this. Note
123 that this level currently behaves the same as @samp{limited} in libavcodec.
124 @end table
125 @end table
127 @section dump_extra
129 Add extradata to the beginning of the filtered packets except when
130 said packets already exactly begin with the extradata that is intended
131 to be added.
133 @table @option
134 @item freq
135 The additional argument specifies which packets should be filtered.
136 It accepts the values:
137 @table @samp
138 @item k
139 @item keyframe
140 add extradata to all key packets
142 @item e
143 @item all
144 add extradata to all packets
145 @end table
146 @end table
148 If not specified it is assumed @samp{k}.
150 For example the following @command{ffmpeg} command forces a global
151 header (thus disabling individual packet headers) in the H.264 packets
152 generated by the @code{libx264} encoder, but corrects them by adding
153 the header stored in extradata to the key packets:
154 @example
155 ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
156 @end example
158 @section dv_error_marker
160 Blocks in DV which are marked as damaged are replaced by blocks of the specified color.
162 @table @option
163 @item color
164 The color to replace damaged blocks by
165 @item sta
166 A 16 bit mask which specifies which of the 16 possible error status values are
167 to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0
168 error status values.
169 @table @samp
170 @item ok
171 No error, no concealment
172 @item err
173 Error, No concealment
174 @item res
175 Reserved
176 @item notok
177 Error or concealment
178 @item notres
179 Not reserved
180 @item Aa, Ba, Ca, Ab, Bb, Cb, A, B, C, a, b, erri, erru
181 The specific error status code
182 @end table
183 see page 44-46 or section 5.5 of
184 @url{http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf}
186 @end table
188 @section eac3_core
190 Extract the core from a E-AC-3 stream, dropping extra channels.
192 @section extract_extradata
194 Extract the in-band extradata.
196 Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers,
197 or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part
198 of the bitstream containing the coded frames) or "out of band" (e.g. on the
199 container level). This latter form is called "extradata" in FFmpeg terminology.
201 This bitstream filter detects the in-band headers and makes them available as
202 extradata.
204 @table @option
205 @item remove
206 When this option is enabled, the long-term headers are removed from the
207 bitstream after extraction.
208 @end table
210 @section filter_units
212 Remove units with types in or not in a given set from the stream.
214 @table @option
215 @item pass_types
216 List of unit types or ranges of unit types to pass through while removing
217 all others.  This is specified as a '|'-separated list of unit type values
218 or ranges of values with '-'.
220 @item remove_types
221 Identical to @option{pass_types}, except the units in the given set
222 removed and all others passed through.
223 @end table
225 The types used by pass_types and remove_types correspond to NAL unit types
226 (nal_unit_type) in H.264, HEVC and H.266 (see Table 7-1 in the H.264
227 and HEVC specifications or Table 5 in the H.266 specification), to
228 marker values for JPEG (without 0xFF prefix) and to start codes without
229 start code prefix (i.e. the byte following the 0x000001) for MPEG-2.
230 For VP8 and VP9, every unit has type zero.
232 Extradata is unchanged by this transformation, but note that if the stream
233 contains inline parameter sets then the output may be unusable if they are
234 removed.
236 For example, to remove all non-VCL NAL units from an H.264 stream:
237 @example
238 ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=pass_types=1-5' OUTPUT
239 @end example
241 To remove all AUDs, SEI and filler from an H.265 stream:
242 @example
243 ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
244 @end example
246 To remove all user data from a MPEG-2 stream, including Closed Captions:
247 @example
248 ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=178' OUTPUT
249 @end example
251 To remove all SEI from a H264 stream, including Closed Captions:
252 @example
253 ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=6' OUTPUT
254 @end example
256 To remove all prefix and suffix SEI from a HEVC stream, including Closed Captions and dynamic HDR:
257 @example
258 ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=39|40' OUTPUT
259 @end example
261 @section hapqa_extract
263 Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file.
265 @table @option
266 @item texture
267 Specifies the texture to keep.
269 @table @option
270 @item color
271 @item alpha
272 @end table
274 @end table
276 Convert HAPQA to HAPQ
277 @example
278 ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" hapq_file.mov
279 @end example
281 Convert HAPQA to HAPAlphaOnly
282 @example
283 ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlpha Only" hapalphaonly_file.mov
284 @end example
286 @section h264_metadata
288 Modify metadata embedded in an H.264 stream.
290 @table @option
291 @item aud
292 Insert or remove AUD NAL units in all access units of the stream.
294 @table @samp
295 @item pass
296 @item insert
297 @item remove
298 @end table
300 Default is pass.
302 @item sample_aspect_ratio
303 Set the sample aspect ratio of the stream in the VUI parameters.
304 See H.264 table E-1.
306 @item overscan_appropriate_flag
307 Set whether the stream is suitable for display using overscan
308 or not (see H.264 section E.2.1).
310 @item video_format
311 @item video_full_range_flag
312 Set the video format in the stream (see H.264 section E.2.1 and
313 table E-2).
315 @item colour_primaries
316 @item transfer_characteristics
317 @item matrix_coefficients
318 Set the colour description in the stream (see H.264 section E.2.1
319 and tables E-3, E-4 and E-5).
321 @item chroma_sample_loc_type
322 Set the chroma sample location in the stream (see H.264 section
323 E.2.1 and figure E-1).
325 @item tick_rate
326 Set the tick rate (time_scale / num_units_in_tick) in the VUI
327 parameters.  This is the smallest time unit representable in the
328 stream, and in many cases represents the field rate of the stream
329 (double the frame rate).
330 @item fixed_frame_rate_flag
331 Set whether the stream has fixed framerate - typically this indicates
332 that the framerate is exactly half the tick rate, but the exact
333 meaning is dependent on interlacing and the picture structure (see
334 H.264 section E.2.1 and table E-6).
335 @item zero_new_constraint_set_flags
336 Zero constraint_set4_flag and constraint_set5_flag in the SPS. These
337 bits were reserved in a previous version of the H.264 spec, and thus
338 some hardware decoders require these to be zero. The result of zeroing
339 this is still a valid bitstream.
341 @item crop_left
342 @item crop_right
343 @item crop_top
344 @item crop_bottom
345 Set the frame cropping offsets in the SPS.  These values will replace
346 the current ones if the stream is already cropped.
348 These fields are set in pixels.  Note that some sizes may not be
349 representable if the chroma is subsampled or the stream is interlaced
350 (see H.264 section 7.4.2.1.1).
352 @item sei_user_data
353 Insert a string as SEI unregistered user data.  The argument must
354 be of the form @emph{UUID+string}, where the UUID is as hex digits
355 possibly separated by hyphens, and the string can be anything.
357 For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
358 insert the string ``hello'' associated with the given UUID.
360 @item delete_filler
361 Deletes both filler NAL units and filler SEI messages.
363 @item display_orientation
364 Insert, extract or remove Display orientation SEI messages.
365 See H.264 section D.1.27 and D.2.27 for syntax and semantics.
367 @table @samp
368 @item pass
369 @item insert
370 @item remove
371 @item extract
372 @end table
374 Default is pass.
376 Insert mode works in conjunction with @code{rotate} and @code{flip} options.
377 Any pre-existing Display orientation messages will be removed in insert or remove mode.
378 Extract mode attaches the display matrix to the packet as side data.
380 @item rotate
381 Set rotation in display orientation SEI (anticlockwise angle in degrees).
382 Range is -360 to +360. Default is NaN.
384 @item flip
385 Set flip in display orientation SEI.
387 @table @samp
388 @item horizontal
389 @item vertical
390 @end table
392 Default is unset.
394 @item level
395 Set the level in the SPS.  Refer to H.264 section A.3 and tables A-1
396 to A-5.
398 The argument must be the name of a level (for example, @samp{4.2}), a
399 level_idc value (for example, @samp{42}), or the special name @samp{auto}
400 indicating that the filter should attempt to guess the level from the
401 input stream properties.
403 @end table
405 @section h264_mp4toannexb
407 Convert an H.264 bitstream from length prefixed mode to start code
408 prefixed mode (as defined in the Annex B of the ITU-T H.264
409 specification).
411 This is required by some streaming formats, typically the MPEG-2
412 transport stream format (muxer @code{mpegts}).
414 For example to remux an MP4 file containing an H.264 stream to mpegts
415 format with @command{ffmpeg}, you can use the command:
417 @example
418 ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
419 @end example
421 Please note that this filter is auto-inserted for MPEG-TS (muxer
422 @code{mpegts}) and raw H.264 (muxer @code{h264}) output formats.
424 @section h264_redundant_pps
426 This applies a specific fixup to some Blu-ray BDMV H264 streams
427 which contain redundant PPSs. The PPSs modify irrelevant parameters
428 of the stream, confusing other transformations which require
429 the correct extradata.
431 The encoder used on these impacted streams adds extra PPSs throughout
432 the stream, varying the initial QP and whether weighted prediction
433 was enabled. This causes issues after copying the stream into
434 a global header container, as the starting PPS is not suitable
435 for the rest of the stream. One side effect, for example,
436 is seeking will return garbled output until a new PPS appears.
438 This BSF removes the extra PPSs and rewrites the slice headers
439 such that the stream uses a single leading PPS in the global header,
440 which resolves the issue.
442 @section hevc_metadata
444 Modify metadata embedded in an HEVC stream.
446 @table @option
447 @item aud
448 Insert or remove AUD NAL units in all access units of the stream.
450 @table @samp
451 @item insert
452 @item remove
453 @end table
455 @item sample_aspect_ratio
456 Set the sample aspect ratio in the stream in the VUI parameters.
458 @item video_format
459 @item video_full_range_flag
460 Set the video format in the stream (see H.265 section E.3.1 and
461 table E.2).
463 @item colour_primaries
464 @item transfer_characteristics
465 @item matrix_coefficients
466 Set the colour description in the stream (see H.265 section E.3.1
467 and tables E.3, E.4 and E.5).
469 @item chroma_sample_loc_type
470 Set the chroma sample location in the stream (see H.265 section
471 E.3.1 and figure E.1).
473 @item tick_rate
474 Set the tick rate in the VPS and VUI parameters (time_scale /
475 num_units_in_tick). Combined with @option{num_ticks_poc_diff_one}, this can
476 set a constant framerate in the stream.  Note that it is likely to be
477 overridden by container parameters when the stream is in a container.
479 @item num_ticks_poc_diff_one
480 Set poc_proportional_to_timing_flag in VPS and VUI and use this value
481 to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and
482 E.3.1).  Ignored if @option{tick_rate} is not also set.
484 @item crop_left
485 @item crop_right
486 @item crop_top
487 @item crop_bottom
488 Set the conformance window cropping offsets in the SPS.  These values
489 will replace the current ones if the stream is already cropped.
491 These fields are set in pixels.  Note that some sizes may not be
492 representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
494 @item width
495 @item height
496 Set width and height after crop.
498 @item level
499 Set the level in the VPS and SPS.  See H.265 section A.4 and tables
500 A.6 and A.7.
502 The argument must be the name of a level (for example, @samp{5.1}), a
503 @emph{general_level_idc} value (for example, @samp{153} for level 5.1),
504 or the special name @samp{auto} indicating that the filter should
505 attempt to guess the level from the input stream properties.
507 @end table
509 @section hevc_mp4toannexb
511 Convert an HEVC/H.265 bitstream from length prefixed mode to start code
512 prefixed mode (as defined in the Annex B of the ITU-T H.265
513 specification).
515 This is required by some streaming formats, typically the MPEG-2
516 transport stream format (muxer @code{mpegts}).
518 For example to remux an MP4 file containing an HEVC stream to mpegts
519 format with @command{ffmpeg}, you can use the command:
521 @example
522 ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
523 @end example
525 Please note that this filter is auto-inserted for MPEG-TS (muxer
526 @code{mpegts}) and raw HEVC/H.265 (muxer @code{h265} or
527 @code{hevc}) output formats.
529 @section imxdump
531 Modifies the bitstream to fit in MOV and to be usable by the Final Cut
532 Pro decoder. This filter only applies to the mpeg2video codec, and is
533 likely not needed for Final Cut Pro 7 and newer with the appropriate
534 @option{-tag:v}.
536 For example, to remux 30 MB/sec NTSC IMX to MOV:
538 @example
539 ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
540 @end example
542 @section mjpeg2jpeg
544 Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
546 MJPEG is a video codec wherein each video frame is essentially a
547 JPEG image. The individual frames can be extracted without loss,
548 e.g. by
550 @example
551 ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
552 @end example
554 Unfortunately, these chunks are incomplete JPEG images, because
555 they lack the DHT segment required for decoding. Quoting from
556 @url{http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml}:
558 Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
559 commented that "MJPEG, or at least the MJPEG in AVIs having the
560 MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
561 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
562 and it must use basic Huffman encoding, not arithmetic or
563 progressive. . . . You can indeed extract the MJPEG frames and
564 decode them with a regular JPEG decoder, but you have to prepend
565 the DHT segment to them, or else the decoder won't have any idea
566 how to decompress the data. The exact table necessary is given in
567 the OpenDML spec."
569 This bitstream filter patches the header of frames extracted from an MJPEG
570 stream (carrying the AVI1 header ID and lacking a DHT segment) to
571 produce fully qualified JPEG images.
573 @example
574 ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
575 exiftran -i -9 frame*.jpg
576 ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
577 @end example
579 @section mjpegadump
581 Add an MJPEG A header to the bitstream, to enable decoding by
582 Quicktime.
584 @anchor{mov2textsub}
585 @section mov2textsub
587 Extract a representable text file from MOV subtitles, stripping the
588 metadata header from each subtitle packet.
590 See also the @ref{text2movsub} filter.
592 @section mpeg2_metadata
594 Modify metadata embedded in an MPEG-2 stream.
596 @table @option
597 @item display_aspect_ratio
598 Set the display aspect ratio in the stream.
600 The following fixed values are supported:
601 @table @option
602 @item 4/3
603 @item 16/9
604 @item 221/100
605 @end table
606 Any other value will result in square pixels being signalled instead
607 (see H.262 section 6.3.3 and table 6-3).
609 @item frame_rate
610 Set the frame rate in the stream.  This is constructed from a table
611 of known values combined with a small multiplier and divisor - if
612 the supplied value is not exactly representable, the nearest
613 representable value will be used instead (see H.262 section 6.3.3
614 and table 6-4).
616 @item video_format
617 Set the video format in the stream (see H.262 section 6.3.6 and
618 table 6-6).
620 @item colour_primaries
621 @item transfer_characteristics
622 @item matrix_coefficients
623 Set the colour description in the stream (see H.262 section 6.3.6
624 and tables 6-7, 6-8 and 6-9).
626 @end table
628 @section mpeg4_unpack_bframes
630 Unpack DivX-style packed B-frames.
632 DivX-style packed B-frames are not valid MPEG-4 and were only a
633 workaround for the broken Video for Windows subsystem.
634 They use more space, can cause minor AV sync issues, require more
635 CPU power to decode (unless the player has some decoded picture queue
636 to compensate the 2,0,2,0 frame per packet style) and cause
637 trouble if copied into a standard container like mp4 or mpeg-ps/ts,
638 because MPEG-4 decoders may not be able to decode them, since they are
639 not valid MPEG-4.
641 For example to fix an AVI file containing an MPEG-4 stream with
642 DivX-style packed B-frames using @command{ffmpeg}, you can use the command:
644 @example
645 ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
646 @end example
648 @section noise
650 Damages the contents of packets or simply drops them without damaging the
651 container. Can be used for fuzzing or testing error resilience/concealment.
653 Parameters:
654 @table @option
655 @item amount
656 Accepts an expression whose evaluation per-packet determines how often bytes in that
657 packet will be modified. A value below 0 will result in a variable frequency.
658 Default is 0 which results in no modification. However, if neither amount nor drop is specified,
659 amount will be set to @var{-1}. See below for accepted variables.
660 @item drop
661 Accepts an expression evaluated per-packet whose value determines whether that packet is dropped.
662 Evaluation to a positive value results in the packet being dropped. Evaluation to a negative
663 value results in a variable chance of it being dropped, roughly inverse in proportion to the magnitude
664 of the value. Default is 0 which results in no drops. See below for accepted variables.
665 @item dropamount
666 Accepts a non-negative integer, which assigns a variable chance of it being dropped, roughly inverse
667 in proportion to the value. Default is 0 which results in no drops. This option is kept for backwards
668 compatibility and is equivalent to setting drop to a negative value with the same magnitude
669 i.e. @code{dropamount=4} is the same as @code{drop=-4}. Ignored if drop is also specified.
670 @end table
672 Both @code{amount} and @code{drop} accept expressions containing the following variables:
674 @table @samp
675 @item n
676 The index of the packet, starting from zero.
677 @item tb
678 The timebase for packet timestamps.
679 @item pts
680 Packet presentation timestamp.
681 @item dts
682 Packet decoding timestamp.
683 @item nopts
684 Constant representing AV_NOPTS_VALUE.
685 @item startpts
686 First non-AV_NOPTS_VALUE PTS seen in the stream.
687 @item startdts
688 First non-AV_NOPTS_VALUE DTS seen in the stream.
689 @item duration
690 @itemx d
691 Packet duration, in timebase units.
692 @item pos
693 Packet position in input; may be -1 when unknown or not set.
694 @item size
695 Packet size, in bytes.
696 @item key
697 Whether packet is marked as a keyframe.
698 @item state
699 A pseudo random integer, primarily derived from the content of packet payload.
700 @end table
702 @subsection Examples
703 Apply modification to every byte but don't drop any packets.
704 @example
705 ffmpeg -i INPUT -c copy -bsf noise=1 output.mkv
706 @end example
708 Drop every video packet not marked as a keyframe after timestamp 30s but do not
709 modify any of the remaining packets.
710 @example
711 ffmpeg -i INPUT -c copy -bsf:v noise=drop='gt(t\,30)*not(key)' output.mkv
712 @end example
714 Drop one second of audio every 10 seconds and add some random noise to the rest.
715 @example
716 ffmpeg -i INPUT -c copy -bsf:a noise=amount=-1:drop='between(mod(t\,10)\,9\,10)' output.mkv
717 @end example
719 @section null
720 This bitstream filter passes the packets through unchanged.
722 @section pcm_rechunk
724 Repacketize PCM audio to a fixed number of samples per packet or a fixed packet
725 rate per second. This is similar to the @ref{asetnsamples,,asetnsamples audio
726 filter,ffmpeg-filters} but works on audio packets instead of audio frames.
728 @table @option
729 @item nb_out_samples, n
730 Set the number of samples per each output audio packet. The number is intended
731 as the number of samples @emph{per each channel}. Default value is 1024.
733 @item pad, p
734 If set to 1, the filter will pad the last audio packet with silence, so that it
735 will contain the same number of samples (or roughly the same number of samples,
736 see @option{frame_rate}) as the previous ones. Default value is 1.
738 @item frame_rate, r
739 This option makes the filter output a fixed number of packets per second instead
740 of a fixed number of samples per packet. If the audio sample rate is not
741 divisible by the frame rate then the number of samples will not be constant but
742 will vary slightly so that each packet will start as close to the frame
743 boundary as possible. Using this option has precedence over @option{nb_out_samples}.
744 @end table
746 You can generate the well known 1602-1601-1602-1601-1602 pattern of 48kHz audio
747 for NTSC frame rate using the @option{frame_rate} option.
748 @example
749 ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
750 @end example
752 @section pgs_frame_merge
754 Merge a sequence of PGS Subtitle segments ending with an "end of display set"
755 segment into a single packet.
757 This is required by some containers that support PGS subtitles
758 (muxer @code{matroska}).
760 @section prores_metadata
762 Modify color property metadata embedded in prores stream.
764 @table @option
765 @item color_primaries
766 Set the color primaries.
767 Available values are:
769 @table @samp
770 @item auto
771 Keep the same color primaries property (default).
773 @item unknown
774 @item bt709
775 @item bt470bg
776 BT601 625
778 @item smpte170m
779 BT601 525
781 @item bt2020
782 @item smpte431
783 DCI P3
785 @item smpte432
786 P3 D65
788 @end table
790 @item transfer_characteristics
791 Set the color transfer.
792 Available values are:
794 @table @samp
795 @item auto
796 Keep the same transfer characteristics property (default).
798 @item unknown
799 @item bt709
800 BT 601, BT 709, BT 2020
801 @item smpte2084
802 SMPTE ST 2084
803 @item arib-std-b67
804 ARIB STD-B67
805 @end table
808 @item matrix_coefficients
809 Set the matrix coefficient.
810 Available values are:
812 @table @samp
813 @item auto
814 Keep the same colorspace property (default).
816 @item unknown
817 @item bt709
818 @item smpte170m
819 BT 601
821 @item bt2020nc
822 @end table
823 @end table
825 Set Rec709 colorspace for each frame of the file
826 @example
827 ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov
828 @end example
830 Set Hybrid Log-Gamma parameters for each frame of the file
831 @example
832 ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt2020:color_trc=arib-std-b67:colorspace=bt2020nc output.mov
833 @end example
835 @section remove_extra
837 Remove extradata from packets.
839 It accepts the following parameter:
840 @table @option
841 @item freq
842 Set which frame types to remove extradata from.
844 @table @samp
845 @item k
846 Remove extradata from non-keyframes only.
848 @item keyframe
849 Remove extradata from keyframes only.
851 @item e, all
852 Remove extradata from all frames.
854 @end table
855 @end table
857 @section setts
858 Set PTS and DTS in packets.
860 It accepts the following parameters:
861 @table @option
862 @item ts
863 @item pts
864 @item dts
865 Set expressions for PTS, DTS or both.
866 @item duration
867 Set expression for duration.
868 @item time_base
869 Set output time base.
870 @end table
872 The expressions are evaluated through the eval API and can contain the following
873 constants:
875 @table @option
876 @item N
877 The count of the input packet. Starting from 0.
879 @item TS
880 The demux timestamp in input in case of @code{ts} or @code{dts} option or presentation
881 timestamp in case of @code{pts} option.
883 @item POS
884 The original position in the file of the packet, or undefined if undefined
885 for the current packet
887 @item DTS
888 The demux timestamp in input.
890 @item PTS
891 The presentation timestamp in input.
893 @item DURATION
894 The duration in input.
896 @item STARTDTS
897 The DTS of the first packet.
899 @item STARTPTS
900 The PTS of the first packet.
902 @item PREV_INDTS
903 The previous input DTS.
905 @item PREV_INPTS
906 The previous input PTS.
908 @item PREV_INDURATION
909 The previous input duration.
911 @item PREV_OUTDTS
912 The previous output DTS.
914 @item PREV_OUTPTS
915 The previous output PTS.
917 @item PREV_OUTDURATION
918 The previous output duration.
920 @item NEXT_DTS
921 The next input DTS.
923 @item NEXT_PTS
924 The next input PTS.
926 @item NEXT_DURATION
927 The next input duration.
929 @item TB
930 The timebase of stream packet belongs.
932 @item TB_OUT
933 The output timebase.
935 @item SR
936 The sample rate of stream packet belongs.
938 @item NOPTS
939 The AV_NOPTS_VALUE constant.
940 @end table
942 For example, to set PTS equal to DTS (not recommended if B-frames are involved):
943 @example
944 ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv
945 @end example
947 @section showinfo
948 Log basic packet information. Mainly useful for testing, debugging,
949 and development.
951 @anchor{text2movsub}
952 @section text2movsub
954 Convert text subtitles to MOV subtitles (as used by the @code{mov_text}
955 codec) with metadata headers.
957 See also the @ref{mov2textsub} filter.
959 @section trace_headers
961 Log trace output containing all syntax elements in the coded stream
962 headers (everything above the level of individual coded blocks).
963 This can be useful for debugging low-level stream issues.
965 Supports AV1, H.264, H.265, (M)JPEG, MPEG-2 and VP9, but depending
966 on the build only a subset of these may be available.
968 @section truehd_core
970 Extract the core from a TrueHD stream, dropping ATMOS data.
972 @section vp9_metadata
974 Modify metadata embedded in a VP9 stream.
976 @table @option
977 @item color_space
978 Set the color space value in the frame header.  Note that any frame
979 set to RGB will be implicitly set to PC range and that RGB is
980 incompatible with profiles 0 and 2.
981 @table @samp
982 @item unknown
983 @item bt601
984 @item bt709
985 @item smpte170
986 @item smpte240
987 @item bt2020
988 @item rgb
989 @end table
991 @item color_range
992 Set the color range value in the frame header.  Note that any value
993 imposed by the color space will take precedence over this value.
994 @table @samp
995 @item tv
996 @item pc
997 @end table
998 @end table
1000 @section vp9_superframe
1002 Merge VP9 invisible (alt-ref) frames back into VP9 superframes. This
1003 fixes merging of split/segmented VP9 streams where the alt-ref frame
1004 was split from its visible counterpart.
1006 @section vp9_superframe_split
1008 Split VP9 superframes into single frames.
1010 @section vp9_raw_reorder
1012 Given a VP9 stream with correct timestamps but possibly out of order,
1013 insert additional show-existing-frame packets to correct the ordering.
1015 @c man end BITSTREAM FILTERS