From 3dcc83a70609d392c8ecd917dd5c16995424e9c4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 5 Mar 2013 23:10:02 +0100 Subject: vo_opengl: avoid texture arrays for compatibility with Intel low quality crap Commit a0b43a1 changed textures to an array, because additional per-texture information was needed and managing this as array is more elegant. This broke playback on Windows with Intel drivers (window shows green video, even though subtitles/OSD work correctly). So change it back to make it work again. Affected driver: Intel(R) HD Graphics 3000 9.17.10.2932 --- video/out/vo_opengl.c | 2 +- video/out/vo_opengl_shaders.glsl | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index dbaede4461..669bd46ceb 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -450,7 +450,7 @@ static void update_uniforms(struct gl_priv *p, GLuint program) for (int n = 0; n < p->plane_count; n++) { char textures_n[32]; char textures_size_n[32]; - snprintf(textures_n, sizeof(textures_n), "textures[%d]", n); + snprintf(textures_n, sizeof(textures_n), "texture%d", n); snprintf(textures_size_n, sizeof(textures_size_n), "textures_size[%d]", n); gl->Uniform1i(gl->GetUniformLocation(program, textures_n), n); diff --git a/video/out/vo_opengl_shaders.glsl b/video/out/vo_opengl_shaders.glsl index 13595ec77e..677b2f5679 100644 --- a/video/out/vo_opengl_shaders.glsl +++ b/video/out/vo_opengl_shaders.glsl @@ -87,28 +87,30 @@ void main() { } #!section frag_osd_libass -uniform sampler2D textures[3]; +uniform sampler2D texture0; in vec2 texcoord; in vec4 color; DECLARE_FRAGPARMS void main() { - out_color = vec4(color.rgb, color.a * texture(textures[0], texcoord).r); + out_color = vec4(color.rgb, color.a * texture(texture0, texcoord).r); } #!section frag_osd_rgba -uniform sampler2D textures[3]; +uniform sampler2D texture0; in vec2 texcoord; DECLARE_FRAGPARMS void main() { - out_color = texture(textures[0], texcoord); + out_color = texture(texture0, texcoord); } #!section frag_video -uniform sampler2D textures[3]; +uniform sampler2D texture0; +uniform sampler2D texture1; +uniform sampler2D texture2; uniform vec2 textures_size[3]; uniform sampler1D lut_c_1d; uniform sampler1D lut_l_1d; @@ -313,11 +315,11 @@ vec4 sample_sharpen5(sampler2D tex, vec2 texsize, vec2 texcoord) { void main() { #ifdef USE_PLANAR - vec3 color = vec3(SAMPLE_L(textures[0], textures_size[0], texcoord).r, - SAMPLE_C(textures[1], textures_size[1], texcoord).r, - SAMPLE_C(textures[2], textures_size[2], texcoord).r); + vec3 color = vec3(SAMPLE_L(texture0, textures_size[0], texcoord).r, + SAMPLE_C(texture1, textures_size[1], texcoord).r, + SAMPLE_C(texture2, textures_size[2], texcoord).r); #else - vec3 color = SAMPLE_L(textures[0], textures_size[0], texcoord).rgb; + vec3 color = SAMPLE_L(texture0, textures_size[0], texcoord).rgb; #endif #ifdef USE_GBRP color.gbr = color; -- cgit v1.2.3 From f630ee15972a6ce967658441994824322d8f5136 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Jul 2013 01:40:13 +0200 Subject: Fix building with --disable-libass Obscure corner case, but in theory we support this. --- demux/demux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demux/demux.c b/demux/demux.c index a5d3211b0a..c783b0cbc2 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -82,7 +82,9 @@ const demuxer_desc_t *const demuxer_list[] = { #ifdef CONFIG_TV &demuxer_desc_tv, #endif +#ifdef CONFIG_LIBASS &demuxer_desc_libass, +#endif &demuxer_desc_matroska, &demuxer_desc_lavf, &demuxer_desc_subreader, -- cgit v1.2.3 From bfe0207a7a7fed8e9fe8643fbd99d5f15abefaad Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Jul 2013 01:53:59 +0200 Subject: configure: link with -lrt In order to use clock_gettime() (which we need for use with pthread_cond_timedwait()), most glibc versions need to link with -lrt. --- configure | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure b/configure index 2c9b98e04d..9299a0c26d 100755 --- a/configure +++ b/configure @@ -1271,6 +1271,22 @@ else fi echores "$_pthreads" +if test "$_pthreads" = yes ; then + +# Cargo-cult for -lrt, which is needed on not so recent glibc version for +# clock_gettime. It's documented as required before before glibc 2.17, which +# was released in december 2012. On newer glibc versions or on other systems, +# this will hopefully do nothing. +echocheck "linking with -lrt" +_rt=no +cc_check "-lrt" && _rt=yes +if test "$_rt" = yes ; then + _ld_pthread="$_ld_pthread -lrt" +fi +echores "$_rt" + +fi + echocheck "stream cache" _stream_cache="$_pthreads" if test "$_stream_cache" = yes ; then -- cgit v1.2.3 From 49bf0fb9dffdd8b39e68c4e423bbab653d3db396 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Jul 2013 02:24:42 +0200 Subject: configure: fix previous commit This doesn't help if -pthread is omitted. (Apparently, glibc 2.17, on which I tested the previous commit, doesn't require -lpthread in order to use pthreads either.) --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9299a0c26d..e3fc0766fb 100755 --- a/configure +++ b/configure @@ -1279,7 +1279,7 @@ if test "$_pthreads" = yes ; then # this will hopefully do nothing. echocheck "linking with -lrt" _rt=no -cc_check "-lrt" && _rt=yes +cc_check "$_ld_pthread -lrt" && _rt=yes if test "$_rt" = yes ; then _ld_pthread="$_ld_pthread -lrt" fi -- cgit v1.2.3 From f2ad12a8199013645e9e6a69ea7c5d25ad4c3d61 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Jul 2013 03:19:46 +0200 Subject: stream_radio: fix build This was accidentally broken with 37c5c11 and has been nroken for 5 months. Does anyone (want to) use this at all? --- stream/stream_radio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stream/stream_radio.c b/stream/stream_radio.c index 49a3353c2a..fae9be43d1 100644 --- a/stream/stream_radio.c +++ b/stream/stream_radio.c @@ -37,6 +37,10 @@ #include +#ifdef CONFIG_RADIO_V4L2 +#include +#endif + #include "stream.h" #include "demux/demux.h" #include "core/m_struct.h" -- cgit v1.2.3 From c7f631e2c03d3d3905daf22a497827118b6070e5 Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Mon, 8 Jul 2013 10:32:41 +0200 Subject: =?UTF-8?q?sub:=20Do=20not=20use=20deprecated=20=E2=80=9CSans?= =?UTF-8?q?=E2=80=9D=20fontconfig=20alias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sub/sub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub/sub.c b/sub/sub.c index 90b6cfee00..f3feef3c88 100644 --- a/sub/sub.c +++ b/sub/sub.c @@ -40,7 +40,7 @@ #include "video/mp_image_pool.h" static const struct osd_style_opts osd_style_opts_def = { - .font = "Sans", + .font = "sans-serif", .font_size = 45, .color = {255, 255, 255, 255}, .border_color = {0, 0, 0, 255}, -- cgit v1.2.3 From 1a8ab1d6adb8d849ed6f1b8a31baf0ef31242e4a Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Mon, 8 Jul 2013 13:21:24 +0200 Subject: stream/tv: remove unused dshow-specific options --- stream/stream_tv.c | 6 +----- stream/tv.h | 21 --------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/stream/stream_tv.c b/stream/stream_tv.c index 0a519efb25..595657dc43 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -72,11 +72,7 @@ tv_param_t stream_tv_defaults = { -1, //gain 0, //scan_autostart 50, //scan_threshold - 0.5, //scan_period - 0, //hidden_video_renderer; - 0, //hidden_vp_renderer; - 0, //system_clock; - 0 //normalize_audio_chunks; + 0.5, //scan_period }; #define ST_OFF(f) M_ST_OFF(tv_param_t,f) diff --git a/stream/tv.h b/stream/tv.h index 178c23563c..660a78be7b 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -73,27 +73,6 @@ typedef struct tv_param_s { Will help if video freezes but audio does not. May not work with -vo directx and -vf crop combination. */ - int hidden_video_renderer; - /** - For VIVO cards VP pin have to be rendered too. - This tweak will cause VidePort pin stream to be terminated with video renderer - instead of removing it from graph. - Use if your card have vp pin and video is still choppy. - May not work with -vo directx and -vf crop combination. - */ - int hidden_vp_renderer; - /** - Use system clock as sync source instead of default graph clock (usually the clock - from one of live sources in graph. - */ - int system_clock; - /** - Some audio cards creates audio chunks with about 0.5 sec size. - This can cause choppy video when using mplayer with immediatemode=0 - Use followingtweak to decrease audio chunk sizes. - It will create audio chunks with time length equal to one video frame time. - */ - int normalize_audio_chunks; } tv_param_t; extern tv_param_t stream_tv_defaults; -- cgit v1.2.3 From 09d2dd7c3ab1cc650ede12f00affbba4b73b970b Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Mon, 8 Jul 2013 18:02:14 +0200 Subject: manpage: proofread and fix formatting --- DOCS/man/en/af.rst | 446 ++++++------ DOCS/man/en/ao.rst | 122 ++-- DOCS/man/en/changes.rst | 171 ++--- DOCS/man/en/encode.rst | 116 ++-- DOCS/man/en/input.rst | 416 +++++------ DOCS/man/en/mpv.rst | 197 +++--- DOCS/man/en/options.rst | 1763 +++++++++++++++++++++++++---------------------- DOCS/man/en/vf.rst | 674 +++++++++--------- DOCS/man/en/vo.rst | 465 ++++++------- 9 files changed, 2246 insertions(+), 2124 deletions(-) diff --git a/DOCS/man/en/af.rst b/DOCS/man/en/af.rst index 81e99905d0..3a6eaa6e37 100644 --- a/DOCS/man/en/af.rst +++ b/DOCS/man/en/af.rst @@ -1,79 +1,74 @@ -.. _audio_filters: - AUDIO FILTERS ============= Audio filters allow you to modify the audio stream and its properties. The syntax is: ---af= +``--af=`` Setup a chain of audio filters. -*NOTE*: To get a full list of available audio filters, see ``--af=help``. +.. note:: + + To get a full list of available audio filters, see ``--af=help``. Audio filters are managed in lists. There are a few commands to manage the -filter list. +filter list: ---af-add= +``--af-add=`` Appends the filters given as arguments to the filter list. ---af-pre= +``--af-pre=`` Prepends the filters given as arguments to the filter list. ---af-del= +``--af-del=`` Deletes the filters at the given indexes. Index numbers start at 0, negative numbers address the end of the list (-1 is the last). ---af-clr +``--af-clr`` Completely empties the filter list. Available filters are: -lavrresample[=option1:option2:...] +``lavrresample[=option1:option2:...]`` This filter uses libavresample (or libswresample, depending on the build) to change sample rate, sample format, or channel layout of the audio stream. - This filter is automatically enabled if the audio output doesn't support + This filter is automatically enabled if the audio output does not support the audio configuration of the file being played. It supports only the following sample formats: u8, s16ne, s32ne, floatne. - srate= - the output sample rate - length= - length of the filter with respect to the lower sampling rate (default: + ``srate=`` + The output sample rate. + ``length=`` + Length of the filter with respect to the lower sampling rate. (default: 16) - phase_shift= - log2 of the number of polyphase entries (..., 10->1024, 11->2048, + ``phase_shift=`` + Log2 of the number of polyphase entries. (..., 10->1024, 11->2048, 12->4096, ...) (default: 10->1024) - cutoff= - cutoff frequency (0.0-1.0), default set depending upon filter length - linear - if set then filters will be linearly interpolated between polyphase - entries (default: no) - no-detach - don't detach if input and output audio format/rate/channels are the - same. You should add this option if you specify additional parameters, - as automatically inserted lavrresample instances will use the - default settings. - -lavcac3enc[=tospdif[:bitrate[:minchn]]] + ``cutoff=`` + Cutoff frequency (0.0-1.0), default set depending upon filter length. + ``linear`` + If set then filters will be linearly interpolated between polyphase + entries. (default: no) + ``no-detach`` + Do not detach if input and output audio format/rate/channels match. + You should add this option if you specify additional parameters, as + automatically inserted lavrresample instances will use the default + settings. + +``lavcac3enc[=tospdif[:bitrate[:minchn]]]`` Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports 16-bit native-endian input format, maximum 6 channels. The output is big-endian when outputting a raw AC-3 stream, native-endian when - outputting to S/PDIF. The output sample rate of this filter is same with - the input sample rate. When input sample rate is 48kHz, 44.1kHz, or 32kHz, - this filter directly use it. Otherwise a resampling filter is - auto-inserted before this filter to make the input and output sample rate - be 48kHz. You need to specify ``--channels=N`` to make the decoder decode - audio into N-channel, then the filter can encode the N-channel input to - AC-3. - - + outputting to S/PDIF. If the input sample rate is not 48 kHz, 44.1 kHz or + 32 kHz, it will be resampled to 48 kHz. + + ```` Output raw AC-3 stream if zero or not set, output to S/PDIF for - passthrough when is set non-zero. - - The bitrate to encode the AC-3 stream. Set it to either 384 or 384000 - to get 384kbits. + passthrough when ```` is set non-zero. + ```` + The bitrate use for the AC-3 stream. Set it to either 384 or 384000 + to get 384 kbps. Valid values: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640. @@ -87,41 +82,41 @@ lavcac3enc[=tospdif[:bitrate[:minchn]]] :5ch: 448 :6ch: 448 - - If the input channel number is less than , the filter will + ```` + If the input channel number is less than ````, the filter will detach itself (default: 5). -sweep[=speed] +``sweep[=speed]`` Produces a sine sweep. - <0.0-1.0> + ``<0.0-1.0>`` Sine function delta, use very low values to hear the sweep. -sinesuppress[=freq:decay] +``sinesuppress[=freq:decay]`` Remove a sine at the specified frequency. Useful to get rid of the 50/60Hz - noise on low quality audio equipment. It probably only works on mono input. + noise on low quality audio equipment. It only works on mono input. - + ```` The frequency of the sine which should be removed (in Hz) (default: 50) - + ```` Controls the adaptivity (a larger value will make the filter adapt to amplitude and phase changes quicker, a smaller value will make the adaptation slower) (default: 0.0001). Reasonable values are around 0.001. -bs2b[=option1:option2:...] - Bauer stereophonic to binaural transformation using ``libbs2b``. Improves - the headphone listening experience by making the sound similar to that - from loudspeakers, allowing each ear to hear both channels and taking into +``bs2b[=option1:option2:...]`` + Bauer stereophonic to binaural transformation using libbs2b. Improves the + headphone listening experience by making the sound similar to that from + loudspeakers, allowing each ear to hear both channels and taking into account the distance difference and the head shadowing effect. It is - applicable only to 2 channel audio. + applicable only to 2-channel audio. - fcut=<300-1000> + ``fcut=<300-1000>`` Set cut frequency in Hz. - feed=<10-150> + ``feed=<10-150>`` Set feed level for low frequencies in 0.1*dB. - profile= + ``profile=`` Several profiles are available for convenience: :default: will be used if nothing else was specified (fcut=700, @@ -129,11 +124,11 @@ bs2b[=option1:option2:...] :cmoy: Chu Moy circuit implementation (fcut=700, feed=60) :jmeier: Jan Meier circuit implementation (fcut=650, feed=95) - If fcut or feed options are specified together with a profile, they will - be applied on top of the selected profile. + If ``fcut`` or ``feed`` options are specified together with a profile, they + will be applied on top of the selected profile. -hrtf[=flag] - Head-related transfer function: Converts multichannel audio to 2 channel +``hrtf[=flag]`` + Head-related transfer function: Converts multichannel audio to 2-channel output for headphones, preserving the spatiality of the sound. ==== =================================== @@ -144,8 +139,8 @@ hrtf[=flag] 0 no matrix decoding (default) ==== =================================== -equalizer=[g1:g2:g3:...:g10] - 10 octave band graphic equalizer, implemented using 10 IIR band pass +``equalizer=[g1:g2:g3:...:g10]`` + 10 octave band graphic equalizer, implemented using 10 IIR band-pass filters. This means that it works regardless of what type of audio is being played back. The center frequencies for the 10 bands are: @@ -169,48 +164,50 @@ equalizer=[g1:g2:g3:...:g10] bug with this filter is that the characteristics for the uppermost band are not completely symmetric if the sample rate is close to the center frequency of that band. This problem can be worked around by upsampling - the sound using the resample filter before it reaches this filter. + the sound using a resampling filter before it reaches this filter. - :::...: + ``:::...:`` floating point numbers representing the gain in dB for each frequency band (-12-12) - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi`` - Would amplify the sound in the upper and lower frequency region while - canceling it almost completely around 1kHz. + ``mpv --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi`` + Would amplify the sound in the upper and lower frequency region + while canceling it almost completely around 1kHz. -channels=nch[:nr:from1:to1:from2:to2:from3:to3:...] +``channels=nch[:nr:from1:to1:from2:to2:from3:to3:...]`` Can be used for adding, removing, routing and copying audio channels. If - only is given the default routing is used, it works as follows: If - the number of output channels is bigger than the number of input channels - empty channels are inserted (except mixing from mono to stereo, then the - mono channel is repeated in both of the output channels). If the number of - output channels is smaller than the number of input channels the exceeding + only ```` is given, the default routing is used. It works as follows: + If the number of output channels is greater than the number of input + channels, empty channels are inserted (except when mixing from mono to + stereo; then the mono channel is duplicated). If the number of output + channels is less than the number of input channels, the exceeding channels are truncated. - + ```` number of output channels (1-8) - + ```` number of routes (1-8) - + ```` Pairs of numbers between 0 and 7 that define where to route each channel. - *EXAMPLE*: + .. admonition:: Examples - ``mpv --af=channels=4:4:0:1:1:0:2:2:3:3 media.avi`` - Would change the number of channels to 4 and set up 4 routes that swap - channel 0 and channel 1 and leave channel 2 and 3 intact. Observe that - if media containing two channels was played back, channels 2 and 3 - would contain silence but 0 and 1 would still be swapped. + ``mpv --af=channels=4:4:0:1:1:0:2:2:3:3 media.avi`` + Would change the number of channels to 4 and set up 4 routes that + swap channel 0 and channel 1 and leave channel 2 and 3 intact. + Observe that if media containing two channels were played back, + channels 2 and 3 would contain silence but 0 and 1 would still be + swapped. - ``mpv --af=channels=6:4:0:0:0:1:0:2:0:3 media.avi`` - Would change the number of channels to 6 and set up 4 routes that copy - channel 0 to channels 0 to 3. Channel 4 and 5 will contain silence. + ``mpv --af=channels=6:4:0:0:0:1:0:2:0:3 media.avi`` + Would change the number of channels to 6 and set up 4 routes that + copy channel 0 to channels 0 to 3. Channel 4 and 5 will contain + silence. -force=in-format:in-srate:in-channels:out-format:out-srate:out-channels +``force=in-format:in-srate:in-channels:out-format:out-srate:out-channels`` Force a specific audio format/configuration without actually changing the audio data. Keep in mind that the filter system might auto-insert actual conversion filters before or after this filter if needed. @@ -220,49 +217,43 @@ force=in-format:in-srate:in-channels:out-format:out-srate:out-channels actually doing a conversion. The data will be 'reinterpreted' by the filters or audio outputs following this filter. - + ```` Force conversion to this format. See ``format`` filter for valid audio format values. - + ```` Force conversion to a specific sample rate. The rate is an integer, 48000 for example. - + ```` Force mixing to a specific channel layout. See ``--channels`` option for possible values. - + ```` - + ```` - + ```` -format[=format] +``format[=format]`` Convert between different sample formats. Automatically enabled when - needed by the sound card or another filter. See also ``--format``. + needed by the audio output or another filter. See also ``--format``. - + ```` Sets the desired format. The general form is 'sbe', where 's' denotes the sign (either 's' for signed or 'u' for unsigned), 'b' denotes the number of bits per sample (16, 24 or 32) and 'e' denotes the endianness ('le' means little-endian, 'be' big-endian and 'ne' the - endianness of the computer mpv is running on). Valid values - (amongst others) are: 's16le', 'u32be' and 'u24ne'. Exceptions to this - rule that are also valid format specifiers: u8, s8, floatle, floatbe, - floatne, mpeg2, and ac3. + endianness of the computer mpv is running on). Valid values (amongst + others) are: 's16le', 'u32be' and 'u24ne'. Exceptions to this rule that + are also valid format specifiers: u8, s8, floatle, floatbe, floatne, + mpeg2, and ac3. -volume[=v[:sc[:fast]]] +``volume[=v[:sc[:fast]]]`` Implements software volume control. Use this filter with caution since it can reduce the signal to noise ratio of the sound. In most cases it is - best to set the level for the PCM sound to max, leave this filter out and - control the output level to your speakers with the master volume control - of the mixer. In case your sound card has a digital PCM mixer instead of - an analog one, and you hear distortion, use the MASTER mixer instead. If - there is an external amplifier connected to the computer (this is almost - always the case), the noise level can be minimized by adjusting the master - level and the volume knob on the amplifier until the hissing noise in the - background is gone. + best to use the *Master* volume control of your sound card or the volume + knob on your amplifier. This filter has a second feature: It measures the overall maximum sound level and prints out that level when mpv exits. This feature currently @@ -271,128 +262,131 @@ volume[=v[:sc[:fast]]] *NOTE*: This filter is not reentrant and can therefore only be enabled once for every audio stream. - + ```` Sets the desired gain in dB for all channels in the stream from -200dB to +60dB, where -200dB mutes the sound completely and +60dB equals a gain of 1000 (default: 0). - + ```` Turns soft clipping on (1) or off (0). Soft-clipping can make the sound more smooth if very high volume levels are used. Enable this option if the dynamic range of the loudspeakers is very low. *WARNING*: This feature creates distortion and should be considered a last resort. - + ```` Force S16 sample format if set to 1. Lower quality, but might be faster in some situations. - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=volume=10.1:0 media.avi`` - Would amplify the sound by 10.1dB and hard-clip if the sound level is - too high. + ``mpv --af=volume=10.1:0 media.avi`` + Would amplify the sound by 10.1dB and hard-clip if the sound level + is too high. -pan=n[:L00:L01:L02:...L10:L11:L12:...Ln0:Ln1:Ln2:...] +``pan=n[:L00:L01:L02:...L10:L11:L12:...Ln0:Ln1:Ln2:...]`` Mixes channels arbitrarily. Basically a combination of the volume and the channels filter that can be used to down-mix many channels to only a few, - e.g. stereo to mono or vary the "width" of the center speaker in a + e.g. stereo to mono, or vary the "width" of the center speaker in a surround sound system. This filter is hard to use, and will require some tinkering before the desired result is obtained. The number of options for this filter depends on the number of output channels. An example how to downmix a six-channel file to two channels with this filter can be found in the examples section near the end. - - number of output channels (1-8) - + ```` + Number of output channels (1-8). + ```` How much of input channel i is mixed into output channel j (0-1). So in principle you first have n numbers saying what to do with the first input channel, then n numbers that act on the second input channel etc. If you do not specify any numbers for some input channels, 0 is assumed. - *EXAMPLE*: + .. admonition:: Examples + + ``mpv --af=pan=1:0.5:0.5 media.avi`` + Would downmix from stereo to mono. - ``mpv --af=pan=1:0.5:0.5 media.avi`` - Would down-mix from stereo to mono. + ``mpv --af=pan=3:1:0:0.5:0:1:0.5 media.avi`` + Would give 3 channel output leaving channels 0 and 1 intact, and mix + channels 0 and 1 into output channel 2 (which could be sent to a + subwoofer for example). - ``mpv --af=pan=3:1:0:0.5:0:1:0.5 media.avi`` - Would give 3 channel output leaving channels 0 and 1 intact, and mix - channels 0 and 1 into output channel 2 (which could be sent to a - subwoofer for example). + .. note:: - *NOTE*: if you just want to force remixing to a certain output channel - layout, it's easier to use the ``force`` filter. For example, - ``mpv '--af=force=channels=5.1' '--channels=5.1'`` would always force - remixing audio to 5.1 and output it like this. + If you just want to force remixing to a certain output channel + layout, it is easier to use the ``force`` filter. For example, + ``mpv '--af=force=channels=5.1' '--channels=5.1'`` would always + force remixing audio to 5.1 and output it like this. -sub[=fc:ch] +``sub[=fc:ch]`` Adds a subwoofer channel to the audio stream. The audio data used for creating the subwoofer channel is an average of the sound in channel 0 and channel 1. The resulting sound is then low-pass filtered by a 4th order Butterworth filter with a default cutoff frequency of 60Hz and added to a separate channel in the audio stream. - *Warning*: Disable this filter when you are playing DVDs with Dolby - Digital 5.1 sound, otherwise this filter will disrupt the sound to the - subwoofer. + .. warning:: + + Disable this filter when you are playing media with an LFE channel + (e.g. 5.1 surround sound), otherwise this filter will disrupt the sound + to the subwoofer. - + ```` cutoff frequency in Hz for the low-pass filter (20Hz to 300Hz) (default: 60Hz) For the best result try setting the cutoff frequency as low as possible. This will improve the stereo or surround sound experience. - + ```` Determines the channel number in which to insert the sub-channel audio. Channel number can be between 0 and 7 (default: 5). Observe that the number of channels will automatically be increased to if necessary. - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=sub=100:4 --channels=5 media.avi`` - Would add a sub-woofer channel with a cutoff frequency of 100Hz to - output channel 4. + ``mpv --af=sub=100:4 --channels=5 media.avi`` + Would add a subwoofer channel with a cutoff frequency of 100Hz to + output channel 4. -center +``center`` Creates a center channel from the front channels. May currently be low quality as it does not implement a high-pass filter for proper extraction yet, but averages and halves the channels instead. - + ```` Determines the channel number in which to insert the center channel. Channel number can be between 0 and 7 (default: 5). Observe that the - number of channels will automatically be increased to if + number of channels will automatically be increased to ```` if necessary. -surround[=delay] - Decoder for matrix encoded surround sound like Dolby Surround. Many files - with 2 channel audio actually contain matrixed surround sound. Requires a - sound card supporting at least 4 channels. +``surround[=delay]`` + Decoder for matrix encoded surround sound like Dolby Surround. Some files + with 2-channel audio actually contain matrix encoded surround sound. - + ```` delay time in ms for the rear speakers (0 to 1000) (default: 20) This delay should be set as follows: If d1 is the distance from the listening position to the front speakers and d2 is the distance from the listening position to the rear speakers, then the delay should be set to 15ms if d1 <= d2 and to 15 + 5*(d1-d2) if d1 > d2. - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=surround=15 --channels=4 media.avi`` - Would add surround sound decoding with 15ms delay for the sound to the - rear speakers. + ``mpv --af=surround=15 --channels=4 media.avi`` + Would add surround sound decoding with 15ms delay for the sound to + the rear speakers. -delay[=ch1:ch2:...] +``delay[=ch1:ch2:...]`` Delays the sound to the loudspeakers such that the sound from the different channels arrives at the listening position simultaneously. It is only useful if you have more than 2 loudspeakers. - ch1,ch2,... + ``ch1,ch2,...`` The delay in ms that should be imposed on each channel (floating point number between 0 and 1000). - To calculate the required delay for the different channels do as follows: + To calculate the required delay for the different channels, do as follows: 1. Measure the distance to the loudspeakers in meters in relation to your listening position, giving you the distances s1 to s5 (for a 5.1 @@ -405,46 +399,47 @@ delay[=ch1:ch2:...] 3. Calculate the required delays in ms as ``d[i] = 1000*s[i]/342; i = 1...5``. - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=delay=10.5:10.5:0:0:7:0 media.avi`` - Would delay front left and right by 10.5ms, the two rear channels and - the sub by 0ms and the center channel by 7ms. + ``mpv --af=delay=10.5:10.5:0:0:7:0 media.avi`` + Would delay front left and right by 10.5ms, the two rear channels + and the subwoofer by 0ms and the center channel by 7ms. -export[=mmapped_file[:nsamples]] +``export[=mmapped_file[:nsamples]]`` Exports the incoming signal to other processes using memory mapping - (``mmap()``). Memory mapped areas contain a header: + (``mmap()``). Memory mapped areas contain a header:: - | int nch /\* number of channels \*/ - | int size /\* buffer size \*/ - | unsigned long long counter /\* Used to keep sync, updated every time new data is exported. \*/ + int nch /* number of channels */ + int size /* buffer size */ + unsigned long long counter /* Used to keep sync, updated every time + new data is exported. */ - The rest is payload (non-interleaved) 16 bit data. + The rest is payload (non-interleaved) 16-bit data. - - file to map data to (default: ``~/.mpv/mpv-af_export``) - - number of samples per channel (default: 512) + ```` + File to map data to (default: ``~/.mpv/mpv-af_export``). + ```` + number of samples per channel (default: 512). - *EXAMPLE*: + .. admonition:: Example - ``mpv --af=export=/tmp/mpv-af_export:1024 media.avi`` - Would export 1024 samples per channel to ``/tmp/mpv-af_export``. + ``mpv --af=export=/tmp/mpv-af_export:1024 media.avi`` + Would export 1024 samples per channel to ``/tmp/mpv-af_export``. -extrastereo[=mul] +``extrastereo[=mul]`` (Linearly) increases the difference between left and right channels which adds some sort of "live" effect to playback. - + ```` Sets the difference coefficient (default: 2.5). 0.0 means mono sound (average of both channels), with 1.0 sound will be unchanged, with -1.0 left and right channels will be swapped. -drc[=method:target] +``drc[=method:target]`` Applies dynamic range compression. This maximizes the volume by compressing the audio signal's dynamic range. - + ```` Sets the used method. 1 @@ -454,41 +449,46 @@ drc[=method:target] Use several samples to smooth the variations via the standard weighted mean over past samples. - + ```` Sets the target amplitude as a fraction of the maximum for the sample type (default: 0.25). - *NOTE*: This filter can cause distortion with audio signals that have a - very large dynamic range. + .. note:: -ladspa=file:label[:controls...] + This filter can cause distortion with audio signals that have a very + large dynamic range. + +``ladspa=file:label[:controls...]`` Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin. This filter is reentrant, so multiple LADSPA plugins can be used at once. - - Specifies the LADSPA plugin library file. If ``LADSPA_PATH`` is set, - it searches for the specified file. If it is not set, you must supply - a fully specified pathname. -