bitstream_filters.texi 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. @chapter Bitstream Filters
  2. @c man begin BITSTREAM FILTERS
  3. When you configure your FFmpeg 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 ff* 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 h264_mp4toannexb
  17. Convert an H.264 bitstream from length prefixed mode to start code
  18. prefixed mode (as defined in the Annex B of the ITU-T H.264
  19. specification).
  20. This is required by some streaming formats, typically the MPEG-2
  21. transport stream format ("mpegts").
  22. For example to remux an MP4 file containing an H.264 stream to mpegts
  23. format with @command{ffmpeg}, you can use the command:
  24. @example
  25. ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
  26. @end example
  27. @section imx_dump_header
  28. @section mjpeg2jpeg
  29. Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
  30. MJPEG is a video codec wherein each video frame is essentially a
  31. JPEG image. The individual frames can be extracted without loss,
  32. e.g. by
  33. @example
  34. ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  35. @end example
  36. Unfortunately, these chunks are incomplete JPEG images, because
  37. they lack the DHT segment required for decoding. Quoting from
  38. @url{http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml}:
  39. Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
  40. commented that "MJPEG, or at least the MJPEG in AVIs having the
  41. MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* --
  42. Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
  43. and it must use basic Huffman encoding, not arithmetic or
  44. progressive. . . . You can indeed extract the MJPEG frames and
  45. decode them with a regular JPEG decoder, but you have to prepend
  46. the DHT segment to them, or else the decoder won't have any idea
  47. how to decompress the data. The exact table necessary is given in
  48. the OpenDML spec."
  49. This bitstream filter patches the header of frames extracted from an MJPEG
  50. stream (carrying the AVI1 header ID and lacking a DHT segment) to
  51. produce fully qualified JPEG images.
  52. @example
  53. ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  54. exiftran -i -9 frame*.jpg
  55. ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
  56. @end example
  57. @section mjpega_dump_header
  58. @section movsub
  59. @section mp3_header_compress
  60. @section mp3_header_decompress
  61. @section noise
  62. @section remove_extradata
  63. @c man end BITSTREAM FILTERS