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