[Solved]ffmpeg - default audio doesn't exist, /dev/dsp error

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

[Solved]ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Thu Aug 29, 2013 10:36 pm

EDIT: See my third post. Finally got a command that works :)

---------- original post ----------------------------------------------
I've been searching around for a way to use a Pogoplug as a live audio streamer for a baby monitor. Basically, either using a C-media USB audio adapter or by using the microphone on a USB webcam.

I came across a post about using ffmpeg to stream audio via rtp using this command:

$this->bbcode_second_pass_quote('', 'f')fmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://localhost:1234


Then you're supposed to open up VLC to test the stream. I realize I won't be able to use VLC on the receiving Pogoplug, but I'm just trying to get the server part working first.

When I tried that ffmpeg command, I get this error:

$this->bbcode_second_pass_quote('', '
')[oss @ 0x4fd90] /dev/dsp1: No such file or directory
/dev/dsp1: Input/output error


I get this error with both the USB webcam (integrated mic) and the C-media Syba USB sound adapter.

So...poking around the web, I also found this other command from the ffmpeg wiki:

$this->bbcode_second_pass_quote('', '
')ffmpeg -f alsa -i default


Which gives me this lovely error:
$this->bbcode_second_pass_quote('', '
')[alsa @ 0x49de0] cannot open audio device default (Invalid argument)
default: Input/output error


I think the issue is that when I point ffmpeg to "/dev/dsp", that's not really where the audio input device is mounted. Is there some other /dev/xxx that I should be using?
Last edited by permitivity on Mon Sep 02, 2013 3:48 pm, edited 2 times in total.
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Fri Aug 30, 2013 12:12 am

Oh, when I do this, this is the output:

$this->bbcode_second_pass_quote('', '[')root@alarm ~]# cat /proc/asound/pcm
00-00: USB Audio : USB Audio : playback 1 : capture 1
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby moonman » Fri Aug 30, 2013 2:27 am

With the command above you are trying to use oss driver (old and is not really used anymore) and /dev/dsp which doesn't exist. Use alsa and the something like hw:0.

So it would be -f alsa -i hw:0
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Sat Aug 31, 2013 4:50 am

EDIT 2: FINALLY GOT A COMMAND THAT WORKS. SEE LATER POST.


Ok...

I've tried these lines with these results:

$this->bbcode_second_pass_quote('', '
')ffmpeg -f alsa -i hw:0 -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://localhost:1234

hw:0: Input/output error



$this->bbcode_second_pass_quote('', '
')ffmpeg -f alsa -i hw:1,0 -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://localhost:1234

cannot open audio device hw:1,0 (No such file or directory)
hw:1,0: Input/output error


$this->bbcode_second_pass_quote('', 'f')fmpeg -f alsa -i hw:0,0 -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://localhost:1234


$this->bbcode_second_pass_quote('', 'f')fmpeg -f alsa -i alsa_input.default -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://localhost:1234


I get the same input/output error on all these iterations of "hw:x" or "alsa_input.default".

When I run alsamixer and press F6 to select device, the "USB PnP Sound Device" shows up, I think that's the Syba sound adapter. I select it, and then exit out of mixer and do an "alsactl store". Not sure if that does anything, but the USB sound card does show up. I can use mpg123 to play mp3's. But haven't gotten any use out of the microphone port because I haven't been able to address it correctly.

Oh, when I run:

$this->bbcode_second_pass_quote('', 'f')fmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://244.1.2.3:1234

I get a nice even tone that I can play on VLC on another computer, so ffmpeg can rtp...just a matter of figuring out how to address the Syba USB sound adapter.

---------- edit ---------------

I tried to discover more about the hw:x command. This gives me the same screen as alsamixer command.
$this->bbcode_second_pass_quote('', 'a')lsamixer -c 0

So, the address of the "sound card" is at 0. Furthermore:

$this->bbcode_second_pass_quote('', '[')root@alarm /]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
[root@alarm /]#


$this->bbcode_second_pass_quote('', '[')root@alarm /]# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0


I think this gets me closer to how to address the USB audio input. "arecord" knows where my the C-media USB sound card sits. I can even record wave files with "arecord -D plughw:0 -r 16000 -d 10 test.wav" and play them back with "aplay test.wav".

I found more info about hw:x.x at this website:
http://superuser.com/questions/53957/wh ... ich-to-use
Last edited by permitivity on Sat Aug 31, 2013 5:37 am, edited 1 time in total.
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby moonman » Sat Aug 31, 2013 5:16 am

Have you tried 0,1 ? Device 0, subdevice 1.

EDIT. NVM, it should be 0,0. Check ffmpeg manual on how to capture
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Sat Aug 31, 2013 5:30 am

When I run "aplay -l", it tells me it's "device 0".

So, randomly pasting ffmpeg commands I see on google, I finally run into something that seems to be doing something!!!

$this->bbcode_second_pass_quote('', 'f')fmpeg -re -f alsa -i plughw:0 -ar 8000 -f mulaw -f rtp rtp://224.168.2.105:1234



But, when I try play the stream on a windows PC using VLC, I get this error message about this stream: "SDP required:
A description in SDP format is required to receive the RTP stream."

This is the output. You can see at the bottom it's doing something! I don't really understand how this command is different than the other ones I've tried.


$this->bbcode_second_pass_code('', '
[root@alarm media]# ffmpeg -re -f alsa -i plughw:0 -ar 8000 -f mulaw -f rtp rtp://224.168.2.105:1234
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 11 2013 09:58:44 with gcc 4.7.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:0':
Duration: N/A, start: 1377926710.333970, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[rtp @ 0x5b540] Cannot respect max delay: frame size = 0
Output #0, rtp, to 'rtp://224.168.2.105:1234':
Metadata:
encoder : Lavf55.12.100
Stream #0:0: Audio: pcm_mulaw, 8000 Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> pcm_mulaw)
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 224.168.2.105
t=0 0
a=tool:libavformat 55.12.100
m=audio 1234 RTP/AVP 97
b=AS:128
a=rtpmap:97 PCMU/8000/2

Press [q] to stop, [?] for help
[alsa @ 0x4fd10] ALSA buffer xrun.
size= 173kB time=00:00:10.14 bitrate= 139.3kbits/s
')
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Sat Aug 31, 2013 5:36 am

Ok, got a command that works:

$this->bbcode_second_pass_quote('', 'f')fmpeg -re -f alsa -i plughw:0 -acodec libmp3lame -ab 32k -ac 1 -f rtp rtp://224.168.2.105:1234


Plays fine from vlc when you go to media/open network stream and type in "rtp://224.168.2.105:1234".

The audio is slightly delayed and sounds terrible. But god it's taken a lot of work just to get this far :)
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby moonman » Sat Aug 31, 2013 5:44 am

bitrate 32 is what makes it sound so terrible. Reduce the sampling rate from 44.1 to say 11 or increase bitrate
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby permitivity » Sat Aug 31, 2013 7:28 am

Yup, you're right. Here's two commands using different codecs. Increased bitrate and sampling rate. On my system, it takes about 26kBps instead of the 6kBps of the old command above. I thought mp3 would need less bandwidth, but they seem about the same.

I also took out the Syba usb audio card. I was using a 3.5mm microphone on the mic jack. Lots of noise. Using the mic from a USB webcam works much better.

$this->bbcode_second_pass_quote('', '
')ffmpeg -re -f alsa -i plughw:0 -acodec mp2 -ab 192000 -ar 44100 -ac 1 -f rtp rtp://224.168.2.105:1234
ffmpeg -re -f alsa -i plughw:0 -acodec libmp3lame -ab 192000 -ar 44100 -ac 1 -f rtp rtp://224.168.2.105:1234


The mp2 seems to work a little bit better. The mp3 version sometimes has weird high pitch artifacts.

There's still a pretty loud buzzing sound when using the USB webcams. Using the webcams in a windows machine and the Logitech recording software, I don't hear nearly the same level of buzzing noise, so maybe the Logitech program filters out some of it? Or maybe the noise is just an artifact of rtp audio transmission? Now I'm looking for a way to filter it out. It's pretty low frequency, maybe there's some simple flags I can throw in there.

Edit: Woh, filters do exist. Here's the improved command with a bandpass filter to take out much of the low humming from webcam electronics.

$this->bbcode_second_pass_quote('', '
')ffmpeg -re -f alsa -i plughw:0 -acodec mp2 -ab 192000 -ar 44100 -ac 1 -filter 'bandpass=f=1000:csg=0:width_type=q:w=.806' -f rtp rtp://224.168.2.105:1234



Helps quite a bit too. Play with the variables. Even on the same model webcam, I get different responses with the same filter parameters. Running in the background, the ffmpeg process takes about 35% cpu.

More filters and explanations on this webpage:

http://ffmpeg.org/ffmpeg-filters.html#bandpass
Last edited by permitivity on Sat Aug 31, 2013 8:22 am, edited 1 time in total.
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: ffmpeg - default audio doesn't exist, /dev/dsp error

Postby moonman » Sat Aug 31, 2013 8:18 am

You actuallly need to lower sampling rate when you use low bitrate. I would also try 48 khz sampling rate since this maybe native to the hardware. Also 64 should be enough since the mic input is mono (equivalent to 128 stereo, unless your mic is stereo). How's the cpu load? Its doing realtime encoding afterall.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 3 guests