You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
7.3KB

  1. @chapter Bitstream Filters
  2. @c man begin BITSTREAM FILTERS
  3. When you configure your Libav build, all the supported bitstream
  4. filters are enabled by default. You can list all available ones using
  5. the configure option @code{--list-bsfs}.
  6. You can disable all the bitstream filters using the configure option
  7. @code{--disable-bsfs}, and selectively enable any bitstream filter using
  8. the option @code{--enable-bsf=BSF}, or you can disable a particular
  9. bitstream filter using the option @code{--disable-bsf=BSF}.
  10. The option @code{-bsfs} of the av* tools will display the list of
  11. all the supported bitstream filters included in your build.
  12. Below is a description of the currently available bitstream filters.
  13. @section aac_adtstoasc
  14. @section chomp
  15. @section dump_extradata
  16. @section extract_extradata
  17. Extract the in-band extradata.
  18. Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers,
  19. or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part
  20. of the bitstream containing the coded frames) or "out of band" (e.g. on the
  21. container level). This latter form is called "extradata" in Libav terminology.
  22. This bitstream filter detects the in-band headers and makes them available as
  23. extradata.
  24. @table @option
  25. @item remove
  26. When this option is enabled, the long-term headers are removed from the
  27. bitstream after extraction.
  28. @end table
  29. @section h264_metadata
  30. Modify metadata embedded in an H.264 stream.
  31. @table @option
  32. @item aud
  33. Insert or remove AUD NAL units in all access units of the stream.
  34. @table @samp
  35. @item insert
  36. @item remove
  37. @end table
  38. @item sample_aspect_ratio
  39. Set the sample aspect ratio of the stream in the VUI parameters.
  40. @item video_format
  41. @item video_full_range_flag
  42. Set the video format in the stream (see H.264 section E.2.1 and
  43. table E-2).
  44. @item colour_primaries
  45. @item transfer_characteristics
  46. @item matrix_coefficients
  47. Set the colour description in the stream (see H.264 section E.2.1
  48. and tables E-3, E-4 and E-5).
  49. @item chroma_sample_loc_type
  50. Set the chroma sample location in the stream (see H.264 section
  51. E.2.1 and figure E-1).
  52. @item tick_rate
  53. Set the tick rate (num_units_in_tick / time_scale) in the VUI
  54. parameters. This is the smallest time unit representable in the
  55. stream, and in many cases represents the field rate of the stream
  56. (double the frame rate).
  57. @item fixed_frame_rate_flag
  58. Set whether the stream has fixed framerate - typically this indicates
  59. that the framerate is exactly half the tick rate, but the exact
  60. meaning is dependent on interlacing and the picture structure (see
  61. H.264 section E.2.1 and table E-6).
  62. @item crop_left
  63. @item crop_right
  64. @item crop_top
  65. @item crop_bottom
  66. Set the frame cropping offsets in the SPS. These values will replace
  67. the current ones if the stream is already cropped.
  68. These fields are set in pixels. Note that some sizes may not be
  69. representable if the chroma is subsampled or the stream is interlaced
  70. (see H.264 section 7.4.2.1.1).
  71. @item sei_user_data
  72. Insert a string as SEI unregistered user data. The argument must
  73. be of the form @emph{UUID+string}, where the UUID is as hex digits
  74. possibly separated by hyphens, and the string can be anything.
  75. For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
  76. insert the string ``hello'' associated with the given UUID.
  77. @end table
  78. @section h264_mp4toannexb
  79. @section h264_redundant_pps
  80. This applies a specific fixup to some Bluray streams which contain
  81. redundant PPSs modifying irrelevant parameters of the stream which
  82. confuse other transformations which require correct extradata.
  83. A new single global PPS is created, and all of the redundant PPSs
  84. within the stream are removed.
  85. @section hevc_metadata
  86. Modify metadata embedded in an HEVC stream.
  87. @table @option
  88. @item aud
  89. Insert or remove AUD NAL units in all access units of the stream.
  90. @table @samp
  91. @item insert
  92. @item remove
  93. @end table
  94. @item sample_aspect_ratio
  95. Set the sample aspect ratio in the stream in the VUI parameters.
  96. @item video_format
  97. @item video_full_range_flag
  98. Set the video format in the stream (see H.265 section E.3.1 and
  99. table E.2).
  100. @item colour_primaries
  101. @item transfer_characteristics
  102. @item matrix_coefficients
  103. Set the colour description in the stream (see H.265 section E.3.1
  104. and tables E.3, E.4 and E.5).
  105. @item chroma_sample_loc_type
  106. Set the chroma sample location in the stream (see H.265 section
  107. E.3.1 and figure E.1).
  108. @item tick_rate
  109. Set the tick rate in the VPS and VUI parameters (num_units_in_tick /
  110. time_scale). Combined with @option{num_ticks_poc_diff_one}, this can
  111. set a constant framerate in the stream. Note that it is likely to be
  112. overridden by container parameters when the stream is in a container.
  113. @item num_ticks_poc_diff_one
  114. Set poc_proportional_to_timing_flag in VPS and VUI and use this value
  115. to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and
  116. E.3.1). Ignored if @option{tick_rate} is not also set.
  117. @item crop_left
  118. @item crop_right
  119. @item crop_top
  120. @item crop_bottom
  121. Set the conformance window cropping offsets in the SPS. These values
  122. will replace the current ones if the stream is already cropped.
  123. These fields are set in pixels. Note that some sizes may not be
  124. representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
  125. @end table
  126. @section imx_dump_header
  127. @section mjpeg2jpeg
  128. Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
  129. MJPEG is a video codec wherein each video frame is essentially a
  130. JPEG image. The individual frames can be extracted without loss,
  131. e.g. by
  132. @example
  133. avconv -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  134. @end example
  135. Unfortunately, these chunks are incomplete JPEG images, because
  136. they lack the DHT segment required for decoding. Quoting from
  137. @url{http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml}:
  138. Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
  139. commented that "MJPEG, or at least the MJPEG in AVIs having the
  140. MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
  141. Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
  142. and it must use basic Huffman encoding, not arithmetic or
  143. progressive. . . . You can indeed extract the MJPEG frames and
  144. decode them with a regular JPEG decoder, but you have to prepend
  145. the DHT segment to them, or else the decoder won't have any idea
  146. how to decompress the data. The exact table necessary is given in
  147. the OpenDML spec."
  148. This bitstream filter patches the header of frames extracted from an MJPEG
  149. stream (carrying the AVI1 header ID and lacking a DHT segment) to
  150. produce fully qualified JPEG images.
  151. @example
  152. avconv -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  153. exiftran -i -9 frame*.jpg
  154. avconv -i frame_%d.jpg -c:v copy rotated.avi
  155. @end example
  156. @section mjpega_dump_header
  157. @section movsub
  158. @section mp3_header_compress
  159. @section mp3_header_decompress
  160. @section noise
  161. @section null
  162. This bitstream filter passes the packets through unchanged.
  163. @section remove_extradata
  164. @section trace_headers
  165. Log trace output containing all syntax elements in the coded stream
  166. headers (everything above the level of individual coded blocks).
  167. This can be useful for debugging low-level stream issues.
  168. Supports H.264, H.265 and MPEG-2.
  169. @section vp9_superframe
  170. Combine VP9 frames into superframes.
  171. @section vp9_superframe_split
  172. Split VP9 superframes into single frames.
  173. @section vp9_raw_reorder
  174. Given a VP9 stream with correct timestamps but possibly out of order,
  175. insert additional show-existing-frame packets to correct the ordering.
  176. @c man end BITSTREAM FILTERS