[Ffmpeg-devel] using ffmpeg to encode an internet stream

Cyrus Adkisson lists
Wed Sep 21 08:16:33 CEST 2005


Finally solved this problem:

"mplayer -ao oss:/dev/audio URL" to listen to a stream
"mplayer -ao pcm:file=test.wav URL" to record a file (must be ctrl-c'd 
to stop it)
"mplayer -ao pcm:file=timedtest.wav URL -frames XXXX" to record a file a 
certain length

I found that you could figure out approximately how many frames are in a 
minute for each stream (each stream is different... has to do with the 
sampling rate) and and then do the math to figure out how many frames 
for however long a segment you want to record. So, if you want to record 
some specific radio program when you're not going to be home, use the 
last command.

You can rig up a small script to automatically use ffmpeg to turn the 
resulting wav files into mp3, ogg, or whatever and then delete the bulky 
wav file. It's working pretty well for me that way. I've even got ffmpeg 
adding a still JPEG as a video track to the mp3s to display the program 
information while the audio plays.

Cyrus


Cyrus Adkisson wrote:

> Yeah I'm able to listen to both stream with mplayer. I can't get 
> mencoder to work, though. Is there a way to pipe the mplayer output 
> into ffmpeg and code it down into an mp3 instead of sending it out the 
> speakers?
>
> (Sorry for my ignorance on this stuff. I deal mostly with high level 
> web apps and only get into the nitty-gritty when I need to. Cheers to 
> everyone who works hard on the bits and bytes of ffmpeg and mplayer.)
>
> Cyrus
>
> Benjamin Larsson wrote:
>
>> Hi,
>>
>> Cyrus Adkisson wrote:
>>
>>> I'm still at a loss here. Can someone who is more experienced with 
>>> ffmpeg help me figure out the correct command-line for what I'm 
>>> trying to accomplish?
>>>
>>> The two streams I want to capture are 
>>> http://mmslb.eonstreams.com/wbalam?MSWMExt=.asf and 
>>> http://audio.wtopnews.com/stream/real/wtopnews.smil .
>>>
>>> My best attempt at the first one failed:
>>> >>>>>>>>>>>>>>
>>> [cyrus at laptop ~]$ ffmpeg -f asf -i 
>>> http://mmslb.eonstreams.com/wbalam?MSWMExt=.asf -y -vn -acodec mp3 
>>> outfile.mp3
>>> ffmpeg version CVS, build 3211266, Copyright (c) 2000-2004 Fabrice 
>>> Bellard
>>>  configuration:  --enable-mp3lame --enable-shared --cpu=x86
>>>  built on Aug 30 2005 22:41:50, gcc: 3.4.4 20050721 (Red Hat 3.4.4-2)
>>> http://mmslb.eonstreams.com/wbalam?MSWMExt=.asf: Error while opening 
>>> file
>>> >>>>>>>>>>>>>>>>>>
>>>
>> the first stream I think ffmpeg is not clever enough to follow the 
>> redirection file that the address really is, mplayer could stream
>> it without any problem.
>>
>>> as did my attempt at the second:
>>> >>>>>>>>>>>>>>>>>>
>>> [cyrus at laptop ~]$ ffmpeg -f rm -i 
>>> http://audio.wtopnews.com/stream/real/prerolls/real_audio/wtop.rm -y 
>>> -vn -acodec mp3 outfile.mp3
>>> ffmpeg version CVS, build 3211266, Copyright (c) 2000-2004 Fabrice 
>>> Bellard
>>>  configuration:  --enable-mp3lame --enable-shared --cpu=x86
>>>  built on Aug 30 2005 22:41:50, gcc: 3.4.4 20050721 (Red Hat 3.4.4-2)
>>> [NULL @ 0xb7e33150]Unsupported video codec
>>> Input #0, rm, from 
>>> 'http://audio.wtopnews.com/stream/real/prerolls/real_audio/wtop.rm':
>>>  Duration: 00:00:03.8, start: 0.000000, bitrate: N/A
>>>  Stream #0.0: Audio: sipr, 16000 Hz, mono, 16 kb/s
>>>  Stream #0.1: Data: 0x0000
>>> Output #0, mp3, to 'outfile.mp3':
>>>  Stream #0.0: Audio: mp3, 16000 Hz, mono, 64 kb/s
>>> Stream mapping:
>>>  Stream #0.0 -> #0.0
>>> Unsupported codec (id=0) for input stream #0.0
>>> >>>>>>>>>>>>>>
>>>
>> This one is abit trickier, even if ffmpeg is capable enough to stream 
>> it correcly there is no support for the sipr codec. Mplayer was capable
>> to stream it though.
>>
>>> Can anyone capture these streams successfully?
>>>
>> I guess I could just not with mplayer.
>>
>>> Cyrus
>>>
>>
>> MvH
>> Benjamin Larsson
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at mplayerhq.hu
>> http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>
>>
>>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
>
>





More information about the ffmpeg-devel mailing list