View previous topic :: View next topic |
Author |
Message |
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sat Mar 07, 2015 1:13 pm Post subject: Can mplayer use ALSA without locking it? |
|
|
Hi all.
I think I've successfully sorted all my issues with ALSA. There's only one [really small] issue that remains. I've configured mplayer for a flexible configuration as can be and it seems to work all the cases I've ever encountered. Here's my config:
/etc/mplayer/mplayer.conf: | vo = vdpau,fbdev,
fs=yes
vf=screenshot
ao=alsa:noblock:device=spdif
afm=hwac3,
slang = en,eng,fr,fre,und
sub-paths = Subtitles/
sub-fuzziness = 1
utf8=yes
alang = en,eng,fr
heartbeat-cmd = "xscreensaver-command -deactivate >/dev/null"
[protocol.dvdnav]
vc=ffmpeg12,
mouse-movements=yes
nocache=yes
[vo.vdpau]
vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,ffodivxvdpau,
vf-clr=yes
[default]
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3 |
I hence have no .asoundrc nor pulseaudio and would rather do without.
Whenever mplayer is active it locks the sound output, making it impossible for other applications to use it at the same time. But I know that ALSA is capable of mixing because when I play some music and video together with other players such as parole and Firefox (with Adobe Flash player) none of these interfere with each other and I can hear the sound of each playing in the same time. So I guess it's just a matter of configuring mplayer properly, right?
EDIT: I forgot to add that I'm using my PC's SPDIF output to feed a home cinema amplifier. I'm not using any of the analog outputs.
Can anyone shed some light on this one?
Thanks in advance for any hint or suggestion. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Last edited by VinzC on Sun Mar 08, 2015 10:43 am; edited 1 time in total |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Sat Mar 07, 2015 1:35 pm Post subject: |
|
|
I'm unsure it will help you, but i could play two mplayer and got two sounds, with the same conditions (no .asoundrc and no pulseaudio)
But my mplayer.conf is set as:
Code: | grep -v \# /etc/mplayer/mplayer.conf
[protocol.dvdnav]
[default]
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
|
So, go on with default, as it just works for me. It will light up if your config is the problem. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3131
|
Posted: Sat Mar 07, 2015 3:38 pm Post subject: |
|
|
Cheap audio stuff doesn't have hardware mixer, so if you try to play directly on the device it will not be accessible for any other process.
Fortunately you can create dmix plug which can be accessed by multiple programs, do the mixing for you and then send it to hardware. And ofcourse you can make it default. In fact, I suppose defauly config for alsa already does that.
However it is still possible that player bind to hardware directly making that software mixer useless. HAve a closer look at this line:
ao=alsa:noblock:device=spdif
You might want to try device=dmix or default, or jsut skip it completly and let it guess. |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sat Mar 07, 2015 4:10 pm Post subject: |
|
|
This is a good topic on dmix, though as you'll see it requires an asoundrc. From what Paul Bredbury says, that seems to be a requirement of getting a decent alsa setup: PaulBredbury wrote: | Users usually want ALSA to just work. Yeah, but ALSA isn't designed like that ;) It's the app & user's responsibility to use sensible settings, or go with a PCM that the user may have redefined. And if the soundcard is already open, its parameters (e.g. period_size, buffer_size) cannot be changed from whatever the opening app used. |
MDominique recommends zita-ajbridge, and I for one think jack is the way forward for the modern desktop. Note an rt-kernel is not required; in fact Michel recommends against it.
cmus looks fun though. |
|
Back to top |
|
|
EmaRsk Apprentice
Joined: 07 Sep 2004 Posts: 158 Location: Italy
|
Posted: Sat Mar 07, 2015 5:12 pm Post subject: |
|
|
For what is worth, I use JACK., with this .asoundrc:
Code: | ## ALSA JACK PCM PLUGIN
## http://jackaudio.org/faq/routing_alsa.html
## http://www.alsa-project.org/main/index.php/Asoundrc
pcm.jackplug {
type plug
slave { pcm "rawjack" }
hint { description "JACK Audio Connection Kit" }
}
pcm.rawjack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}
pcm.!default { type plug; slave { pcm "rawjack" } } |
This allows the audio from non-jack-aware applications (Firefox, in my usual use-case), to be routed to JACK. |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sun Mar 08, 2015 11:22 am Post subject: |
|
|
Well, thanks a bunch for your suggestions. I just forgot to tell that I have a digital, AC3/DTS-capable home theater amplifier connected to the SPDIF output and any sound is to get through it unless specified otherwise. I haven't used analog outputs for years with my system.
krinn wrote: | So, go on with default, as it just works for me. It will light up if your config is the problem. |
Fact is with the default I get no sound at all. It looks like I must tell mplayer to use the digital output because it doesn't seem to obey my ALSA settings (I selected «IEC958 default PCM», which all but mplayer seem to comply with). I've spent some time tuning my mplayer config file so that it plays any kind of audio and video file correctly and indifferently, which works so far. Just that mplayer locks the sound output when it comes to SPDIF. I don't think it does with the conventional analog outputs though, which is what you observe.
szatox wrote: | However it is still possible that player bind to hardware directly making that software mixer useless. HAve a closer look at this line:
ao=alsa:noblock:device=spdif
You might want to try device=dmix or default, or jsut skip it completly and let it guess. |
Already did. Just get no sound at all.
steveL wrote: | This is a good topic on dmix, though as you'll see it requires an asoundrc. From what Paul Bredbury says, that seems to be a requirement of getting a decent alsa setup: PaulBredbury wrote: | Users usually want ALSA to just work. Yeah, but ALSA isn't designed like that It's the app & user's responsibility to use sensible settings, or go with a PCM that the user may have redefined. And if the soundcard is already open, its parameters (e.g. period_size, buffer_size) cannot be changed from whatever the opening app used. |
MDominique recommends zita-ajbridge, and I for one think jack is the way forward for the modern desktop. Note an rt-kernel is not required; in fact Michel recommends against it. |
Yup, I know about Paul Bredbury's setup. I have to confess I'm completely ashamed I never understood it. In fact it's so complex to me I'm unable to select what component suits my setup or not . I have never been able to make my system work based on Paul's configuration in fact. With the bare .asoundrc I get no sound at all (IIRC). So I just gave up.
EmaRsk wrote: | For what is worth, I use JACK., with this .asoundrc: [...] |
The reason I tend to avoid .asoundrc is that I have never been able to fully understand it so as to build up a working configuration on my own. Always looked like black magic to me . _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Sun Mar 08, 2015 2:47 pm Post subject: |
|
|
It seems dmix is disable with cards that have hardware mixing, and enable on cards who lack it ; but not with spdif.
So your problem could be solve, but not without any .asoundrc file (that would let you enable dmix even for spdif).
Looks like the argument is dmix is not only a problem for RT function (any software between sound process and its output will add delays of course) but also the process decrease the sound quality ; so with spdif no dmix per default.
Well i suppose it makes sense if pro users use spdif output, but it's only valid for pro cards.
With a "basic" cards, no hardware mixer, but i don't think this kind of cards will output what pro would tag as "clear sound" too.
IMO if your card don't use hardware mixer -> don't care the loss of sound quality as the card is already probably poor with it (by poor i don't think bad, i think just "not as good as a pro would think it should be", just enable dmix.
If the lost is not acceptable for you, it's a sign using cheap/poor cards to do high quality sound is not what you should use. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sun Mar 08, 2015 3:05 pm Post subject: |
|
|
krinn wrote: | If the lost is not acceptable for you, it's a sign using cheap/poor cards to do high quality sound is not what you should use. |
I disagree with your premise. I don't think ALSA should be enforcing any kind of quality reduction based on how much a sound card costs. Doubly so when it's the case here, an all-digital path connected to an expensive receiver. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Sun Mar 08, 2015 3:57 pm Post subject: |
|
|
It's not only quality base:
You get lost of quality, delays and mixer
So the balance is not on loss of quality but also on "delay and mixer".
If you assume good cards have highest quality and also hardware mixer ; enable dmix on them would add delays and loss of quality for no good counter part.
If you assume "cheap" cards have no hardware mixer and a poorer quality ; enable dmix on them would imply add delays, loss of quality (that isn't that right anyway and the loss may not even get notice by user) but get a mixer this time.
Now i'm pretty sure alsa devs are pro sounds users (that's a bit logic), and it looks a sane choice they enable dmix for the mass and disable it for pro usage.
If you have a "cheap" card with hardware mixer and you are not using spdif (if that exist) ; no matter the loss of quality or not, you should this time disable dmix ; as default enable is not helping you.
I don't think the defaults are that shocking. I don't see what is disturb you:
- if dmix was enable with spdif most users that use spdif would need a config file to disable it
- if dmix was disable always, most users would need a config file to enable it.
What i'm sure of, like in all other case (cars, computer...) ; cheap devices generally gave poor result, you can built one with spdif it won't make sound any better, as i don't think spdif "increase" the sound quality, but prevent loss of quality, but if your card sounds bad, it's not adding an spdif that would make it sounds better.
And without being any competent to sound related activity, i don't think i'm that stupid assuming cheap device gave poor result (while still it's not totally true that costly devices may always gives better result, but generally they should). I couldn't gave you any numbers, value or reference to check as i'm not into the party, but i'm sure a pro sound user could ask you some values of the card and tell you if the card sucks or not, and for cheap cards, i don't need any expert to think they would be tag as "sucks". |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Tue Mar 17, 2015 4:09 pm Post subject: |
|
|
Guys,
I don't get the point of your discussion, to be honest. I mean I really don't understand. What I don't understand for a fact is: I get some kind of working audio mixing [through the SPD/IF output] with any audio application but mplayer (and, supposedly, all mplayer-based audio applications).
What I know is:- when I play a DTS/AC3 movie, mplayer sends raw audio data to my amplifier through the digital output, which is known as «SPDIF pass-through»;
- when I play mono or stereo audio with anything but mplayer, mixing works.
What might hint towards the issue is that I need a configuration file (i.e. /etc/mplayer/mplayer.conf) to tell mplayer to actually use the SPDIF output, while all other installed audio applications use my ALSA mixer settings (aka: use IEC958 as the default output). On that point both mplayer and mplayer2 behave alike.
Now this might not explain what I observe: why mplayer locks the audio output even when playing non DTS/AC3 audio.
Shall I file a bug by mplayer bugzilla? _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|