~ubuntu-branches/debian/squeeze/mplayer/squeeze

« back to all changes in this revision

Viewing changes to DOCS/HTML/en/advaudio-channels.html

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2010-07-31 23:44:52 UTC
  • mfrom: (1.1.4 upstream) (8.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100731234452-j7yyrgsh1wustazr
Tags: 2:1.0~rc3++final.dfsg1-1
* upload to unstable
* enable mencoder and mplayer-gui package
* build again against the system FFmpeg 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>4.2. Channel manipulation</title><link rel="stylesheet" href="default.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="MPlayer - The Movie Player"><link rel="up" href="advaudio.html" title="Chapter 4. Advanced audio usage"><link rel="prev" href="advaudio-surround.html" title="4.1. Surround/Multichannel playback"><link rel="next" href="advaudio-volume.html" title="4.3. Software Volume adjustment"><link rel="preface" href="howtoread.html" title="How to read this documentation"><link rel="chapter" href="intro.html" title="Chapter 1. Introduction"><link rel="chapter" href="install.html" title="Chapter 2. Installation"><link rel="chapter" href="usage.html" title="Chapter 3. Usage"><link rel="chapter" href="advaudio.html" title="Chapter 4. Advanced audio usage"><link rel="chapter" href="cd-dvd.html" title="Chapter 5. CD/DVD usage"><link rel="chapter" href="tv.html" title="Chapter 6. TV"><link rel="chapter" href="radio.html" title="Chapter 7. Radio"><link rel="chapter" href="video.html" title="Chapter 8. Video output devices"><link rel="chapter" href="ports.html" title="Chapter 9. Ports"><link rel="chapter" href="mencoder.html" title="Chapter 10. Basic usage of MEncoder"><link rel="chapter" href="encoding-guide.html" title="Chapter 11. Encoding with MEncoder"><link rel="chapter" href="faq.html" title="Chapter 12. Frequently Asked Questions"><link rel="appendix" href="bugreports.html" title="Appendix A. How to report bugs"><link rel="appendix" href="skin.html" title="Appendix B. MPlayer skin format"><link rel="subsection" href="advaudio-channels.html#advaudio-channels-general" title="4.2.1. General information"><link rel="subsection" href="advaudio-channels.html#advaudio-channels-mono" title="4.2.2. Playing mono with two speakers"><link rel="subsection" href="advaudio-channels.html#advaudio-channels-copying" title="4.2.3. Channel copying/moving"><link rel="subsection" href="advaudio-channels.html#advaudio-channels-mixing" title="4.2.4. Channel mixing"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.2. Channel manipulation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="advaudio-surround.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Advanced audio usage</th><td width="20%" align="right"> <a accesskey="n" href="advaudio-volume.html">Next</a></td></tr></table><hr></div><div class="sect1" title="4.2. Channel manipulation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="advaudio-channels"></a>4.2. Channel manipulation</h2></div></div></div><div class="sect2" title="4.2.1. General information"><div class="titlepage"><div><div><h3 class="title"><a name="advaudio-channels-general"></a>4.2.1. General information</h3></div></div></div><p>
 
2
Unfortunately, there is no standard for how channels are ordered. The orders
 
3
listed below are those of AC-3 and are fairly typical; try them and see if your
 
4
source matches. Channels are numbered starting with 0.
 
5
 
 
6
</p><div class="orderedlist" title="mono"><p class="title"><b>mono</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>center</p></li></ol></div><p>
 
7
 
 
8
</p><div class="orderedlist" title="stereo"><p class="title"><b>stereo</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>left</p></li><li class="listitem"><p>right</p></li></ol></div><p>
 
9
 
 
10
</p><div class="orderedlist" title="quadraphonic"><p class="title"><b>quadraphonic</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>left front</p></li><li class="listitem"><p>right front</p></li><li class="listitem"><p>left rear</p></li><li class="listitem"><p>right rear</p></li></ol></div><p>
 
11
 
 
12
</p><div class="orderedlist" title="surround 4.0"><p class="title"><b>surround 4.0</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>left front</p></li><li class="listitem"><p>right front</p></li><li class="listitem"><p>center rear</p></li><li class="listitem"><p>center front</p></li></ol></div><p>
 
13
 
 
14
</p><div class="orderedlist" title="surround 5.0"><p class="title"><b>surround 5.0</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>left front</p></li><li class="listitem"><p>right front</p></li><li class="listitem"><p>left rear</p></li><li class="listitem"><p>right rear</p></li><li class="listitem"><p>center front</p></li></ol></div><p>
 
15
 
 
16
</p><div class="orderedlist" title="surround 5.1"><p class="title"><b>surround 5.1</b></p><ol class="orderedlist" type="1" compact><li class="listitem" value="0"><p>left front</p></li><li class="listitem"><p>right front</p></li><li class="listitem"><p>left rear</p></li><li class="listitem"><p>right rear</p></li><li class="listitem"><p>center front</p></li><li class="listitem"><p>subwoofer</p></li></ol></div><p>
 
17
</p><p>
 
18
The <tt class="option">-channels</tt> option is used to request the number of
 
19
channels from the audio decoder. Some audio codecs use the number of specified
 
20
channels to decide if downmixing the source is necessary. Note that this does
 
21
not always affect the number of output channels. For example, using
 
22
<tt class="option">-channels 4</tt> to play a stereo MP3 file will still result in
 
23
2-channel output since the MP3 codec will not produce the extra channels.
 
24
</p><p>
 
25
The <tt class="option">channels</tt> audio filter can be used to create or remove
 
26
channels and is useful for controlling the number of channels sent to the sound
 
27
card. See the following sections for more information on channel manipulation.
 
28
</p></div><div class="sect2" title="4.2.2. Playing mono with two speakers"><div class="titlepage"><div><div><h3 class="title"><a name="advaudio-channels-mono"></a>4.2.2. Playing mono with two speakers</h3></div></div></div><p>
 
29
Mono sounds a lot better when played through two speakers - especially when
 
30
using headphones. Audio files that truly have one channel are automatically
 
31
played through two speakers; unfortunately, most files with mono sound are
 
32
actually encoded as stereo with one channel silent. The easiest and most
 
33
foolproof way to make both speakers output the same audio is the
 
34
<tt class="option">extrastereo</tt> filter:
 
35
</p><pre class="screen">mplayer <em class="replaceable"><code>filename</code></em> -af extrastereo=0</pre><p>
 
36
</p><p>
 
37
This averages both channels, resulting in both channels being half as loud as
 
38
the original. The next sections have examples of other ways to do this without a
 
39
volume decrease, but they are more complex and require different options
 
40
depending on which channel to keep. If you really need to maintain the volume,
 
41
it may be easier to experiment with the <tt class="option">volume</tt> filter and find
 
42
the right value. For example:
 
43
</p><pre class="screen">
 
44
mplayer <em class="replaceable"><code>filename</code></em> -af extrastereo=0,volume=5
 
45
</pre><p>
 
46
</p></div><div class="sect2" title="4.2.3. Channel copying/moving"><div class="titlepage"><div><div><h3 class="title"><a name="advaudio-channels-copying"></a>4.2.3. Channel copying/moving</h3></div></div></div><p>
 
47
The <tt class="option">channels</tt> filter can move any or all channels.
 
48
Setting up all the suboptions for the <tt class="option">channels</tt>
 
49
filter can be complicated and takes a little care.
 
50
 
 
51
</p><div class="orderedlist"><ol class="orderedlist" type="1" compact><li class="listitem"><p>
 
52
  Decide how many output channels you need. This is the first suboption.
 
53
</p></li><li class="listitem"><p>
 
54
  Count how many channel moves you will do. This is the second suboption. Each
 
55
  channel can be moved to several different channels at the same time, but keep
 
56
  in mind that when a channel is moved (even if to only one destination) the
 
57
  source channel will be empty unless another channel is moved into it. To copy
 
58
  a channel, keeping the source the same, simply move the channel into both the
 
59
  destination and the source. For example:
 
60
  </p><pre class="programlisting">
 
61
channel 2 --&gt; channel 3
 
62
channel 2 --&gt; channel 2</pre><p>
 
63
</p></li><li class="listitem"><p>
 
64
  Write out the channel copies as pairs of suboptions. Note that the first
 
65
  channel is 0, the second is 1, etc. The order of these suboptions does not
 
66
  matter as long as they are properly grouped into
 
67
  <em class="replaceable"><code>source:destination</code></em> pairs.
 
68
</p></li></ol></div><p>
 
69
</p><h4><a name="id464538"></a>Example: one channel in two speakers</h4><p>
 
70
Here is an example of another way to play one channel in both speakers. Suppose
 
71
for this example that the left channel should be played and the right channel
 
72
discarded. Following the steps above:
 
73
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
74
  In order to provide an output channel for each of the two speakers, the first
 
75
  suboption must be "2".
 
76
</p></li><li class="listitem"><p>
 
77
  The left channel needs to be moved to the right channel, and also must be
 
78
  moved to itself so it won't be empty. This is a total of two moves, making
 
79
  the second suboption "2" as well.
 
80
</p></li><li class="listitem"><p>
 
81
  To move the left channel (channel 0) into the right channel (channel 1), the
 
82
  suboption pair is "0:1", "0:0" moves the left channel onto itself.
 
83
</p></li></ol></div><p>
 
84
Putting that all together gives:
 
85
</p><pre class="screen">
 
86
mplayer <em class="replaceable"><code>filename</code></em> -af channels=2:2:0:1:0:0
 
87
</pre><p>
 
88
</p><p>
 
89
The advantage this example has over <tt class="option">extrastereo</tt> is that the
 
90
volume of each output channel is the same as the input channel. The disadvantage
 
91
is that the suboptions must be changed to "2:2:1:0:1:1" when the desired audio
 
92
is in the right channel. Also, it is more difficult to remember and type.
 
93
</p><h4><a name="id464587"></a>Example: left channel in two speakers shortcut</h4><p>
 
94
There is actually a much easier way to use the <tt class="option">channels</tt> filter
 
95
for playing the left channel in both speakers:
 
96
</p><pre class="screen">mplayer <em class="replaceable"><code>filename</code></em> -af channels=1</pre><p>
 
97
The second channel is discarded and, with no further suboptions, the single
 
98
remaining channel is left alone. Sound card drivers automatically play
 
99
single-channel audio in both speakers. This only works when the desired channel
 
100
is on the left.
 
101
</p><h4><a name="id464607"></a>Example: duplicate front channels to the rear</h4><p>
 
102
Another common operation is to duplicate the front channels and play them back
 
103
on the rear speakers of a quadraphonic setup.
 
104
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
105
  There should be four output channels. The first suboption is "4".
 
106
</p></li><li class="listitem"><p>
 
107
  Each of the two front channels needs to be moved to the corresponding rear
 
108
  channel and also to itself. This is four moves, so the second suboption is "4".
 
109
</p></li><li class="listitem"><p>
 
110
  The left front (channel 0) needs to moved to the left rear (channel 2):
 
111
  "0:2".  The left front also needs to be moved to itself: "0:0". The right
 
112
  front (channel 1) is moved to the right rear (channel 3): "1:3", and also to
 
113
  itself: "1:1".
 
114
</p></li></ol></div><p>
 
115
Combine all the suboptions to get:
 
116
</p><pre class="screen">
 
117
mplayer <em class="replaceable"><code>filename</code></em> -af channels=4:4:0:2:0:0:1:3:1:1
 
118
</pre><p>
 
119
</p></div><div class="sect2" title="4.2.4. Channel mixing"><div class="titlepage"><div><div><h3 class="title"><a name="advaudio-channels-mixing"></a>4.2.4. Channel mixing</h3></div></div></div><p>
 
120
The <tt class="option">pan</tt> filter can mix channels in user-specified proportions.
 
121
This allows for everything the <tt class="option">channels</tt> filter can do and
 
122
more. Unfortunately, the suboptions are much more complicated.
 
123
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
124
  Decide how many channels to work with. You may need to specify this with
 
125
  <tt class="option">-channels</tt> and/or <tt class="option">-af channels</tt>.
 
126
  Later examples will show when to use which.
 
127
</p></li><li class="listitem"><p>
 
128
  Decide how many channels to feed into <tt class="option">pan</tt> (further decoded
 
129
  channels are discarded). This is the first suboption, and it also controls how
 
130
  many channels to employ for output.
 
131
</p></li><li class="listitem"><p>
 
132
  The remaining suboptions specify how much of each channel gets mixed into each
 
133
  other channel. This is the complicated part. To break the task down, split the
 
134
  suboptions into several sets, one set for each output channel. Each suboption
 
135
  within a set corresponds to an input channel. The number you specify will be
 
136
  the percentage of the input channel that gets mixed into the output channel.
 
137
  </p><p>
 
138
  <tt class="option">pan</tt> accepts values from 0 to 512, yielding 0% to 51200% of
 
139
  the original volume. Be careful when using values greater than 1. Not only
 
140
  can this give you very high volume, but if you exceed the sample range of
 
141
  your sound card you may hear painful pops and clicks. If you want you can
 
142
  follow <tt class="option">pan</tt> with <tt class="option">,volume</tt> to enable clipping,
 
143
  but it is best to keep the values of <tt class="option">pan</tt> low enough that
 
144
  clipping is not necessary.
 
145
  </p></li></ol></div><p>
 
146
</p><h4><a name="id464724"></a>Example: one channel in two speakers</h4><p>
 
147
Here is yet another example for playing the left channel in two speakers. Follow
 
148
the steps above:
 
149
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
150
  <tt class="option">pan</tt> should output two channels, so the first
 
151
  suboption is "2".
 
152
</p></li><li class="listitem"><p>
 
153
  Since we have two input channels, there will be two sets of suboptions.
 
154
  Since there are also two output channels,
 
155
  there will be two suboptions per set.
 
156
  The left channel from the file should go with full volume to
 
157
  the new left and the right channels.
 
158
  Thus the first set of suboptions is "1:1".
 
159
  The right channel should be discarded, so the second would be "0:0".
 
160
  Any 0 values at the end can be left out, but for ease of
 
161
  understanding we will keep them.
 
162
</p></li></ol></div><p>
 
163
Putting those options together gives:
 
164
</p><pre class="screen">mplayer <em class="replaceable"><code>filename</code></em> -af pan=2:1:1:0:0</pre><p>
 
165
If the right channel is desired instead of the left, the suboptions to
 
166
<tt class="option">pan</tt> will be "2:0:0:1:1".
 
167
</p><h4><a name="id464767"></a>Example: left channel in two speakers shortcut</h4><p>
 
168
As with <tt class="option">channels</tt>, there is a shortcut that only works with the
 
169
left channel:
 
170
</p><pre class="screen">mplayer <em class="replaceable"><code>filename</code></em> -af pan=1:1</pre><p>
 
171
Since <tt class="option">pan</tt> has only one channel of input (the other channel is
 
172
discarded), there is only one set with one suboption, which specifies that the
 
173
only channel gets 100% of itself.
 
174
</p><h4><a name="id464790"></a>Example: downmixing 6-channel PCM</h4><p>
 
175
<span class="application">MPlayer</span>'s decoder for 6-channel PCM is not capable of
 
176
downmixing. Here is a way to downmix PCM using <tt class="option">pan</tt>:
 
177
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
178
  The number of output channels is 2, so the first suboption is "2".
 
179
</p></li><li class="listitem"><p>
 
180
  With six input channels there will be six sets of options. Fortunately,
 
181
  since we only care about the output of the first two channels, we only need to
 
182
  make two sets; the remaining four sets can be omitted. Beware that not all
 
183
  multichannel audio files have the same channel order! This example
 
184
  demonstrates downmixing a file with the same channels as AC-3 5.1:
 
185
  </p><pre class="programlisting">
 
186
0 - front left
 
187
1 - front right
 
188
2 - rear left
 
189
3 - rear right
 
190
4 - center front
 
191
5 - subwoofer</pre><p>
 
192
  The first set of suboptions lists the percentages of the original volume, in
 
193
  order, which each output channel should receive from the
 
194
  front left channel: "1:0".
 
195
  The front right channel should go into the right output: "0:1".
 
196
  The same for the rear channels: "1:0" and "0:1".
 
197
  The center channel goes into both output channels with half volume:
 
198
  "0.5:0.5", and the subwoofer goes into both with full volume: "1:1".
 
199
</p></li></ol></div><p>
 
200
Put all that together, for:
 
201
</p><pre class="screen">
 
202
mplayer <em class="replaceable"><code>6-channel.wav</code></em> -af pan=2:1:0:0:1:1:0:0:1:0.5:0.5:1:1
 
203
</pre><p>
 
204
The percentages listed above are only a rough example. Feel free to tweak them.
 
205
</p><h4><a name="id464846"></a>Example: Playing 5.1 audio on big speakers without a subwoofer</h4><p>
 
206
If you have a huge pair of front speakers you may not want to waste any money on
 
207
buying a subwoofer for a complete 5.1 sound system. If you use
 
208
<tt class="option">-channels 5</tt> to request that liba52 decode 5.1 audio in 5.0,
 
209
the subwoofer channel is simply discarded. If you want to distribute the
 
210
subwoofer channel yourself you need to downmix manually with
 
211
<tt class="option">pan</tt>:
 
212
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
213
  Since <tt class="option">pan</tt> needs to examine all six channels, specify
 
214
  <tt class="option">-channels 6</tt> so liba52 decodes them all.
 
215
</p></li><li class="listitem"><p>
 
216
  <tt class="option">pan</tt> outputs to only five channels, the first suboption is 5.
 
217
</p></li><li class="listitem"><p>
 
218
  Six input channels and five output channels means six sets of five suboptions.
 
219
  </p><div class="itemizedlist"><ul class="itemizedlist" type="disc" compact><li class="listitem"><p>
 
220
    The left front channel only replicates onto itself:
 
221
    "1:0:0:0:0"
 
222
  </p></li><li class="listitem"><p>
 
223
    Same for the right front channel:
 
224
    "0:1:0:0:0"
 
225
  </p></li><li class="listitem"><p>
 
226
    Same for the left rear channel:
 
227
    "0:0:1:0:0"
 
228
  </p></li><li class="listitem"><p>
 
229
    And also the same for the right rear channel:
 
230
    "0:0:0:1:0"
 
231
  </p></li><li class="listitem"><p>
 
232
    Center front, too:
 
233
    "0:0:0:0:1"
 
234
  </p></li><li class="listitem"><p>
 
235
    And now we have to decide what to do with the subwoofer,
 
236
    e.g. half into front right and front left:
 
237
    "0.5:0.5:0:0:0"
 
238
  </p></li></ul></div><p>
 
239
</p></li></ol></div><p>
 
240
Combine all those options to get:
 
241
</p><pre class="screen">
 
242
mplayer <em class="replaceable"><code>dvd://1</code></em> -channels 6 -af pan=5:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0.5:0.5:0:0:0
 
243
</pre><p>
 
244
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="advaudio-surround.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="advaudio.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="advaudio-volume.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.1. Surround/Multichannel playback </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.3. Software Volume adjustment</td></tr></table></div></body></html>