[FFserver-user] Simple Wav recording/streaming

Neville Bonwit nevilleb at innovativedrive.com
Tue Jul 12 20:59:14 CEST 2011


Hello,


We're trying to stream raw (pcm/wav) audio from the audio-in jack using
ffmpeg/ffserver.  We also need to record the audio to a local file in wav
format.

 

Our ffserver.conf file is below.  For streaming-only, the Launch line is
like this:

Launch ffmpeg -f alsa -acodec pcm_s16le -ac 2 -ar 48000 -ab 1536k -i hw:0,0

 

When I add the local file to the end of the Launch line like this:

Launch ffmpeg -f alsa -acodec pcm_s16le -ac 2 -ar 48000 -ab 1536k -i hw:0,0
/home/root/audio/myaudio.wav

then streaming continues to work and the wav file is created and can be
transferred to WinXP and played on VLC without problems.

However Sound Recorder (sndrec32.exe) gives the following error: "The file
'.\myaudio.wav' is not a valid WAVE sound file"

 

When I kill ffserver and just run ffmpeg from the command line like this:

ffmpeg -f alsa -acodec pcm_s16le -ac 2 -ar 48000 -ab 1536k -i hw:0,0
/home/root/audio/myaudio.wav

then the wav file is created and can be played on both VLC and sndrec32.exe
without any problems.

 

I tried running ffmpeg as a separate process to generate the local wav file
after ffserver was running, but it said: "cannot open audio device hw:0,0
(Device or resource busy)"

 

I have 2 questions:

1)      Is ffserver.conf configured correctly for streaming a wav file?

2)       How can I also create the local wav file simultaneously while
streaming?

 

Many thanks,

Neville

 

---------------ffserver.conf--------------------------------

# Port on which the server is listening. You must select a different

# port from your standard HTTP web server if it is running on the same

# computer.

Port 8080

 

# Address on which the server is bound. Only useful if you have

# several network interfaces.

BindAddress 0.0.0.0

 

# Number of simultaneous HTTP connections that can be handled. It has

# to be defined *before* the MaxClients parameter, since it defines the

# MaxClients maximum limit.

MaxHTTPConnections 2000

 

# Number of simultaneous requests that can be handled. Since FFServer

# is very fast, it is more likely that you will want to leave this high

# and use MaxBandwidth, below.

MaxClients 1000

 

# This the maximum amount of kbit/sec that you are prepared to

# consume when streaming to clients.

MaxBandwidth 1000

 

# Access log file (uses standard Apache log file format)

# '-' is the standard output.

CustomLog -

 

# Suppress that if you want to launch ffserver as a daemon.

#NoDaemon

 

 

##################################################################

# Definition of the live feeds. 

 

<Feed feed1.ffm>

 

# ffserver can also do time shifting. It means that it can stream any

# previously recorded live stream. The request should contain:

# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify

# a path where the feed is stored on disk. You also specify the

# maximum size of the feed, where zero means unlimited. Default:

# File=/tmp/feed_name.ffm FileMaxSize=5M

File /tmp/feed1.ffm

FileMaxSize 200K

 

# Specify launch in order to start ffmpeg automatically.

# First ffmpeg must be defined with an appropriate path if needed,

# after that options can follow, but avoid adding the http:// field

Launch ffmpeg -f alsa -acodec pcm_s16le -ac 2 -ar 48000 -ab 1536k -i hw:0,0

 

</Feed>

 

 

##################################################################

# Now you can define each stream which will be generated from the

# original audio and video stream. Each format has a filename (here

# 'test1.mpg'). FFServer will send this stream when answering a

# request containing this filename.

 

# WAV compatible

 

<Stream test.wav>

Feed feed1.ffm

Format wav

AudioCodec pcm_s16le

AudioChannels 2

AudioBitRate 1536

AudioSampleRate 48000

NoVideo

StartSendOnKey

</Stream>

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/ffserver-user/attachments/20110712/5d6ed419/attachment.html>


More information about the ffserver-user mailing list