annotate DOCS/tech/formats.txt @ 16198:3e8e281ecc86

fix brokeness caused by demuxer patch, this code is useless for any case other than avi and should not be run even then. patch by Uoti Urpala (urpala BANG cc MEEP helsinki MEEP fi)
author ods15
date Thu, 11 Aug 2005 17:01:13 +0000
parents 7e22b762e1a8
children 42928a2e88fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
1 1. Input layer, supported devices, methods:
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
2 - plain file, with seeking
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
3 - STDIN, without seeking backward
6051
e8f013ef61fd ssm supported, dvdnav
arpi
parents: 2865
diff changeset
4 - network streaming (currently plain wget-like HTTP and MMS (.asx))
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
5 - VCD (Video CD) track, by direct CDROM device access (not requires mounting disc)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
6 - DVD titles using .IFO structure, by direct DVD device access (not requires mounting disc)
7831
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
7 - DVD titles using menu navigation (experimental/alpha, not yet finished!!!)
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
8 - CDDA - raw audio from audio CD-ROM discs (using cdparanoia libs)
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
9 - RTP streaming (mpeg-ps over multicast only)
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
10 - Live.com streaming - support SDP/RTSP (using the live.com libs)
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
11 - SMB - file access over samba (experimental)
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
12
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
13 2. Demuxer/parser layer, supported file/media formats:
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
14
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
15 - MPEG streams (ES,PES,PS. no TS support yet)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
16 note: mpeg demuxer silently ignore non-mpeg content, and find mpeg packets
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
17 in arbitrary streams. it means you can play directly VCD images (for example
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
18 CDRwin's .BIN files) without extracting mpeg files first (with tools like vcdgear)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
19 It accepts all PES variants, including files created by VDR.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
20 Note: VOB (video object) is simple mpeg stream, but it usually has 01BD
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
21 packets which may contain subtitles and non-mpeg audio. Usually found on DVD discs.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
22
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
23 Headers: mpeg streams has no global header. each frame sequence (also called GOP,
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
24 group of pictures) contains an sequence header, it describes that block.
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
25 In normal mpeg 1/2 content there are groups of 12-15 frames (24/30 fps).
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
26 It means you can freely seek in mpeg streams, and even can cut it to
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
27 small parts with standard file tools (dd, cut) without destroying it.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
28
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
29 Codecs: video is always mpeg video (mpeg1, mpeg2 or mpeg4).
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
30 audio is usually mpeg audio (any layer allowed, but it's layer 2 in most files)
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
31 but 01BD packets may contain AC3, DTS or LPCM too.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
32
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
33 FPS: mpeg2 content allows variable framerate, in form of delayed frames.
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
34 It's mostly used for playback 24fps content at 29.97/30 fps (NTSC) rate.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
35 (so called Telecine or 3:2 pulldown effect)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
36 It means you see 30 frames per second, but there are only 24 different
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
37 pictures and some of them are shown longer to fill 30 frame time.
7831
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
38 If you encode such files with mencoder, using -ofps 24 or -ofps 23.976
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
39 is recommended.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
40
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
41 - AVI streams.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
42 Two kind of RIFF AVI files exists:
2855
8bb4e195d7d7 *** empty log message ***
gabucino
parents: 2767
diff changeset
43 1. interleaved: audio and video content is interleaved. it's faster and
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
44 requires only 1 reading thread, so it's recommended (and mostly used).
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
45 2. non-interleaved: audio and video aren't interleaved, i mean first come
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
46 whole video followed by whole audio. it requires 2 reading process or
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
47 1 reading with lots of seeking. very bad for network or cdrom.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
48 3. badly interleaved streams: mplayer detects interleaving at startup and
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
49 enables -ni option if it finds non-interleaved content. but sometimes
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
50 the stream seems to be interleaved, but with bad sync so it should be
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
51 played as non-interleaved otherwise you get a-v desync or buffer overflow.
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
52
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
53 MPlayer supports 2 kind of timing for AVI files:
2855
8bb4e195d7d7 *** empty log message ***
gabucino
parents: 2767
diff changeset
54 - bps-based: it is based on bitrate/samplerate of video/audio stream.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
55 this method is used by most players, including avifile and wmp.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
56 files with broken headers, and files created with VBR audio but not
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
57 vbr-compliant encoder will result a-v desync with this method.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
58 (mostly at seeking).
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
59 - interleaving-based: note: it can't be used togethwer with -ni
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
60 it doesn't use bitrate stuff of header, it uses the relative position
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
61 of interleaved audio and video chunks. makes some badly encoded file
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
62 with vbr audio playable.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
63
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
64 Headers: AVI files has a mandatory header at the begin of the file,
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
65 describing video parameters (resolution, fps) and codecs. Optionally
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
66 they have an INDEX block at the end of the file. It's optional, but
2865
72c750bbc249 *** empty log message ***
gabucino
parents: 2855
diff changeset
67 most files has such block, because it's REQUIRED for seeking.
72c750bbc249 *** empty log message ***
gabucino
parents: 2855
diff changeset
68 Btw usually it can be rebuilt from file content, mplayer does it with
12228
7e22b762e1a8 typo fix: Mplayer --> MPlayer
diego
parents: 9129
diff changeset
69 the -idx switch. MPlayer can recreate broken index blocks using -forceidx.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
70 As AVI files needs index for random access, broken files with no index
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
71 are usually unplayable.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
72 Of course, cutting/joining AVI files needs special programs.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
73
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
74 Codecs: any audio and video codecs allowed, but I note that VBR audio is
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
75 not well supported by most players. The file format makes it possible to
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
76 use VBR audio, but most players expect CBR audio and fails with VBR,
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
77 as VBR is unusual, and Microsoft's AVI specs only describe CBR audio.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
78 I also note, that most AVI encoders/multiplexers create bad files if
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
79 using VBR audio. only 2 exception (known by me): NaNDub and MEncoder.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
80
2855
8bb4e195d7d7 *** empty log message ***
gabucino
parents: 2767
diff changeset
81 FPS: only constant framerate allowed, but it's possible to skip frames.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
82
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
83 - ASF streams:
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
84 ASF (active streaming format) comes from Microsoft. they developed two
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
85 variant of ASF, v1.0 and v2.0. v1.0 is used by their media tools (wmp and
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
86 wme) and v2.0 is published and patented :). of course, they differ,
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
87 no compatibility at all. (it's just a legality game)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
88 MPlayer supports only v1.0, as nobody ever seen v2.0 files :)
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
89 Note, that .ASF files are nowdays come with extension .WMA or .WMV.
7831
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
90 UPDATE: MS recently released the ASF v1.0 specs too, but it has some
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
91 restrictions making it illegal to read by us :)
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
92
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
93 Headers: Stream headers (codecs parameters) can be everywhere (in theory),
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
94 but all files i've seen had it at the beginning of the file.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
95 Asf uses fixed packet size, so it is seekable without any INDEX block,
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
96 and broken files are playable well.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
97
2765
a24cd70a12d1 typos fixed
arpi
parents: 2764
diff changeset
98 Codecs: video is mostly microsoft's mpeg4 variants: MP42, MP43 (aka DivX),
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
99 WMV1 and WMV2. but any codecs allowed.
2767
812e60e913a2 fixes suggested by atmos
arpi
parents: 2765
diff changeset
100 audio is usually wma or voxware, sometimes mp3, but any codecs allowed.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
101
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
102 FPS: no fixed fps, every video frame has an exact timestamp instead.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
103 I've got stream with up to 3 sec frame display times.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
104
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
105 - QuickTime / MOV files:
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
106 They come from Mac users, usually with .mov or .qt extension, but as
2865
72c750bbc249 *** empty log message ***
gabucino
parents: 2855
diff changeset
107 MPEG Group chose quicktime as recommended file format for MPEG4,
2767
812e60e913a2 fixes suggested by atmos
arpi
parents: 2765
diff changeset
108 sometimes you meet quicktime files with .mpg or .mp4 extension.
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
109
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
110 At first look, it's a mixture of ASF and AVI.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
111 It requires INDEX block for random access and seeking, and even for
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
112 playback, like AVI, but uses timestamps instead of constant framerate
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
113 and has more flexible stream options (including network stuff) like ASF.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
114
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
115 Headers: header can be placed at the beginning or at the end of file.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
116 About half of my files has it at the begining, others has it at the end.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
117 Broken files are only playable if they have header at the beginning!
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
118
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
119 Codecs: any codecs allowed, both CBR and VBR.
2767
812e60e913a2 fixes suggested by atmos
arpi
parents: 2765
diff changeset
120 Note: most new mov files use Sorenson video and QDesign Music audio,
812e60e913a2 fixes suggested by atmos
arpi
parents: 2765
diff changeset
121 they are patented, closed, secret, (TM)-ed etc formats, only Apple's
812e60e913a2 fixes suggested by atmos
arpi
parents: 2765
diff changeset
122 quicktime player is able to playback these files (on win/mac only).
2764
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
123
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
124 - VIVO files:
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
125 They are funny streams. They have a human-readable ascii header at
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
126 the beginning, followed by interleaved audio and video chunks.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
127 It has no index block, has no fixed packetsize or sync bytes, and most
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
128 files even has no keyframes, so forget seeking!
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
129 Video is standard h.263 (in vivo/2.0 files it's modified, non-standard
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
130 h.263), audio is either standard g.723 or Vivo Siren codec.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
131
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
132 Note, that microsoft licensed vivo stuff, and included in their netshow
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
133 v2.0 program, so there are VfW/ACM codecs for vivo video and audio.
6f7814af2a58 extended ascii version of formats.html
arpi
parents:
diff changeset
134
7831
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
135 - RealMedia files:
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
136 A mixture of AVI and ASF features. It has mandatory headers at the
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
137 beginning and an optional INDEX (missing in most files).
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
138 The file is constructed of variable size chunks, with small header
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
139 telling the stream ID, timestamp, flags (keyframe...) and size.
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
140 But it has some features found in ASF files:
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
141 The video is actually double-muxed, the video chunks are really
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
142 appended fragments of the video frame. RV30+ supports B frames, so
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
143 you have to parse some bits of the first fragment to get the real PTS.
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
144 The audio frames are fixed size (CBR) but using the same scrambling
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
145 (out-of-order interleaving) as in the ASF files.
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
146
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
147 Codecs: Audio is either COOK(er), SIPR(o), ATRAC3 or DNET.
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
148 The DNET is actually a byte-swapped low-bitrate Dolby AC3 variant :)
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
149 Video is RV10 (h263 variant), RV20 (rp G2), RV30 (rp v8) or RV40 (rp v9).
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
150
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
151 FPS: variable, just like in ASF.
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
152
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
153 Note, that similarity of real and asf has some background - they worked
6e1c3a66d554 updated
arpi
parents: 6051
diff changeset
154 together on the (never finished/used) ASF v2 spec for some time.
9129
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
155
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
156 - GIF files:
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
157 The GIF format is a common format for web graphics that supports
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
158 animation. These are read through libungif or compatible library.
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
159 Variable frame delays are supported, but seeking is not supported.
6ecc0b5c08cb libgif/libungif based demuxer support for libmpdemux.
arpi
parents: 7831
diff changeset
160 Seeking will be supported once an index of gif frames can be built.