mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.5k stars 2.92k forks source link

http://twit.am/listen plays with distortions #1625

Closed yurivict closed 9 years ago

yurivict commented 9 years ago

Here is a log:

$ mpv http://twit.am/listen
Playing: http://twit.am/listen
[ytdl_hook] youtube-dl not found, not executable, or broken. 
 (+) Audio --aid=1 (mp3)
File tags:
 icy-title: 
AO: [pulse] 32000Hz mono 1ch s16
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
A: 00:00:00 Cache:  2s+34KB

vlc plays it fine. mpv-0.8.0

ghost commented 9 years ago

Can't reproduce. Sounds fine here. What version etc.?

yurivict commented 9 years ago

OS is FreeBSD-10.1 Versions of mpv and dependencies:

mpv-0.8.0,1: libXxf86vm-1.1.3_2 libXv-1.0.10_2,1 libX11-1.6.2_2,1 pango-1.36.8 libdvdread-5.0.2 libdvdnav-5.0.3 libass-0.11.2_3 ffmpeg-2.3.6,1 lua52-5.2.3_4 gtk-update-icon-cache-2.24.25 gdk-pixbuf2-2.31.2_1 glib-2.42.1 desktop-file-utils-0.22_3 pulseaudio-5.0_3 atk-2.14.0

mplayer also plays it fine.

ghost commented 9 years ago

What AO does mplayer use? Try different AOs.

yurivict commented 9 years ago

It works fine in mplayer with AOs: oss, pulse, sdl. It fails in mpv with pulse, and works fine with oss. (only these two are available)

You probably use linux, and ao=alsa?

ghost commented 9 years ago

Can you post a log with -v with mplayer and mpv? Also, if you use --ao=pcm, and then play the resulting audiodump.wav file (with a player that "works"), does the result sound correct?

mc4man commented 9 years ago

By & large the site or a .mp3 downloaded plays like crap in mpv & a lot of other players and or browsers FF - bad, google-chrome - good, epiphany - bad, ubuntu's browser - good The only players that play stream or file good are vlc & to some extent mplayer

For mpv adding option --audio-channels=2 fixes both stream & file

ghost commented 9 years ago

Oh, so mono output is broken on his system? Why does it happen to you too, mc4man? Is it a pulse issue?

mc4man commented 9 years ago

You got me - it's hard to get away from pulse if using, an ao of alsa is i believe an Alsa plugin to pulse As far as mplayer no matter what ao or -channel option it always shows - [AO SDL] Samplerate: 32000Hz Channels: Stereo Format s16le AO: [sdl] 32000Hz 2ch s16le (2 bytes per sample) or AO: [pulse] 32000Hz 2ch s16le (2 bytes per sample) AO: [alsa] 32000Hz 2ch s16le (2 bytes per sample)

vlc shows - mad audio converter debug: mpga->f32l, bits per sample: 32 [00007fe38c005e28] core audio converter debug: using audio converter module "mad" [0000000001036d08] core audio output debug: conversion pipeline complete [0000000001036d08] core audio output debug: conversion: 'f32l'->'f32l' 32000 Hz->32000 Hz Mono->Mono [0000000001036d08] core audio output debug: conversion pipeline complete

Noting that most other players give crap on stream or file inc. ffplay & avplay

ghost commented 9 years ago

Tried it myself, I get AO: [pulse] 32000Hz mono 1ch s16, and it seems to sound the same in vlc. Also the same in mpv with alsa. But I can't really tell if it sounds like it's supposed to (all I hear is an annoying voice talking too fast).

So, of what nature is the distortion?

give crap on stream or file

What does this even mean?

mc4man commented 9 years ago

Doesn't seem to be anything about -ao here or mono per se as many mono file play ok with mpv, ect. Grabbing a couple of mp3 mono samples the 1st. is ok, the 2nd distorted unless 2 channel is specified -

mpv '/home/doug/Music/NeroSmartTrax_test2_MPEG1_Mono_CBR_64kbps_44100Hz.mp3' Playing: /home/doug/Music/NeroSmartTrax_test2_MPEG1_Mono_CBR_64kbps_44100Hz.mp3 [ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate (+) Audio --aid=1 (mp3) File tags: Genre: Blues AO: [pulse] 44100Hz mono 1ch s16 A: 00:00:05 / 00:07:28 (1%) Exiting... (Quit)

doug@doug-Lenovo-IdeaPad-Y510P:~$ mpv '/home/doug/Music/test_32000Hz_256bit.mp3' Playing: /home/doug/Music/test_32000Hz_256bit.mp3 [ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate (+) Audio --aid=1 (mp3) File tags: Artist: Frank Album: MP3 Genre: Blues Title: SV&V Carrier AO: [pulse] 32000Hz mono 1ch s16 A: 00:00:05 / 00:00:05 (94%) Exiting... (End of file)

Seems distortion is 'based' on Sampling rate, 32.0 KHz being a problem (and not just mpv's

mc4man commented 9 years ago

What does crap mean? - here is a recording, 1st. 20 sec mpv playing the twit url with defaults, then quit & restarted mpv with 2 channel option http://www.datafilehost.com/d/f3795b26

mc4man commented 9 years ago

Figured it out for here & was pulse. If the resample-method = src-sinc-best-quality then issues with these files with most players, some browsers. If set to resample-method = speex-float-1 then they are ok for all

ghost commented 9 years ago

Listened to the sample - yes, this sounds very bad. I didn't hear anything like this in my tests.

Figured it out for here & was pulse. If the resample-method = src-sinc-best-quality then issues with these files with most players, some browsers.

So why did it work for some programs, and some not? vlc and mpv output the same sample rate here.

mc4man commented 9 years ago

What pulse does as far as resampling is a mystery to me. My current setup, laptop > to a half decent HK bluetooth speaker sounds better in general with src-sinc-best-quality in /etc/pulse/daemon.conf A verbose paste of vlc, mplayer, mpv playing the url http://paste.ubuntu.com/10392283/

ghost commented 9 years ago

I don't see anything.

Here's a stab in the dark: http://sprunge.us/LVKO Does this change anything?

mc4man commented 9 years ago

The ao_pulse.c change didn't do anything. Here it's seems to just show on mono audio that's not 41000 & when using a src-sinc* resample-method in pulse & mpv isn't using 2 channel (what does af=channel do if no =# is specified?

ghost commented 9 years ago

So I take it it's simply a pulse issue.

yurivict commented 9 years ago

So, why does mplayer and vlc play it fine then through pulseaudio?

ghost commented 9 years ago

So, why does mplayer and vlc play it fine then through pulseaudio?

mplayer seemed to output stereo, not mono, and maybe this is what breaks pulse.

yurivict commented 9 years ago

mplayer says it is mono: AO: [pulse] 32000Hz 1ch floatle (4 bytes per sample)

ghost commented 9 years ago

AO: [pulse] 32000Hz 1ch floatle (4 bytes per sample)

mpv was outputting s16 and not float in this situation, so the format is still different.