Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. =encoding utf8
  2.  
  3. =head1 NAME
  4.  
  5. ffmpeg-bitstream-filters - FFmpeg bitstream filters
  6.  
  7. =head1 DESCRIPTION
  8.  
  9.  
  10. This document describes the bitstream filters provided by the
  11. libavcodec library.
  12.  
  13. A bitstream filter operates on the encoded stream data, and performs
  14. bitstream level modifications without performing decoding.
  15.  
  16.  
  17.  
  18. =head1 BITSTREAM FILTERS
  19.  
  20.  
  21. When you configure your FFmpeg build, all the supported bitstream
  22. filters are enabled by default. You can list all available ones using
  23. the configure option C<--list-bsfs>.
  24.  
  25. You can disable all the bitstream filters using the configure option
  26. C<--disable-bsfs>, and selectively enable any bitstream filter using
  27. the option C<--enable-bsf=BSF>, or you can disable a particular
  28. bitstream filter using the option C<--disable-bsf=BSF>.
  29.  
  30. The option C<-bsfs> of the ff* tools will display the list of
  31. all the supported bitstream filters included in your build.
  32.  
  33. The ff* tools have a -bsf option applied per stream, taking a
  34. comma-separated list of filters, whose parameters follow the filter
  35. name after a '='.
  36.  
  37.        
  38.         ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT
  39.  
  40.  
  41. Below is a description of the currently available bitstream filters,
  42. with their parameters, if any.
  43.  
  44.  
  45. =head2 aac_adtstoasc
  46.  
  47.  
  48. Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration
  49. bitstream filter.
  50.  
  51. This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
  52. ADTS header and removes the ADTS header.
  53.  
  54. This is required for example when copying an AAC stream from a raw
  55. ADTS AAC container to a FLV or a MOV/MP4 file.
  56.  
  57.  
  58. =head2 chomp
  59.  
  60.  
  61. Remove zero padding at the end of a packet.
  62.  
  63.  
  64. =head2 dump_extra
  65.  
  66.  
  67. Add extradata to the beginning of the filtered packets.
  68.  
  69. The additional argument specifies which packets should be filtered.
  70. It accepts the values:
  71.  
  72. =over 4
  73.  
  74.  
  75. =item B<a>
  76.  
  77. add extradata to all key packets, but only if I<local_header> is
  78. set in the B<flags2> codec context field
  79.  
  80.  
  81. =item B<k>
  82.  
  83. add extradata to all key packets
  84.  
  85.  
  86. =item B<e>
  87.  
  88. add extradata to all packets
  89.  
  90. =back
  91.  
  92.  
  93. If not specified it is assumed B<k>.
  94.  
  95. For example the following B<ffmpeg> command forces a global
  96. header (thus disabling individual packet headers) in the H.264 packets
  97. generated by the C<libx264> encoder, but corrects them by adding
  98. the header stored in extradata to the key packets:
  99.        
  100.         ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
  101.  
  102.  
  103.  
  104. =head2 h264_mp4toannexb
  105.  
  106.  
  107. Convert an H.264 bitstream from length prefixed mode to start code
  108. prefixed mode (as defined in the Annex B of the ITU-T H.264
  109. specification).
  110.  
  111. This is required by some streaming formats, typically the MPEG-2
  112. transport stream format ("mpegts").
  113.  
  114. For example to remux an MP4 file containing an H.264 stream to mpegts
  115. format with B<ffmpeg>, you can use the command:
  116.  
  117.        
  118.         ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
  119.  
  120.  
  121.  
  122. =head2 imxdump
  123.  
  124.  
  125. Modifies the bitstream to fit in MOV and to be usable by the Final Cut
  126. Pro decoder. This filter only applies to the mpeg2video codec, and is
  127. likely not needed for Final Cut Pro 7 and newer with the appropriate
  128. B<-tag:v>.
  129.  
  130. For example, to remux 30 MB/sec NTSC IMX to MOV:
  131.  
  132.        
  133.         ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
  134.  
  135.  
  136.  
  137. =head2 mjpeg2jpeg
  138.  
  139.  
  140. Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
  141.  
  142. MJPEG is a video codec wherein each video frame is essentially a
  143. JPEG image. The individual frames can be extracted without loss,
  144. e.g. by
  145.  
  146.        
  147.         ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  148.  
  149.  
  150. Unfortunately, these chunks are incomplete JPEG images, because
  151. they lack the DHT segment required for decoding. Quoting from
  152. E<lt>B<http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml>E<gt>:
  153.  
  154. Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
  155. commented that "MJPEG, or at least the MJPEG in AVIs having the
  156. MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
  157. Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
  158. and it must use basic Huffman encoding, not arithmetic or
  159. progressive. . . . You can indeed extract the MJPEG frames and
  160. decode them with a regular JPEG decoder, but you have to prepend
  161. the DHT segment to them, or else the decoder won't have any idea
  162. how to decompress the data. The exact table necessary is given in
  163. the OpenDML spec."
  164.  
  165. This bitstream filter patches the header of frames extracted from an MJPEG
  166. stream (carrying the AVI1 header ID and lacking a DHT segment) to
  167. produce fully qualified JPEG images.
  168.  
  169.        
  170.         ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  171.         exiftran -i -9 frame*.jpg
  172.         ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
  173.  
  174.  
  175.  
  176. =head2 mjpega_dump_header
  177.  
  178.  
  179.  
  180. =head2 movsub
  181.  
  182.  
  183.  
  184. =head2 mp3_header_decompress
  185.  
  186.  
  187.  
  188. =head2 mpeg4_unpack_bframes
  189.  
  190.  
  191. Unpack DivX-style packed B-frames.
  192.  
  193. DivX-style packed B-frames are not valid MPEG-4 and were only a
  194. workaround for the broken Video for Windows subsystem.
  195. They use more space, can cause minor AV sync issues, require more
  196. CPU power to decode (unless the player has some decoded picture queue
  197. to compensate the 2,0,2,0 frame per packet style) and cause
  198. trouble if copied into a standard container like mp4 or mpeg-ps/ts,
  199. because MPEG-4 decoders may not be able to decode them, since they are
  200. not valid MPEG-4.
  201.  
  202. For example to fix an AVI file containing an MPEG-4 stream with
  203. DivX-style packed B-frames using B<ffmpeg>, you can use the command:
  204.  
  205.        
  206.         ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
  207.  
  208.  
  209.  
  210. =head2 noise
  211.  
  212.  
  213. Damages the contents of packets without damaging the container. Can be
  214. used for fuzzing or testing error resilience/concealment.
  215.  
  216. Parameters:
  217. A numeral string, whose value is related to how often output bytes will
  218. be modified. Therefore, values below or equal to 0 are forbidden, and
  219. the lower the more frequent bytes will be modified, with 1 meaning
  220. every byte is modified.
  221.  
  222.        
  223.         ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
  224.  
  225. applies the modification to every byte.
  226.  
  227.  
  228. =head2 remove_extra
  229.  
  230.  
  231.  
  232.  
  233. =head1 SEE ALSO
  234.  
  235.  
  236.  
  237. ffmpeg(1), ffplay(1), ffprobe(1), ffserver(1), libavcodec(3)
  238.  
  239.  
  240. =head1 AUTHORS
  241.  
  242.  
  243. The FFmpeg developers.
  244.  
  245. For details about the authorship, see the Git history of the project
  246. (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
  247. B<git log> in the FFmpeg source directory, or browsing the
  248. online repository at E<lt>B<http://source.ffmpeg.org>E<gt>.
  249.  
  250. Maintainers for the specific components are listed in the file
  251. F<MAINTAINERS> in the source code tree.
  252.  
  253.  
  254.  
  255.