To directly stream a selected live programme in all OSes (except Win32) you can use:

get_iplayer --stream 80001 --player='mplayer -cache 256 -'

Where –player can refer to any player command than can play programmes from STDIN. Or simply use:

get_iplayer --stream 80001 | mplayer -cache 256 -

The advantage of the –player option is that it can be saved in your default options as follows:

get_iplayer --prefs-add --player='mplayer -cache 256 -'

Then you can just stream via mplayer using:

get_iplayer --stream 80001

( –stream is just a synonym for –stdout –nowrite )

To record a live stream use:

get_iplayer --get 80001

Specifying modes has changed a little. –amode has become –radiomode and –vmode is now –tvmode. Additionally, –modes=<modelist> can be used to set a general default set of modes for all programme types.

The only major thing I’ve not been able to get working is direct streamed playback under native Windows. If anyone knows why it won’t work or has a fix or workaround please let me know! I’ve tried with ‘vlc -‘, ‘ffplay -‘ and ‘mplayer -‘ and all seem to just fail.

21 Comments

On June 27th, 2009, fangfufu said:

In Win32, software aren’t aware of stdout? Have you tried to use the cygwin version of ffplay, vlc and mplayer?

What I tried to do was to save the stream, after the file grows big enough, open the file that is being written using vlc. With TV stream, audio works perfectly, but the video stream is slightly dodgy.

The problem is probably that you’re using cmd.exe. Windows CMD uses redirection into and out of temporary files to implement pipes rather than “live” pipes via dup2() on file descriptors, so get_iplayer must exit before mplayer receives the stream.

For what it’s worth, it works perfectly under Cygwin bash running Cygwin perl and a Cygwin rtmpdump binary, with native (non-Cygwin) mplayer.

OK, now I’ve found and fixed the problem. The authstring was missed off the rtmp request after I deprecated the -auth option to flvstreamer a while back. I’ve fixed this now in get_iplayer v2.05 out soon. Thanks for the report.

I’m trying to run this on a chumby, with ffmpeg and flvstreamer compiled for ARM, to get the AAC streams for live radio. But flvstreamer doesn’t seem to work correctly. The command line I’ve tried:
—
./get_iplayer \
–verbose \
–type=liveradio \
–radiomode=flashaac \
–flvstreamer /mnt/usb/flvstreamer \
–ffmpeg /mnt/usb/ffmpeg \
–get 80135
—
And the output (which takes a while: perl on a Chumby takes ages to compile get_iplayer):
—
get_iplayer v2.06, Copyright (C) 2009 Phil Lewis
This program comes with ABSOLUTELY NO WARRANTY; for details use –warranty.
This is free software, and you are welcome to redistribute it under certain
conditions; use –conditions for details.

Note that there is a pause directly after the output of this line; after the pause the logging continues:
—
DEBUG: sending ping. type: 0x0007
—
The next lines of logging may hold the key:
—
DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
ERROR: ReadPacket, failed to read RTMP packet header
—

I compiled the chumby version using make -f MakefileARM. The socket error 11 is EAGAIN, which I think translates roughly to ‘no data yet; try another time and you might get something’. I bodged up a little loop in the routine in question to retry on getting an 11 back, to no avail:
—
bool CRTMP::FillBuffer()
{
assert(m_nBufferSize == 0); // only fill buffer when it’s empty

I managed to get flvstreamer working on the QNAP Nas which runs on the ARM processor, am currently still having an issue with regards ffmpeg, but i just need to comiple that correctly.

The biggest issues i came across was getting the library versions correct, once this happened i compiled it on my windows machine with a cross compiler and then just moved the file across onto the nas and it worked.