Stop VLC Resampling 88.2 -> 48

*nix specific usage questions
SugarShark
New Cone
New Cone
Posts: 6
Joined: 20 Apr 2012 00:32

Stop VLC Resampling 88.2 -> 48

Postby SugarShark » 27 Apr 2012 13:37

Hi,

I've been having a lot of problems in the last few days, trying to get VLC to correctly play high res FLAC (or WAV) files. My USB DAC device works fantastic with VLC, but I need bit perfect output, and anything above 44.1khz is being resampled to 48000. I have a very high end DAC in my system and really do not want the audio stream being touched..

I've spent days trying to fix this, but seem to have hit a dead end :( I was hoping anyone might be able to shed some light on how I might resovle this.

My config is as follows:

PC: HP microserver
OS: Linux Mint 11 (ubuntu 11.04 based)
Audio: USB output to Audiophilleo2
VLC versions: 2.0.1, 1.1.9
VLC Config:
- ALSA audio output (device: audiophilleo2 v1.16 SN01114)
- Use S/PDIF enabled

I did some experiments with "aplay" on the command line. I had two test WAV files: 44.wav and 88.wav. They are 44.1khz/16 and 88.2/24 respectively.

executing: aplay -l

Code: Select all

**** List of PLAYBACK Hardware Devices **** card 1: SN01114 [audiophilleo2 v1.16 SN01114], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
executing "aplay 88.wav" gave:

Code: Select all

Playing WAVE '44.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
executing "aplay 44.wav" gave:

Code: Select all

Playing WAVE '88.wav' : Signed 24 bit Little Endian in 3bytes, Rate 88200 Hz, Stereo aplay: set_params:1059: Sample format not available Available formats: - U8 - S16_LE - S16_BE - S32_LE - S32_BE - FLOAT_LE - FLOAT_BE - MU_LAW - A_LAW
Now I read that if I set ALSA to use the hardware device, it will work better. Sure enough, executing "aplay -Dhw:1,0 88.wav" gives:

Code: Select all

Playing WAVE '88.wav' : Signed 24 bit Little Endian in 3bytes, Rate 88200 Hz, Stereo
I can have confirmed that these sample rates are correct; in the above case my DAC is showing "88.2" on the display indicating the sync speed.

I read that adding a ".asoundrc" file can set the default ALSA device to be the hardware device. I created a config file with:

Code: Select all

pcm.!default { type hw card 1 } ctl.!default { type hw card 1 }
Once this is setup, I can play 88.wav from the command line with just "aplay 88.wav" (specifying hardware device no longer necessary).

OK, so far so good. I can correctly send wave files without resampling via the aplay util. So I know that the hardware and ALSA *can* support this.

In VLC, 44.1khz FLAC and WAV files are sent without resampling. I have tested DTS tracks, and feel confident that I am getting bit perfect output.

However, if I play files with 88.2 sample rate, it is ALWAYS resampled to 48000 :(

Has anyone got any ideas on what might cause this? I really want to get this working.. because VLC is such a great solution for me in other ways

Thanks a lot for any advice you can offer..

SugarShark
New Cone
New Cone
Posts: 6
Joined: 20 Apr 2012 00:32

Re: Stop VLC Resampling 88.2 -> 48

Postby SugarShark » 27 Apr 2012 13:46

output of "cat /proc/asound/SN01114/stream0" (showing all ALSA interfaces):

Code: Select all

cat /proc/asound/SN01114/stream0 Audiophilleo audiophilleo2 v1.16 SN01114 at usb-0000:02:02.0-1, high speed : USB Audio Playback: Status: Stop Interface 2 Altset 1 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 44100 Data packet interval: 1000 us Interface 2 Altset 2 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 48000 Data packet interval: 1000 us Interface 2 Altset 3 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 88200 Data packet interval: 1000 us Interface 2 Altset 4 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 96000 Data packet interval: 1000 us Interface 2 Altset 5 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 176400 Data packet interval: 1000 us Interface 2 Altset 6 Format: S24_3LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 192000 Data packet interval: 1000 us Interface 2 Altset 7 Format: S16_LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 44100 Data packet interval: 1000 us Interface 2 Altset 8 Format: S16_LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 48000 Data packet interval: 1000 us
I believe Interface 2 / Altset 3 should be used, as it supports S24_3LE at the correct sample rate.

Hmm I just noticed that Interface 2 / Altset 2 supports S24_3LE at 48000. Maybe VLC is using this ALSA interface instead of 2/3?

If this is the case.. is there any way I can stop VLC from choosing this interface when using 88.2 material?? (or disable it in ALSA config somehow?) is vlc just matching it with the first one that supports that format?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Stop VLC Resampling 88.2 -> 48

Postby Rémi Denis-Courmont » 27 Apr 2012 14:49

VLC tells you what it uses in its debug logs. Regardless, it tries to preserve the sample rate by default, unless the system refuses to do so.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

SugarShark
New Cone
New Cone
Posts: 6
Joined: 20 Apr 2012 00:32

Re: Stop VLC Resampling 88.2 -> 48

Postby SugarShark » 27 Apr 2012 15:09

Hi Remi,

thanks for getting back to me so fast.. I had a look in the logs and found this:

[0x2087370] alsa audio output warning: The rate 88200 Hz is not supported by your hardware. Using 48000 Hz instead.

This hardware most definitely does support 88.2 sample rate. On this system the "aplay" command can sync with the dac/play audio at 88.2. I have also tested it on windows OS and it works fine.

In my web searches I came across this link: http://guayadeque.org/forums/index.php? ... layback/p1. In it another person is having similar problems with another player, but there's also a mention of VLC:

Code: Select all

also, just thought that I'd mention -- I tried the 16bit and 24bit files through some other media players using "hw:0,0": -- with VLC both files were forced through "Altset 1" (interesting) -- with Clementine both files were forced through "Altset 2" (as with Guayadeque)
Maybe VLC is not using the right Altset?

really appreciate any help here.. really struggling to find a way forward :(

thanks

full log is below:

Code: Select all

[0x7f86dc010010] main input debug: `file:///home/test/88.wav' successfully opened [0x7f86dc010010] main input debug: Buffering 0% [0x7f86dc010010] main input debug: Buffering 16% [0x7f86dc010010] main input debug: Buffering 33% [0x7f86dc010010] main input debug: Buffering 50% [0x7f86dc010010] main input debug: Buffering 66% [0x7f86dc010010] main input debug: Buffering 83% [0x7f86dc010010] main input debug: Buffering 100% [0x7f86dc010010] main input debug: Stream buffering done (350 ms in 0 ms) [0x7f86dc010010] main input debug: creating aout [0x2087370] main audio output debug: looking for audio output module: 4 candidates [0x2087370] alsa audio output debug: opening ALSA device `hw:1,0' [0x2087370] alsa audio output warning: The rate 88200 Hz is not supported by your hardware. Using 48000 Hz instead. [0x2087370] main audio output debug: using audio output module "alsa" [0x2087370] main audio output debug: TIMER module_need() : 234.977 ms - Total 234.977 ms / 1 intvls (Avg 234.977 ms) [0x2087370] main audio output debug: output 's16l' 48000 Hz Stereo frame=1 samples/4 bytes [0x2087370] main audio output debug: mixer 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes [0x2087370] main audio output debug: filter(s) 'f32l'->'s16l' 48000 Hz->48000 Hz Stereo->Stereo [0x1f7ca60] main audio filter debug: looking for audio filter module: 13 candidates [0x1f7ca60] audio_format audio filter debug: f32l->s16l, bits per sample: 32->16 [0x1f7ca60] main audio filter debug: using audio filter module "audio_format" [0x1f7ca60] main audio filter debug: TIMER module_need() : 3.292 ms - Total 3.292 ms / 1 intvls (Avg 3.292 ms) [0x2087370] main audio output debug: found a filter for the whole conversion [0x1ffe090] main generic debug: looking for audio mixer module: 3 candidates [0x1ffe090] main generic debug: using audio mixer module "float32_mixer" [0x1ffe090] main generic debug: TIMER module_need() : 0.251 ms - Total 0.251 ms / 1 intvls (Avg 0.251 ms) [0x2087370] main audio output debug: input 's24l' 88200 Hz Stereo frame=1 samples/6 bytes [0x2087370] main audio output debug: filter(s) 's24l'->'f32l' 88200 Hz->88200 Hz Stereo->Stereo [0x2151d90] main audio filter debug: looking for audio filter module: 13 candidates [0x2151d90] audio_format audio filter debug: s24l->f32l, bits per sample: 24->32 [0x2151d90] main audio filter debug: using audio filter module "audio_format" [0x2151d90] main audio filter debug: TIMER module_need() : 0.083 ms - Total 0.083 ms / 1 intvls (Avg 0.083 ms) [0x2087370] main audio output debug: found a filter for the whole conversion [0x2087370] main audio output debug: filter(s) 'f32l'->'f32l' 97020 Hz->48000 Hz Stereo->Stereo [0x2152360] main audio filter debug: looking for audio filter module: 13 candidates [0x2152360] main audio filter debug: using audio filter module "ugly_resampler" [0x2152360] main audio filter debug: TIMER module_need() : 0.063 ms - Total 0.063 ms / 1 intvls (Avg 0.063 ms) [0x2087370] main audio output debug: found a filter for the whole conversion [0x20a81f0] main decoder debug: End of audio preroll [0x7f86dc010010] main input debug: Decoder buffering done in 239 ms

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Stop VLC Resampling 88.2 -> 48

Postby Rémi Denis-Courmont » 27 Apr 2012 15:26

VLC uses "hw:1,0", which you wrote in the VLC configuration (the VLC default is "default"...). And this does not look like VLC 2.0 to me.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

SugarShark
New Cone
New Cone
Posts: 6
Joined: 20 Apr 2012 00:32

Re: Stop VLC Resampling 88.2 -> 48

Postby SugarShark » 27 Apr 2012 15:39

VLC uses "hw:1,0", which you wrote in the VLC configuration (the VLC default is "default"...). And this does not look like VLC 2.0 to me.
Ahh .. you're right .. On this box i had to compile 2.0.1 from source (since 11.04 doesn't have a packaged version :(), but when i was doing my testing i was executing the wrong one.

I tested this in v 2.0.1 and everything works great!!! :D the dac is sync'ing at 88.2!

I think this was a bug in 1.1.9, because playing to hw:1,0 worked fine off the command line.. but looks like it's all sorted in 2.0.1 .. fantastic :D

thanks a lot for your help !!


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 10 guests