[MPlayer-users] Cannot record audio from tv tuner.
Marc MERLIN
marc_mplayer at merlins.org
Tue Aug 12 21:13:43 CEST 2014
First, I forgot to mention that xawtv can get audio from this card, simply
with
legolas:~$ xawtv -noxv -capture overlay -c /dev/video1
This is xawtv-3.103, running on Linux/x86_64
(3.16.0-amd64-i915-preempt-20140714)
xinerama 0: 2880x1620+0+0
Alsa devices: cap: hw:2,0 (/dev/video1), out: default
I do get some of those:
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
and at the end:
ioctl: VIDIOC_S_FMT(type=VIDEO_CAPTURE;fmt.pix.width=384;fmt.pix.height=288;fmt.pix.pixelformat=0x34524742 [BGR4];fmt.pix.field=ANY;fmt.pix.bytesperline=0;fmt.pix.sizeimage=331776;fmt.pix.colorspace=SMPTE170M;fmt.pix.priv=0): Invalid argument
But sound comes out of xawtv.
If you skip to the end, I show mencoder -v -v output of what it thinks my
hw:2,0 device can do before it crashes into a
v4l2: select timeout
loop and hoses the USB driver.
On Tue, Aug 12, 2014 at 06:33:42PM +0100, Andy Furniss wrote:
> It's many years since I ripped from tape but to get 422 from my card I
> used planar outfmt=yuy2.
>
> The only reason I used 422 was that I wanted to use dv50 as an
> intermediate format (it was the best my PC at the time could do).
>
> I don't think PAL is 422 to start with - so if you don't have a specific
> need it would easier to ask the card for 420 eg, yv12.
>
> There should be a way to query the card/v4l2 for supported formats like
> v4linfo - maybe mplayer/mencoder with -v will give extra info (maybe not
> - it was years ago).
Thanks for pointing out v4l-info. It says:
video capture
VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
index : 0
type : VIDEO_CAPTURE
flags : 0
description : "16bpp YUY2, 4:2:2, packed"
pixelformat : 0x56595559 [YUYV]
VIDIOC_G_FMT(VIDEO_CAPTURE)
type : VIDEO_CAPTURE
fmt.pix.width : 720
fmt.pix.height : 576
fmt.pix.pixelformat : 0x56595559 [YUYV]
fmt.pix.field : INTERLACED
fmt.pix.bytesperline : 1440
fmt.pix.sizeimage : 829440
fmt.pix.colorspace : SMPTE170M
fmt.pix.priv : 0
> Using 422 for interlaced content can result in extra scope for errors
> when converted to 420.
Per your suggestions, I've switched from outfmt=uyvy to outfmt=yuy2
I'm not sure i fI see a difference, but I guess that can't hurt :)
On Tue, Aug 12, 2014 at 07:57:52PM +0200, Reimar Döffinger wrote:
> > mp3lame -lameopts cbr:br=128 -fps 25 -o test.avi -tv
> > driver=v4l2:norm=PAL:width=720:height=576:outfmt=uyvy:device=/dev/video1:input=0:fps=25:alsa:amode=1:forcechan=2:audiorate=48000:forceaudio:immediatemode=0:adevice=hw.2,0 <===
>
> Don't have anything to test, but the lack of messages in the first case means you got the correct syntax.
> I do not know where the not recognized/supported messages comes from then afterwards.
I was going to reply to you a 2nd time to say the same thing :)
My testing is getting harder because if I give the wrong params to the card,
I need to actually reboot linux to fully recover, or it'll fail in weird way
(unloading the USB driver is often not enough or causes linux to hang).
adevice=hw.1,0 works and records from the wrong source (my laptop)
Switching to my tuner card with (full options):
alsa:amode=1:forcechan=2:audiorate=48000:forceaudio:immediatemode=0:adevice=hw.2,0
gives
MP3 audio selected.
Forcing audio preload to 0, max pts correction to 0.
Pos: 0.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
v4l2: select timeout
v4l2: select timeout
v4l2: select timeout
This is the device:
card 2: Cx231xxAudio [Cx231xx Audio], device 0: Cx231xx Audio [Conexant cx231xx Capture]
Subdevices: 0/1
Subdevice #0: subdevice #0
12: [ 2] : control
13: [ 2- 0]: digital audio capture
So there must be a driver bug since this also causes the v4l api to crash and /dev/video1
to go away, but xawtv can play should from
Alsa devices: cap: hw:2,0
My guess is that it tries to get the wrong audio format.
legolas:~$ arecord --dump-hw-params hw:2,0 >/dev/null
Recording WAVE 'hw:2,0' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "default":
--------------------
ACCESS: RW_INTERLEAVED
FORMAT: U8 S16_LE S16_BE S32_LE S32_BE FLOAT_LE FLOAT_BE MU_LAW A_LAW
SUBFORMAT: STD
SAMPLE_BITS: [8 32]
FRAME_BITS: [8 1024]
CHANNELS: [1 32]
RATE: [1 192000]
PERIOD_TIME: (5 4294967295)
PERIOD_SIZE: [1 1398102)
PERIOD_BYTES: [128 1398102)
PERIODS: [3 1024]
BUFFER_TIME: (15 4294967295]
BUFFER_SIZE: [3 4194304]
BUFFER_BYTES: [384 4194304]
TICK_TIME: ALL
So, I tried
alsa:amode=0:audiorate=32000:forceaudio:immediatemode=0:adevice=hw.2,0
but that didn't work either.
Any suggestions on what audio parms I can give to be compatible with this
audio input?
mencoder -v -v says it has 2 channels and I should use 48000 apparently.
Is that correct?
So I tried
alsa:amode=1:audiorate=48000:forceaudio:immediatemode=0:adevice=hw.2,0
but that didn't help either.
-v -v info here:
Hardware PCM card 2 'Cx231xx Audio' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 48000
period_size : 3000
period_time : 62500
tstamp_mode : NONE
period_step : 1
avail_min : 3000
period_event : 0
start_threshold : 0
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
appl_ptr : 0
hw_ptr : 0
v4l2: set audio samplerate: 48000
v4l2: get audio format: 9
==> Found audio stream: 0
v4l2: get audio samplerate: 48000
v4l2: get audio samplesize: 2
v4l2: get audio channels: 2
TV audio: 2 channels, 16 bits, 48000 Hz
Audio capture - buffer 5473 blocks of 12000 bytes, skew average from 17 meas.
Using a ring buffer for maximum 8554 frames, 2670 MB total size.
Thanks,
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
More information about the MPlayer-users
mailing list