|
Jun 09 2009
|
After many requests I have eventually given in and added Live stream support for BBC iPlayer TV and Radio. So now you don’t need to playback TV in a browser – you can use the video player of your choice. The Radio streams are of fantastic quality especially when not played back in adobe flash player – well done BBC! The Flash AAC radio quality is between 128-192 kbps and the TV is either 512×288 or 640×360 resolution at between 512-800 kbps.
Remember that you do need a TV License to legally record or watch any Live TV streams in the UK. The Live support does require flvstreamer v1.8 or later(rtmpdump v1.6 is not as reliable with these streams). The below examples assume that the tool is in your path already. If not then add it using ‘–flvstreamer=/path/to/flvstreamer’. As a side note, rtmpdump 1.5/1.5a, albeit somewhat unreliable, will work only if you want to record the live streams or listen to Live Radio – direct TV playback does not want to work on those older versions.
Live BBC iPlayer TV
To watch BBC iPlayer TV channels via mplayer, for example, use:
get_iplayer –pid tv:bbc_one –stdout –nowrite | mplayer -cache 512 –
Or
get_iplayer –pid tv:<iPlayer Channel URL> –stdout –nowrite | mplayer -cache 512 –
Or to record a Live programme:
Where <iPlayer Channel URL> is a URL like: http://www.bbc.co.uk/iplayer/radio/bbc_radio_one or http://www.bbc.co.uk/iplayer/playlive/bbc_radio_one/
get_iplayer –pid tv:bbc_one
The ‘vmode’ used by the BBC iPlayer TV Live streams in ‘flashnormal’ so you may need to add ‘–vmode=flashnormal’ if you don’t normally have that in your vmode list.
Live BBC iPlayer Radio
To listen to BBC iPlayer Radio channels via mplayer, for example, use:
get_iplayer –pid radio:bbc_radio_one –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
Or
get_iplayer –pid radio:<iPlayer Channel URL> –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
Or to record a Live programme:
get_iplayer –pid radio:bbc_one –amode=flashaac
Please not that the recording and streaming will not stop after the end of a programme – it is perpetual.
Other Media Players
The recorded live streams will playback on any media player that can decode flv streams. So far I’ve successfully managed to get them playing back on xine, vlc and mplayer on Linux. I’ve not tried the various players on Windows or MacOSX.
I tried to playback th live TV streams directly with those players and found that both mplayer and xine were successful. I had trouble getting vlc to work without stuttering because I couldn’t figure out how to set the buffer/cache size. For xine use: ‘| xine stdin:/’.
The direct audio playback seems to work on mplayer and vlc only although vlc does result in slightly glitchy playback compared with mplayer.
Let me know below if you manage to get other media players to work.
Converting flv Streams
Convert Audio losslessly:
ffmpeg -i infile.flv -vn -acodec copy -y outfile.m4a
Convert video flv to avi losslessly:
ffmpeg -i infile.flv -vcodec copy -acodec copy -y outfile.avi
Having a problem with Ubuntu Jaunty.
mplayer gives an odd error at the end.
./get_iplayer –pid tv:bbc_radio_four –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
MPlayer 1.0rc2-4.3.3 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 3600+ (Family: 15, Model: 75, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing -.
Reading from stdin…
Cache fill: 0.00% (0 bytes) get_iplayer v1.96, 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.
Cache fill: 0.00% (0 bytes) INFO Trying to stream pid using type tv
INFO: pid not found in tv cache
Cache fill: 0.00% (0 bytes) INFO: Checking existence of default version
Cache fill: 0.00% (0 bytes) INFO: No specified modes (iphone) available for this programme with version ‘default’ (try modes: realaudio,wma)
Cache fill: 0.00% (0 bytes) ERROR: Failed to record ‘ – (bbc_radio_four)’
Cache fill: 0.00% (0 bytes)
Win32 LoadLibrary failed to load: avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll
Exiting… (End of file)
There’s a problem with the command in the article – I think it should read “–pid radio:bbc_radio_four” (ie ‘radio’ instead of ‘tv’)
Having said that, I can only get the PID “bbc_radio_one” to work – so no radio 4….
radio four needs amode changing to realaudio – then it works fine.
./get_iplayer –pid radio:bbc_radio_four –amode=realaudio –stdout –nowrite | mplayer -cache 128 –
Tried that, still no joy.
Yes, Radio4 doesn’t appear to have an AAC stream yet – this is still in the test phase at the BBC so check again some time.
Thanks. I’ve fixed that typo now.
Sorry, spoke too soon, it has just started working with realaudio stream, must have been buffering.
Yes, Radio4 doesn’t appear to have an AAC stream yet – this is still in the test phase at the BBC so check again some time.
Hi, after :-
get_iplayer –pid tv:bbc_news24 –force –vmode=flashnormal –stdout –nowrite | mplayer -cache 512 –
I get :–
DEBUG: Property:
WARNING: ignoring too small audio packet: size: 0
Cache fill: 18.75% (98304 bytes)
108.819 KBlibavformat file format detected.
707.010 KB^C
MPlayer interrupted by signal 2 in module: demux_open
What do I need for the ‘KBlibavformat’ format?
Thanks, great work!
Ref previous note, also get the same on radio:-
get_iplayer –pid radio:bbc_radio_one –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
34.408 KBl: 18.75% (24576 bytes)
41.361 KBlibavformat file format detected.
107.315 KB[flv @ 0x883f748]Unsupported audio codec (a)
164.656 KB^C
MPlayer interrupted by signal 2 in module: demux_open
Just noticed,
also get the same on working (BBC1 & BBC2),
WARNING: ignoring too small audio packet: size: 0
Cache fill: 18.75% (98304 bytes)
libavformat file format detected.
113.428 KB[lavf] Video stream found, -vid 0
[lavf] Audio stream found, -aid 1
VIDEO: [VP6F] 640×360 0bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
But they go on to stream ok.
To some it up, can’t get News24 or any Radio to stream.
I’ve tried on Jackalope and it worked OK. Maybe you need to get extra codecs from one of the other apt repos? I doubt if this codec is shipped with stock Ubuntu. Also, have a try with vlc and xine.
I have the following mplayer + codecs installed with their respective dependencies: mplayer 2:1.0~rc2-0ubuntu19, libfaac0 1.26-0.1ubuntu2, libfaad0 2.6.1-3.1, ffmpeg 3:0.svn20090303-1ubuntu6.
Hi again, I have the same mplayer + libraries.
If, for example,I run:-
get –pid radio:bbc_radio_one –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
I get –
DEBUG: Property:
WARNING: ignoring too small audio packet: size: 0
Cache fill: 18.75% (24576 bytes)
libavformat file format detected.
102.980 KB
It just sits there with the KB count increasing until I cntl D out of it & I get:-
C
MPlayer interrupted by signal 2 in module: demux_open
MPlayer interrupted by signal 2 in module: enable_cache
Caught signal: 2, cleaning up, just a second…
ERROR: ReadN, RTMP recv error 4
ERROR: ReadPacket, failed to read RTMP packet header
WARNING: Download may be incomplete (downloaded about 0.0%), try –resume!
Closing connection… done!
Try the same mplayer options with a saved live radio stream and see if it’s just that your mplayer cannot output audio. If the download counter keeps increasing then mplayer must be accepting the input.
When I try to save a file, the file (BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv) the file size steadily increases during the download but gets deleted when I cntl C out of get_iplayer.
Thanks for assistance.
Try saving > 1024kB
I managed to retrieve a BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv file & run mplayer on it.
Looks like my mplayer has ‘unsupported codec’:-
mplayer BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv
MPlayer 1.0rc2-4.3.3 (C) 2000-2007 MPlayer Team
CPU: Genuine Intel(R) CPU T2130 @ 1.86GHz (Family: 6, Model: 14, Stepping: 12)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv.
libavformat file format detected.
[flv @ 0x883f748]Unsupported audio codec (a)
[flv @ 0x883f748]Could not find codec parameters (Audio: 0x000a, 44100 Hz, stereo)
[flv @ 0x883f748]skipping flv packet: type 109, size 7367781, flags 0
[flv @ 0x883f748]skipping flv packet: type 202, size 15304908, flags 0
[flv @ 0x883f748]skipping flv packet: type 246, size 6640682, flags 0
[flv @ 0x883f748]skipping flv packet: type 184, size 6044303, flags 0
[flv @ 0x883f748]skipping flv packet: type 157, size 11828897, flags 0
[flv @ 0x883f748]skipping flv packet: type 104, size 15634126, flags 0
[flv @ 0x883f748]skipping flv packet: type 227, size 12450547, flags 0
[flv @ 0x883f748]skipping flv packet: type 141, size 2882807, flags 0
[flv @ 0x883f748]skipping flv packet: type 108, size 1963436, flags 0
[flv @ 0x883f748]skipping flv packet: type 14, size 1510887, flags 0
LAVF_header: av_find_stream_info() failed
libavformat file format detected.
[flv @ 0x883f748]Unsupported audio codec (a)
[flv @ 0x883f748]Could not find codec parameters (Audio: 0x000a, 44100 Hz, stereo)
[flv @ 0x883f748]skipping flv packet: type 109, size 7367781, flags 0
[flv @ 0x883f748]skipping flv packet: type 202, size 15304908, flags 0
[flv @ 0x883f748]skipping flv packet: type 246, size 6640682, flags 0
[flv @ 0x883f748]skipping flv packet: type 184, size 6044303, flags 0
[flv @ 0x883f748]skipping flv packet: type 157, size 11828897, flags 0
[flv @ 0x883f748]skipping flv packet: type 104, size 15634126, flags 0
[flv @ 0x883f748]skipping flv packet: type 227, size 12450547, flags 0
[flv @ 0x883f748]skipping flv packet: type 141, size 2882807, flags 0
[flv @ 0x883f748]skipping flv packet: type 108, size 1963436, flags 0
[flv @ 0x883f748]skipping flv packet: type 14, size 1510887, flags 0
LAVF_header: av_find_stream_info() failed
Exiting… (End of file)
Looks like the ‘flv conversion’ is failing:-
1149.006 KB^CCaught signal: 2, cleaning up, just a second…
ERROR: ReadN, RTMP recv error 4
ERROR: ReadPacket, failed to read RTMP packet header
WARNING: Download may be incomplete (downloaded about 0.0%), try –resume!
Closing connection… done!
FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu6, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –extra-version=svn17737+3:0.svn20090303-1ubuntu6 –prefix=/usr –enable-avfilter –enable-avfilter-lavf –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –disable-stripping –disable-vhook –enable-libdc1394 –disable-armv5te –disable-armv6 –disable-armv6t2 –disable-armvfp –disable-neon –disable-altivec –disable-vis –enable-shared –disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Apr 10 2009 23:18:41, gcc: 4.3.3
Input #0, flv, from ‘/home/richard/radio/BBC_Radio_1/BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv’:
Duration: 00:01:10.32, start: 0.000000, bitrate: N/A
Stream #0.0: Audio: aac, 44100 Hz, stereo, s16
Output #0, adts, to ‘/home/richard/radio/BBC_Radio_1/BBC_Radio_1_-_bbc_radio_one_default.partial.aac’:
Stream #0.0: Audio: libfaac, 44100 Hz, stereo, s16
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
[NULL @ 0xa082a10]error, non monotone timestamps 3589470 >= 3588750
av_interleaved_write_frame(): Error while opening file
WARNING: flv conversion failed – retaining flv file
INFO: Recorded /home/richard/radio/BBC_Radio_1/BBC_Radio_1_-_bbc_radio_one_default.partial.aac.flv
Is there any way to get at the BBC’s cricket commentaries as listed on this page http://news.bbc.co.uk/sport1/hi/cricket/counties/7992843.stm
Click the link, then copy the link for ‘Launch in a Standalone player’ and run:
mplayer $(curl <link>)
Yep, that works, thanks.
just checked; iplayer was down when i was trying to download
thanks
dan
Hello again.
If I do:-
get_iplayer –pid radio:bbc_radio_one –amode=flashaac
The downloaded file gets converted successfully by FFmpeg and I can play the resultant *.aac file with mplayer.
However, If I do:-
get_iplayer –pid radio:bbc_radio_one –amode=flashaac –stdout –nowrite | mplayer -cache 128 –
It just sits there with the KB count increasing (no sound) until I press Cntl D:-
WARNING: ignoring too small audio packet: size: 0
Cache fill: 18.75% (24576 bytes)
libavformat file format detected.
521.420 KB^C
MPlayer interrupted by signal 2 in module: demux_open
Caught signal: 2, cleaning up, just a second…
ERROR: ReadN, RTMP recv error 4
ERROR: ReadPacket, failed to read RTMP packet header
WARNING: Download may be incomplete (downloaded about 0.0%), try –resume!
Closing connection… done!
WARNING: Failed to stream file /home/richard/radio/BBC_Radio_3/_-_bbc_radio_three_default.partial.aac.flv via RTMP
But if you do it this way…
get_iplayer –pid radio:bbc_radio_one –amode=flashaac –stdout –nowrite | ffplay –
it works. Go figure!!
I also get the same non-play effect when trying to live play tv via mplayer
Looks like at least ubuntu 9.04 may have a problematic mplayer…
SuSE 11.1 displays the same effect with mplayer.
I’ve got the same issue on mplayer and a dedicated stream. The solution was to use «trickle», which limited the bandwidth of mplayer, hence the stream isn’t cut.
Confirmed!
Hi,
can you tell me the pid for BBC World Service (radio) please?
Just use the play live URL linked on this site
http://www.bbc.co.uk/worldservice
–pid “radio:[URL]”
Hi i’m trying to download a program and convert to avi, how do i do this?
Sorry, i’m a bit of a novice at this!
I enter
ffmpeg -i infile.flv -vcodec copy -acodec copy -y outfile.avi
and nothing happens. Could anyone tell me exactley how to enter this command in and is it placed after get_iplayer –get 558 ?
kind regards
get_iplayer automatically calls ffmpeg and runs a command just like this but only on vp6 streams (flashnormal) most of the other flash streams are h264 which then get automatically remuxed into mp4 files. To transcode to avi you need to set the -vcodec to something else. ffmpeg can indeed do this and so can mencoder (from mplayer).
I am also struggling with where and how to enter the ffmpeg command line so that the flash stream outputs to .avi rather than .mp4. I am running Windows and feel rather clueless.
From the get_iplayer command prompt, I am changing the directory to ffmpeg/bin (where the installer puts ffmpeg.exe), entering keswick’s command line (above), which seems to be getting somewhere, until it says “infile.flv: no such file or directory”
Any help or sympathetic pointers would be very much appreciated.
To stream to vlc without stuttering:
In VLC preferences, choose “Show Settings”->”All”
Under “Input / Codecs”->”Access Modules”->”File”, increase the caching value (1000ms worked for me)
Stream to vlc with the following:
get_iplayer –stream –player “vlc file:///dev/stdin”
what about that
“vlc –file-caching 500 file:///dev/stdin”
I forgot to mention: the above only seems to work for flash modes
eg: get_iplayer –stream –vmode flashhigh –player “vlc file:///dev/stdin”
Hi,
A newbie here to flash/AS here – so apologies if I completely missed the point.
If I can get the stream info (./get_iplayer –streaminfo)of programs, is there anyway that I can create my own custom swf player and tell the AS to connect to the rtmp stream? I’m sure that there will be xml list of trusted player, which allows it to stream – but is there any way we can get around this?
You could but it’s probably easier to use the BBC’s own embedded player swf isn’t it?
You could do what you suggested – I don’t think there is a trusted player list for the BBC iPlayer.
Thanks for your reply.
I’m thinking of having a more dynamic player (maybe more buttons for programinfo etc) – than bbc iplayer itself.
I tried to author a swf player and it seems the FMS @ BBC is rejecting the connection.
Does anyone know any Action script that performs the swf verification, provided we have all the meta data information?.
For Ex: From rtmpDump I can get
——————————
stream: flashhigh2
application: a1414/e3
authstring: s=1248921366&e=1249007766&h=c9f2774c1ae4e0de5bbd84e97dcb60ee
ext: mp4
identifier: mp4:iplayerstream/secure_auth/b000lxrymH264122013362
playpath: iplayerstream/secure_auth/b000lxrymH264122013362?s=1248921366&e=1249007766&h=c9f2774c1ae4e0de5bbd84e97dcb60ee
server: bbcmedia.fcod.llnwd.net
streamer: rtmp
streamurl: rtmp://bbcmedia.fcod.llnwd.net:1935/ondemand?_fcs_vhost=bbcmedia.fcod.llnwd.net&auth=s=1248921366&e=1249007766&h=c9f2774c1ae4e0de5bbd84e97dcb60ee&aifp=v001&slist=mp4:iplayerstream/secure_auth/b000lxrymH264122013362
swfurl: http://www.bbc.co.uk/emp/9player.swf?revision=7978_8340
tcurl: rtmp://bbcmedia.fcod.llnwd.net:1935/a1414/e3
type: Flash RTMP h264 640×360 796kbps stream (limelight)
———————————–
and in my Fla i have something along the lines of
var nc:NetConnection = new NetConnection();
nc.connect(“rtmp://bbcmedia.fcod.llnwd.net:1935/ondemand”);
—
—
var ns:NetStream = new NetStream(nc);
ns.play(“mp4:iplayerstream/secure_auth/b000lxrymH264122013362?s=1248921366&e=1249007766&h=c9f2774c1ae4e0de5bbd84e97dcb60ee”);
Is this right? Or should I pass in more parameters? Will this approach ever work?
I don’t know much about AS but I do know that the BBC’s FMS do NOT require SWF verification.
I am trying to write a script to start and stop live stream recording based on a start/stop time file. I am calling get_iplayer with args directly from my script but get_iplayer seems to fork() the recording stream process and so I am having trouble stopping it without doing something ‘dirty’ like filtering through the output of “ps -ef” and killing it directly. Can you offer any advice?
You probably want to look at –long-help. There is an option there called –stop. This will limit the duration of a live recording (do test it first!). This option is just passed to the flvstreamer –stop option which does the sdame thing. Make sure you are using a fairly recent flvstreamer though. If you want to schedule the start time of a live recording then you are better off using cron to start it.
I guess I could add a –record-at=[date-time] option but that would mean that get_iplayer would have to be in crontab to fire off every minite to check all such entries which seems somewhat inefficient. I’ll thing about live scheduling for a future release maybe.
Quick and dirty script to watch live tv off a flaky connection (I was having probs with buffering)- looks like the live stream requires about 1Mbps:
#!/bin/bash
get_iplayer –pid tv:bbc_one –raw –file-prefix=bbc &
FILENAME=bbc.partial.flv
FILESIZE=0
while [ “$FILESIZE” -lt 1000000 ]
do
FILESIZE=$(stat -c%s “$FILENAME”)
if [ “$FILESIZE” = “” ]; then
FILESIZE=0
fi
sleep 1
done
vlc $FILENAME
killall -r get_iplayer
sleep 2
killall -r flvstreamer
rm $FILENAME
I’m using your source code to build iplayer for my distro openSUSE, and I patch in flvstreamer. It works pretty much flawlessly. I really only grab video feed to disk, with ofr Eg:
get_iplayer –get 123 –vmode=flashvhigh
Occasionally when it finishes and ffmpeg starts the conversion from flv to mp4 it fails.
So, my question is, what would I use at the CLI to try again on the conversion?
Thanks
For flv->AAC audio files:
ffmpeg -i inputfile.flv -vn -acodec copy -y outfile.aac
For flv->mp4 video (replace ‘mp4’ with ‘avi’ for those ‘flashnormal’ streams that require it):
ffmpeg -i inputfile.flv -vcodec copy -acodec copy -f mp4 -y outfile.mp4
Could the script be extended to play any kind of website, so that it be powerful & universal? example: http://music.aol.com/radioguide/latino-radio
if it can possibly be created.
Yes, as long as the stream type is supportable then anyone could go out and write a get_iplayer plugin which will index, search and record from the site.
Just recently I get this during downloads:
ERROR: ReadPacket, failed to read RTMP packet header
The download pauses briefly at xx% then continues
FLVStreamer v1.8e is being used
openSUSE 11.2 get_iplayer from source .rpm v.2.42-1
Thanks
See the forum.