Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Messages - ilainftw

Pages: [1]
But I would now recommend Livestreamer.exe as the best program for accessing all of those streams, not ffmpeg.
Livestreamer is long-abandoned. It would probably be worth looking into its successor Streamlink ( A plugin with some iPlayer TV support has been added to Streamlink. Hopefully, someone will add an iPlayer radio plugin at some point.
The BBC now use two types of audio stream, HLS and DASH. FFMPEG can only download HLS, but I cannot find any HLS on-demand streams that are genuinely running at more than 128 kbps (i.e. the entire 'Listen-again' service is only running at 128 kbps, even streams that are advertised as having a higher bitrate).
320k HLS streams for most on-demand radio programmes are most definitely available, but it's not worth the bother extracting them yourself for use with ffmpeg. Both get_iplayer ( and youtube-dl can access them. But with 320k DASH streams available, they aren't altogether necessary.
And for anyone who wants the 320 kbps bitrate, only the DASH streams now provide that, for the On-demand streams (and the BBC seem to be moving gradually towards using only DASH). So welcome to the world of YouTube-dl.
There are some wrinkles to be aware of with youtube-dl. The files it produces from DASH streams are fragmented M4A, which is why some media players (e.g., iTunes) don't like them. You can work around that by using --add-metadata in your youtube-dl command (requires ffmpeg). The metadata added is negligible, but the file is losslessly re-muxed (and thus defragmented) in the process. You can also do it yourself after download, of course. If you download an HLS stream with youtube-dl, it should automatically re-mux the resulting MPEG-TS file to M4A if ffmpeg is available. If not it will leave a .m4a file that does not really have an MP4 container - it is MPEG-TS. The other small gotcha is that you have to sign in to the BBC (where required) for the Greasemonkey script to work.

For those who don't want to use Firefox or Greasemonkey (or Chrome equivalents), you can accomplish much the same thing with youtube-dl alone. Assuming you want to restrict yourself to DASH streams as the Greasemonkey script does (usually not necessary, but may be faster downloads), you can use commands in the form:
Code: [Select]
youtube-dl -f "best[protocol*=dash]" --restrict-filename --add-metadata [protocol*=dash] filter restricts youtube-dl to DASH streams and --restrict-filename replaces white space and unfriendly characters in the output filename.

Use [protocol*=m3u8] filter to restrict youtube-dl to HLS streams:
Code: [Select]
youtube-dl -f "best[protocol*=m3u8]" --restrict-filename --add-metadata
One place the Greasmonkey script may be useful is in constructing an output filename (the -o option). Because of the way youtube-dl extracts BBC radio programme titles, the series and episode names are usually reversed in the default filenames it generates. Also, the command generated by the Greasemonkey script may take slightly less time to run because it doesn't have to filter the available streams.

It's a matter of taste, but for me get_iplayer is a simpler solution. You just need to type "get_iplayer " at a command prompt, then copy/paste the programme's URL (from browser) after it, then hit Return:
Code: [Select]
get_iplayer default, it uses DASH streams (or HLS if DASH not available) with the highest available bit rate (usually 320k) to produce a defragmented M4A file with full metadata and a reasonable filename.

Use --radiomode=daf option to restrict get_iplayer to DASH streams:
Code: [Select]
get_iplayer --radiomode=daf
Use --radiomode=haf option to restrict get_iplayer to HLS streams:
Code: [Select]
get_iplayer --radiomode=haf

Geek Speak / Re: Download 384 kbps LIVE stream
« on: July 31, 2017, 11:11:04 PM »
You are confusing download speed with audio bitrate. Just because you are downloading HLS chunks faster than >320k doesn't mean the encoded audio is >320k. If you are downloading an HLS on-demand stream or a live stream with a rewind buffer, then of course ffmpeg will download as fast as it needs to (upstream permitting) to do whatever transcoding you have configured. Without a rewind buffer, HLS live stream downloading settles near the nominal audio bit rate. The BBC doesn't give you >320k audio just because you ask for it (but you're really not doing that). The BBC doesn't give you MPEG-2 or WAV audio just because you ask for it (but you're really not doing that either).  When you think about how HLS streams are produced, and how the BBC provides only one stream per variant playlist, that wouldn't make any sense. You only get apparently higher bitrates in your output files because you're transcoding and upsampling the audio stream after it is downloaded. Prove it to yourself by downloading a 320k live stream with no transcoding:
Code: [Select]
ffmpeg -i URL -c copy file.ts then check the audio bit rate in the resulting file. It will contain 320k audio. Do the same with a 320k on-demand stream, which will show the same result.

Geek Speak / Re: Download 384 kbps LIVE stream
« on: July 27, 2017, 04:01:55 PM »
Although the above described method does work, I was never happy with it, because the audio stream which it accesses is unstable.
Those are Shoutcast streams, which are likely to be less reliable than the HLS HTTP-based chunked audio streams.
Here, then, is the new method for forcing the live stream to run at 384 kbps, instead of at the standard bitrate of 320 kbps.
That is not what you are doing. The audio stream remains 320k AAC (or 128k in your first example). You are merely instructing ffmpeg to transcode it to MPEG-2 when saving to a file. 384k is the default bit rate used by ffmpeg for MP2 encoding, so you're just upsampling the source audio. It's OK if you prefer that output, but for most people it will suffice to save the AAC stream as-is into an MPEG-TS file (perhaps with remux to M4A for final recording). Transcoding (usually to MP3) would only absolutely be required if you have a hardware player that doesn't support AAC audio or can't handle large AAC files (from lengthy recordings).
Use any of these four command lines (each is actually a 2-line command line) -
In general, it's better to use the variant playlists, e.g.:
Code: [Select] than the stream playlists they contain, e.g.:
Code: [Select] stream playlists may change over time. Each variant playlist for BBC radio contains only a single stream, so no danger of getting an unexpected bit rate.

Pages: [1]