Monday, October 03, 2022

Re: xine's ffmpegaudio doesn't downmix, sio_getpar() reports 6 channels instead of 2

On Mon, Oct 03, 2022 at 09:26:31AM +0200, Alexandre Ratchov wrote:
> On Thu, Sep 22, 2022 at 04:31:58PM +0000, adr wrote:
> > Hi,
> >
> > first of all, I've never contributed to the xine project, and
> > I don't have any experience with sndio, so bear with me...
> >
> > Frustrated with the bad sound playing a 6 channels aac audio I decided to
> > take a look. The device is a usb one:
> >
> > $ dmesg | grep -i audio
> > uaudio0 at uhub2 port 3 configuration 1 interface 1 "GeneralPlus USB Audio Device" rev 1.10/1.00 addr 6
> > uaudio0: class v1, full-speed, sync, channels: 2 play, 1 rec, 8 ctls
> > audio0 at uaudio0
> > uhidev2 at uhub2 port 3 configuration 1 interface 3 "GeneralPlus USB Audio Device" rev 1.10/1.00 addr 6
> >
> > It has only 2 channels for playback.
> >
> > The file has 5.1 aac audio:
> > $ ffprobe file.mp4
> > [...]
> > Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 224 kb/s (default)
> > [...]
> >
> > Xine's ffmpegaudio plugin is supposed to do downmix (please, correct
> > me if I'm wrong), but:
> >
> > $ xine --verbose=2 file.mp4
> > [...]
> > audio_out: ao_open (0x585415540)
> > audio_sndio_out: ao_sndio_open bits=16 rate=48000, mode=128
> > audio_sndio_out: ao_sndio_open 6 channels output
> > [...]
> >
> > The code in xine-lib-1.2.12/src/audio_out/audio_sndio_out.c by Brad
> > Smith is following the recommendations at sio_open(3), there is no
> > problem there.
> >
> > sio_getpar() is returning 6 channels as valid, so the sound ends
> > messed up. The right speaker gets mostly ambient sound and the
> > voices are almost only audible through the left speaker.
> >
> > mplayer and mpv have means to force downmix, but xine is the only
> > media player which can play 1080p h264 video with a decent performance
> > (if the bitrate is not too high) on an rpi4 (no hardware acceleration,
> > cpu at 2.2Gz)
> >
> > One workaround for this particular case could be adding the
> > configuration setting "audio.output.speaker_arrangement" to
> > audio_sndio_out.c.
> >
> > I'm using the last snapshot:
> >
> > $ doas sysupgrade -ns
> > Fetching from https://ftp.OpenBSD.org/pub/OpenBSD/snapshots/arm64/
> > SHA256.sig 100% |************************************************| 1544
> > 00:00 Signature Verified
> > Already on latest snapshot.
> >
> > base72.tgz 21-Sep-2022 11:41 262659517
> >
> > Is this behaviour normal and I'm just missing something?
> > Some thoughts?
>
> Hi,
>
> This is a known problem. While mpv and mplayer have options to turn
> the downmixing, it's not OK this to be manual.
???

Cannot parse.
If you cannot write this in english, please say what's going on in french.

> IMHO, the most appropriate (and probably simplest) is to extend sndiod
> to do the surround conversions, so the problem would be solved at
> system level and all players would benefit (as we do for all other
> conversions, btw). Less code, less bugs.

As far as I know, we still need to address liba52 levels.
Last time I checked, nobody but aja and I were concerned, and we couldn't
figure out (on most AC3 videos, sndio levels are 100% subpar).

Also, I'm questionning where master.level=1.00 makes sense. In many many cases
the application doesn't do more, but sndio could (possibly) boost to 200% and
be fine.

Moonshot: I was promised a land where sndio would take over audio(4) and where
I could get hardware AC3 through sndio. I have an USB sndcard that should
deliver this.

How far away are we from the promise ?

I couldn't care less about "real time" mixing. I really want surround sound
on video...

No comments:

Post a Comment