Page 1 of 1

high-pitch sound while streaming from tuner-tv

Posted: 26 Sep 2010 14:40
by viulian
Hello,

I'm running Ubuntu 10.4 with VLC 1.1.4 compiled manually using:
./configure --enable-shine --disable-swscale --disable-postproc --disable-a52 --disable-glx --enable-x264 --enable-pulse --enable-alsa
I am reading the audio input directly from my tv tuner board:

Code: Select all

[0x8c4130c] [Media: vlc42] access_alsa demux debug: SAA7134 (SAA7134) [0x8c4130c] [Media: vlc42] access_alsa demux debug: hw:1,0 : SAA7134 PCM (SAA7134 PCM)
My streaming configuration is:

Code: Select all

new vlc42 broadcast enabled setup vlc42 input "v4l2://" setup vlc42 option :input-slave=alsa://hw:1,0 setup vlc42 option :v4l2-width=480 setup vlc42 option :v4l2-height=384 setup vlc42 option :v4l2-standard=255 setup vlc42 option :v4l2-audio-volume=12 setup vlc42 option :no-v4l2-audio-mute setup vlc42 option :v4l2-samplerate=32000 # discovery setup vlc42 option :v4l2-tuner-frequency=133250 setup vlc42 option :v4l2-tuner-frequency=196250 setup vlc42 option http-reconnect setup vlc42 output #transcode{venc=x264,vcodec=h264,vb=800,scale=1,acodec=mp3,ab=96,channels=1,samplerate=22050}:std{access=http,mux=ts,dst=0.0.0.0:1234} control vlc42 play
The outcome is that the sound is high pitch (sounds accelerated). My TV Tuner board is known to have a high-pitch issue ( http://www.linuxtv.org/wiki/index.php/Saa7134-alsa -> Sound distorted and high-pitched ) and the recommendation is to use the rate 32KHz.
The problem is that I was not able to control this rate. It seemed that VLC always chooses to use the 'araw' decoder with 48000Hz frequency. I tried the :v4l2-samplerate option, as well as the samplerate in the transcoder, nothing:

Code: Select all

[0x8400cdc] [Media: vlc42] main generic debug: looking for decoder module: 21 candidates [0x8400cdc] [Media: vlc42] araw generic debug: samplerate:48000Hz channels:2 bits/sample:16 [0x8400cdc] [Media: vlc42] main generic debug: using decoder module "araw"
Is there a way to control this value ?

My hard coded solution was to modify the file: modules/codec/araw.c and insert the 32000 line:

Code: Select all

... if( p_dec->fmt_in.audio.i_rate <= 0 ) { msg_Err( p_dec, "bad samplerate" ); return VLC_EGENERIC; } p_dec->fmt_in.audio.i_rate = 32000; /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) return VLC_ENOMEM; ...
Now sound is working, but ...

Re: high-pitch sound while streaming from tuner-tv

Posted: 28 Sep 2010 00:20
by Jean-Baptiste Kempf
File a bug.