Jun 25 2009

get_iplayer v2.04 now has very much simplified Live TV and Radio support.

Two new programme types have been added: ‘livetv’ and ‘liveradio’. These types, if selected, will list the available programmes in the familiar listing format:

get_iplayer --type=livetv
Matches:
80000:  BBC Four - live
80001:  BBC News 24 - live
80002:  BBC One - live
80003:  BBC Parliament - live
80004:  BBC Three - live
80005:  BBC Two - live
80006:  CBBC - live
80007:  CBeebies - live

INFO: 8 Matching Programmes

Or you can just search, stream or playback by channel/programme name:

get_iplayer --type=liveradio 'Radio 1'
Matches:
80132:  BBC Radio 1 - live

INFO: 1 Matching Programmes

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.

Likewise, embedded media web pages can be played more easily. e.g.:

get_iplayer --stream --type=radio
  --url="http://www.bbc.co.uk/robertburns/works/a_bards_epitaph/"

Or recorded using:

get_iplayer --get --type=radio
  --url="http://www.bbc.co.uk/robertburns/works/a_bards_epitaph/"

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.

    • On June 27th, 2009, linuxcentre said:

      I think software is aware of stdout in native win32 – after all ‘| more’ works… Just doesn’t work for these streams for some reason that I cannot figure.

      • On September 19th, 2009, Amit said:

        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.

        • On September 19th, 2009, linuxcentre said:

          It’s worked perfectly in cmd.exe win32 since Jul 30th – it was just that the flvstreamer did not use binary mode when piping to STDOUT.

    • On June 30th, 2009, Bigarules said:

      Anyone else having problems downloading aac+ radio files today?
      Tried a couple from r4 and bbc7.

      DEBUG: HandleInvoke, server invoking
      DEBUG: HandleInvoke, onStatus: NetStream.Failed
      Closing connection… done!

      WARNING: Failed to stream file ./Afternoon_Reading_-_Maia_in_Yonkers_b00lbgqv_default.partial.aac.flv via RTMP
      INFO: skipping flashaac1 mode
      ERROR: Failed to record ‘Afternoon Reading – Maia in Yonkers (b00lbgqv)’

      • On July 1st, 2009, linuxcentre said:

        It works fine for me on fedora9 get_iplayer 2.04 / flvstreamer 1.8a.

        • On July 1st, 2009, Tree said:

          Unfortunately, I’m having the same problem as Bigarules on Fedora 10-x64 / get_iplayer 2.04 / flvstreamer 1.8a. Also fails with rtmpdump 1.6.

          After the SendPlay call:
          DEBUG: sending ping. type: 0x0003
          DEBUG: HandlePing, received ping. type: 0, len: 6
          DEBUG: GetNextMediaPacket, received: invoke 133 bytes
          DEBUG: Property: NULL
          DEBUG: Property: <Name: level, STRING: error>
          DEBUG: Property: <Name: code, STRING: NetStream.Failed>
          DEBUG: Property: <Name: description, STRING: Failed to play (stream ID: 1).>
          DEBUG: Property: <Name: clientid, STRING: kGngUVpg>
          DEBUG: HandleInvoke, server invoking
          DEBUG: HandleInvoke, onStatus: NetStream.Failed
          Closing connection… done!

          • On July 1st, 2009, linuxcentre said:

            Fixed in v2.05 – thanks.

        • On July 1st, 2009, linuxcentre said:

          Actually, I lied, the flashaudio (mp3) version is OK. The flashaac one fails for me also…

          • On July 1st, 2009, linuxcentre said:

            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.

            • On July 1st, 2009, Tree said:

              Yup, it works. Muchas gracias. (Just in time for Torchwood!)

            • On July 1st, 2009, linuxcentre said:

              v2.05 out now…

            • On July 7th, 2009, biffel said:

              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.

              INFO: User prefs dir: /mnt/usb/._get_iplayer
              INFO: System options dir: /mnt/usb/._get_iplayer_sys
              Current options:
              ffmpeg = /mnt/usb/ffmpeg
              radiomode = flashaac
              rtmpdump = /mnt/usb/flvstreamer
              type = liveradio
              verbose = 1

              INFO: Search args: ‘80135’
              INFO: Additionally getting cached programme data for liveradio
              INFO: got 58 cache entries for liveradio
              Matches:
              80135: BBC Radio 4 – live

              INFO: 1 Matching Programmes
              WARNING: Cannot read /mnt/usb/._get_iplayer/download_history

              INFO: iPlayer metadata URL = http://www.bbc.co.uk/iplayer/playlist/bbc_radio_fourfm
              INFO: Getting page http://www.bbc.co.uk/iplayer/playlist/bbc_radio_fourfm
              INFO: Version: default, VersionPid: bbc_radio_fourfm
              INFO: Will look for versions: default,original,signed,audiodescribed,opensubtitled,shortened,lengthened,other
              INFO: Mode list: flashaac,realaudio,wma
              INFO: Checking existence of default version
              INFO: Version = default
              INFO: Getting page http://www.bbc.co.uk/mediaselector/4/mtis/stream/bbc_radio_fourfm
              INFO: Found mode flashaac1: (iplayer_uk_stream_aac_rtmp_live) rtmp aac stream (CDN: akamai/10)
              INFO: Found mode realaudio1: (iplayer_intl_stream_real) rtsp real 128kbps stream (CDN: sis/10)
              INFO: Found mode wma1: (iplayer_uk_stream_wma) mms wma 128kbps stream (CDN: sis/10)
              INFO: flashaac1,realaudio1,wma1 modes will be tried for version default
              INFO: Trying flashaac1 mode to record liveradio: BBC Radio 4 – live
              INFO: Attempt number: 1 / 1
              INFO: File name prefix = BBC_Radio_4_live_2009-07-07_220900
              INFO: “/mnt/usb/flvstreamer” version 1.8
              INFO: RTMP_URL: rtmp://cp60686.live.edgefcs.net:1935/live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447, tcUrl: rtmp://cp60686.live.edgefcs.net:80/live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447, application: live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447, authString: dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ, swfUrl: http://www.bbc.co.uk/emp/9player.swf?revision=10344_10753, file: ./BBC_Radio_4_live_2009-07-07_220900.partial.aac, file_done: ./BBC_Radio_4_live_2009-07-07_220900.aac

              INFO: Command: “/mnt/usb/flvstreamer” –verbose –port 1935 –protocol “0” –playpath “Radio_4_UK@s6447?auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001″ –host “cp60686.live.edgefcs.net” –swfUrl “http://www.bbc.co.uk/emp/9player.swf?revision=10344_10753″ –tcUrl “rtmp://cp60686.live.edgefcs.net:80/live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447″ –app “live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447″ –resume –timeout 10 –live -o “./BBC_Radio_4_live_2009-07-07_220900.partial.aac.flv” 1>&2
              FLVStreamer v1.8c
              (c) 2009 Andrej Stepanchuk, The Flvstreamer Team, license: GPL
              WARNING: Can’t resume live stream, ignoring –resume option
              DEBUG: Setting buffer time to: 36000000ms
              Connecting …
              DEBUG: Protocol : RTMP
              DEBUG: Hostname : cp60686.live.edgefcs.net
              DEBUG: Port : 1935
              DEBUG: Playpath : Radio_4_UK@s6447?auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001
              DEBUG: tcUrl : rtmp://cp60686.live.edgefcs.net:80/live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447
              DEBUG: swfUrl : http://www.bbc.co.uk/emp/9player.swf?revision=10344_10753
              DEBUG: app : live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447
              DEBUG: flashVer : LNX 10,0,22,87
              DEBUG: live : yes
              DEBUG: timeout : 10 sec
              DEBUG: Connect, … connected, handshaking
              DEBUG: HandShake: Type Answer : 03
              DEBUG: HandShake: Server Uptime : 89009801
              DEBUG: HandShake: FMS Version : 3.0.3.1
              DEBUG: Connect, handshaked
              INFO: Connected…
              Starting download at 0.000 kB
              DEBUG: GetNextMediaPacket, received: server BW
              DEBUG: GetNextMediaPacket, received: client BW
              DEBUG: HandlePing, received ping. type: 0, len: 6
              DEBUG: GetNextMediaPacket, received: invoke 190 bytes
              DEBUG: Property:
              DEBUG: Property:
              DEBUG: Property:
              DEBUG: Property:
              DEBUG: Property:
              DEBUG: Property:
              DEBUG: HandleInvoke, server invoking
              DEBUG: HandleInvoke, received result for method call
              DEBUG: sending ping. type: 0x0003
              DEBUG: FCSubscribe: Radio_4_UK@s6447?auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001
              DEBUG: GetNextMediaPacket, received: invoke 21 bytes
              DEBUG: HandleInvoke, server invoking
              DEBUG: GetNextMediaPacket, received: invoke 29 bytes
              DEBUG: Property: NULL
              DEBUG: HandleInvoke, server invoking
              DEBUG: HandleInvoke, received result for method call
              DEBUG: SendPlay, sending play: Radio_4_UK@s6447?auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001
              DEBUG: sending ping. type: 0x0003
              DEBUG: GetNextMediaPacket, received: invoke 101 bytes
              DEBUG: Property: NULL
              DEBUG: Property:
              DEBUG: Property: NULL
              DEBUG: Property:
              DEBUG: HandleInvoke, server invoking
              DEBUG: HandlePing, received ping. type: 6, len: 6
              DEBUG: sending ping. type: 0x0007
              DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
              ERROR: ReadPacket, failed to read RTMP packet header
              DEBUG: Writing data type: 00
              Closing connection.
              INFO: Command exit code = 2
              INFO: Command: “/mnt/usb/flvstreamer” –verbose –port 1935 –protocol “0” –playpath “Radio_4_UK@s6447?auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001″ –host “cp60686.live.edgefcs.net” –swfUrl “http://www.bbc.co.uk/emp/9player.swf?revision=10344_10753″ –tcUrl “rtmp://cp60686.live.edgefcs.net:80/live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447″ –app “live?_fcs_vhost=cp60686.live.edgefcs.net&auth=dbEbIcQalc6a5dUa6arbZdLbeazc1dEcIa5-bku7LU-c0-d0i_-FpnDBpEnMEtEvwJ&aifp=v001&slist=Radio_4_UK@s6447″ –resume –timeout 10 –live -o “./BBC_Radio_4_live_2009-07-07_220900.partial.aac.flv” 1>&2
              WARNING: Failed to stream file ./BBC_Radio_4_live_2009-07-07_220900.partial.aac.flv via RTMP
              DEBUG: Record using flashaac1 mode return code: ‘next’
              INFO: skipping flashaac1 mode
              INFO: Trying realaudio1 mode to record liveradio: BBC Radio 4 – live
              INFO: Attempt number: 1 / 1

              WARNING: Required mplayer does not exist
              DEBUG: Record using realaudio1 mode return code: ‘next’
              INFO: skipping realaudio1 mode
              INFO: Trying wma1 mode to record liveradio: BBC Radio 4 – live
              INFO: Attempt number: 1 / 1

              WARNING: Required mplayer does not exist
              DEBUG: Record using wma1 mode return code: ‘next’
              INFO: skipping wma1 mode
              ERROR: Failed to record ‘BBC Radio 4 – live (bbc_radio_fourfm)’
              WARNING: Cannot read /mnt/usb/._get_iplayer/download_history

              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

              Any ideas? For the record, the Chumby runs on ARM; uname -a reports:

              Linux (none) 2.6.16-csb #1 Tue May 5 13:48:59 PDT 2009 armv5tejl unknown

              • On July 7th, 2009, linuxcentre said:

                Does this work on one of the standard linux/mac/win32 binaries? Or is it just the chumby verson you have compiled? BTW: it works fine for me on fedora, win32 and ubuntu.

              • On July 8th, 2009, biffel said:

                Works fine on standard ubuntu Linux binary flvstreamer.

                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

                for (int i = 0; i < 10; i++)
                {
                int nBytes = recv(m_socket, m_pBuffer, RTMP_BUFFER_CACHE_SIZE, 0);
                if(nBytes != -1) {
                m_nBufferSize += nBytes;
                m_pBufferStart = m_pBuffer;
                break;
                }
                else
                {
                Log(LOGDEBUG, “%s, recv returned %d. GetSockError(): %d”, __FUNCTION__, nBytes, GetSockError());
                if (GetSockError() == 11)
                {
                continue;
                }
                Close();
                // exit(10);
                return false;
                }
                }

                return true;
                }

                The logging:

                DEBUG: HandleInvoke, server invoking
                DEBUG: HandlePing, received ping. type: 6, len: 6
                DEBUG: sending ping. type: 0x0007
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: HandlePing, received ping. type: 6, len: 6
                DEBUG: sending ping. type: 0x0007
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: HandlePing, received ping. type: 6, len: 6
                DEBUG: sending ping. type: 0x0007
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: HandlePing, received ping. type: 6, len: 6
                DEBUG: sending ping. type: 0x0007
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: FillBuffer, recv returned -1. GetSockError(): 11
                DEBUG: HandlePing, received ping. type: 6, len: 6
                DEBUG: sending ping. type: 0x0007

                • On September 3rd, 2009, fergal said:

                  I’m getting the exact same error on my SheevaPlug (another ARM based device) which is running Ubuntu 9.04, whereas it works fine on my x86 box.

                  Maybe flvstreamer doesn’t like ARM?

                  Did you ever get it to work properly?

                  • On September 3rd, 2009, linuxcentre said:

                    Confirmed – there is an unresolved flvstreamer issue with ARM builds – someone on th installation page here has solved it – we’re just waiting for an answer on how he did it..

                    • On September 8th, 2009, Tim said:

                      Hi Guys,

                      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.

                      I downloaded the latest build from the flvstreamer website.

                      • On January 9th, 2010, Ella's Dad said:

                        I’ve just compiled flvstreamer 1.9 for the Sheevaplug. You will need build-essential, then download and unpack the flvstreamer 1.9 tar.gz.
                        The makefile you need is (MakefileARM):
                        CC=gcc
                        CXX=g++
                        LD=ld

                        CFLAGS=-Wall -D_FILE_OFFSET_BITS=64
                        CXXFLAGS=-Wall -D_FILE_OFFSET_BITS=64
                        LDFLAGS=-Wall -D_FILE_OFFSET_BITS=64

                        CXXFLAGS=
                        LDFLAGS=-Wl,-rpath=/opt/lib

                        all: flvstreamer

                        clean:
                        rm -f *.o

                        streams: bytes.o log.o rtmp.o AMFObject.o rtmppacket.o streams.o parseurl.o
                        $(CXX) $(LDFLAGS) $(ARMFLAGS) $^ -o $@_arm -lpthread

                        flvstreamer: bytes.o log.o rtmp.o AMFObject.o rtmppacket.o flvstreamer.o parseurl.o
                        $(CXX) $(LDFLAGS) $(ARMFLAGS) $^ -o $@_arm

                        bytes.o: bytes.c bytes.h Makefile
                        log.o: log.c log.h Makefile
                        rtmp.o: rtmp.cpp rtmp.h log.h AMFObject.h Makefile
                        AMFObject.o: AMFObject.cpp AMFObject.h log.h rtmp.h Makefile
                        rtmppacket.o: rtmppacket.cpp rtmppacket.h log.h Makefile
                        flvstreamer.o: flvstreamer.cpp rtmp.h log.h AMFObject.h Makefile
                        parseurl.o: parseurl.c parseurl.h log.h Makefile
                        streams.o: streams.cpp log.h Makefile

                        then “makefile -f MakefileARM flvstreamer” will build flvstreamer_arm for you – set the get_iplayer options and linux file permissions and you should be OK

              • On September 21st, 2009, val said:

                Hi
                Installed everything ok in ubuntu with proxy set etc…
                But get this flvstream error:
                http://img268.yfrog.com/img268/8972/linuxcentre1.png

                WordPress Themes