Radio File Format Questions

Vangelis forthnet northmedia1 at the.forthnet.gr
Sun Dec 1 00:22:17 EST 2013


On Sat Nov 30 23:14:55 GMT 2013, Budgie wrote:

>Hi Vangelis,
>I have been working on other stuff and only now return to sort out my
>problem files.  Would you have time to help some more please?

Hello there Budgie :-) ; I was surprised, to say the least, that a 4.5 month 
old
thread was bumped... I'll try to do my best, but do keep in mind that I have 
NO
knowledge of Open Source OSs, just the WindowsVista x86 I am running in
this aging laptop; I only hope you can extrapolate what I say to your setup, 
else
the majority of the list members are savvy enough and can help you 
further...

>I do have ffprobe but do not see any mention of HE-AACv2 or
>AAC-LC when I run it on a problem file.  What I do see is :-
>
>[Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
>fltp, 48 kb/s (default).

You may want to further investigate the capabilities of ffprobe by printing 
its help
content::

ffprobe -h > "FFprobe Help.txt" (this for Win).

What you'd need in your case is the more verbose command "-show_streams".
Sacrificing the brevity of my reply, I've opted to illustrate this with an 
example:

Running the following command (from a UK IP),
get_iplayer --type=radio --pid=b03j5fxd --modes=flashaacstd --force -w --file-prefix="aacla[b03fbbbt]" 
 --tag-podcast-radio

will get you what you've labeled as "higher quality radio option"; this in 
fact is an MP4 container with the Apple
implemented .m4a extention (for Ipod compatible audio-only content), which 
"contains" a AAC-LC audio stream @128kbpsABR.

ffprobe -show_streams "aaclc[b03fbbbt].m4a"

will produce a list of info; I'd have expected that ffprobe under "profile=" 
would say
"aac_low', but instead it says "unknown".
However, you should pay attention to the following set of info:

codec_time_base=1/44100
sample_rate=44100
channels=2
time_base=1/44100
bit_rate=127999

This is indicative of the flashaacstd radio mode.

get_iplayer --type=radio --pid=b03j5fxd --modes=flashaaclow --force -w --file-prefix="aache2[b03fbbbt]" 
 --tag-podcast-radio

will fetch the "lower quality radio option", the one that IS NOT SUPPORTED 
by your hardware player.

ffprobe -show_streams "aache2[b03fbbbt].m4a"

this time produces the next set of info:

codec_time_base=1/22050
sample_rate=44100
channels=1
time_base=1/44100
bit_rate=47999

which is indicative of the flashaaclow radiomode.
(codec_time_base=1/22050 signifies the presence of SBR, while
channels=1 may mean either a monaural stream, or, as is the case here,
the presence of Parametric Stereo [=PS]; AAC+SBR+PS= HE-AACv2 !
Please read further at
http://en.wikipedia.org/wiki/AAC%2B )

Of course, with MediaInfo installed (on Windows), all is much simpler.
The programme injects a right-click context menu entry, which, when
selected, shows this info:

"aaclc[b03fbbbt].m4a"

Audio
ID                               : 1
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format profile                   : LC
Codec ID                         : 40
Duration                         : 30mn 0s
Bit rate mode                    : Variable
Bit rate                         : 128 Kbps
Maximum bit rate                 : 192 Kbps
Channel(s)                       : 2 channels
Channel positions                : Front: L R
Sampling rate                    : 44.1 KHz

"aache2[b03fbbbt].m4a"

Audio
ID                               : 1
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format profile                   : HE-AACv2 / HE-AAC / LC
Codec ID                         : 40
Duration                         : 30mn 0s
Bit rate mode                    : Constant
Bit rate                         : 48.0 Kbps
Channel(s)                       : 2 channels / 1 channel / 1 channel
Channel positions                : Front: L R / Front: C / Front: C
Sampling rate                    : 44.1 KHz / 44.1 KHz / 22.05 KHz

I would urge you to install MediaInfo for your distro, if you
haven't done already, because it is way more practical in examining
media files than the CLI ffprobe - please ask for further help, if needed,
about installing it on your OS, as I am clueless in this field... :-{
>I interpret this to mean that I have downloaded the flashaaclow
>version which from your advice I interpret to be the HE-AACv2 encoded
>version.  Is that correct?Judging only by the declared bitrate (= 48 kb/s), 
>then YES - but if you had the patience to
read through my elaboration above, then you'd have figured this out already 
:-)

>Since I have no idea why I get these files from time to time

I can safely say that most probably it's something on the Beeb's side - in 
the latest
month I came across 4 or 5 instances where a radio show was unavailable in 
the
flashaacstd mode for no apparent reason; the radio shows preceding & 
succeeding it
might've been, not the specific one in between I was after. And the 
situation remained
so for the whole duration of the 7day availability window - so it most 
probably is a
random glitch in the BBC's encoder chain.
 And what Jeremy has hinted is also true, observed quite often by me, too:
The flashaaclow files are the first to be encoded after the end of the 
broadcast of a
particular show (err, this is not actually true, from observation the wma 
ones are, but
this is OT here), so sometimes you are unlucky and when your PVR queue is 
run these
are the only ones available at that time...

>First request then is what should I put in my options file
>to ensure I only get the higher quality radio options?

 I record radio shows in a "hit-and-run" fashion via CLI and I specify in 
the GiP command
the radiomode I'm after (see the beginning of my reply) - if the flashaacstd 
mode (for music content)
is unavailable at first attempt, I might try 1 or 2 days later, if again no 
go, I settle for the
flashaaclow one -  which is also the case for all spoken content shows, as 
my original (overseas) IP
will, by default, expose me only to this one...
You might want to (re-)read this wiki item:

https://github.com/dinkypumpkin/get_iplayer/wiki/modes#what-about-radio

& just follow what Jeremy (Nicoll) has already suggested:

>If you code for example
>--modes=flashaachigh,flashaacstd
>then I think only those quality levels would be attempted.

But in the likelihood (which is not zero) that a radio show you're after 
hasn't been
made available in at least one of the above HQ modes, you will end up with 
NO
DOWNLOAD for that specific show...

>Second question is please could you help with ffmpeg command line to
>convert these files to files that will play as suggested previously by
>dinkypumpkin.

I can remember suggesting a HE-AACv2 -> MP3 transcoding
at a double bitrate for at least maintaining the original quality, if
it is a music file you are starting with - SneakyDS DOES support MP3 files.
I still stand by my suggestion.
But you were put off by the fact that
double bitrate = double size of the resultant MP3 file.
This is because MP3 LAME is way inferior at low bitrates to HE-AACv2.
If you are inclined to accept quality degradation in favour of a smaller 
file size,
then you could try transcoding music files to no lower than 64kbps

ffmpeg -i "foo[aache2].m4a" -vn -c:a libmp3lame -ab 64k -ac 2 -ar 44.1k 
"foo.mp3"

and I suspect "speech" files could sound acceptable at 56 or even 48kbps:

ffmpeg -i "foo[aache2].m4a" -vn -c:a libmp3lame -ab 56k -ac 2 -ar 44.1k 
"foo.mp3"

In the end, it depends on what device your SneakyDS is connected to...

dinkypumpkin's suggestion can be found here:

http://lists.infradead.org/pipermail/get_iplayer/2013-July/004614.html

and I simply echo the link therein - template conversion commands are also 
provided...
Unfortunately, the higher quality AAC-LC encoders are non-free; you have to 
compile
your own personal copy of ffmpeg with --enable-nonfree and enable support 
for either
libfdk_aac or libfaac or both.
 Search the web on how to do that, or you may kindly ask our own FFmpeg/AAC
expert, Shevek!

You are left with the 2 inferior free options, native (aac) & libvo_aacenc.
You can run

ffmpeg -encoders

to query what type of aac encoders your (packaged?) version of ffmpeg does 
support.

You can try the native encoder for music files at, say, 56kbps

ffmpeg -i "foo[aache2].m4a" -vn -strict -2 -c:a aac -b:a 56k 
"foo2[aaclc].m4a"

Out of curiosity, I performed the above conversion on my system on file 
"aache2[b03fbbbt].m4a",
it took 5min to complete (old 2core CPU), tested on latest MPC-BE and the 
product file sounds
noticeably worse (@56kbps) than the original (@48kbps)...

>I note I could transcode on downloading and save these files as
>mp3 files but is it also possible to transcode to flac?

FFmpeg has native support for the FLAC encoder (at least the windows builds 
from Zeranoe do).
 So it can transcode the m4a/mp3  files GiP produces into .flac ones. Why, 
OTOH,
you would want to transcode heavily compressed audio files (encoded in the 
lossy
AAC-LC/HEv2 or LAME formats) to a LOSSLESS audio format is beyond me (???).
 The most frequent use of FLAC that I know of is to transcode CD rips in 
.wav format (1411kbps)
to flac at half the bitrate (and hence half the size), retaining almost the 
original quality; so it is from a
lossless format to another lossless one - I see no point for a lossy -> 
lossless conversion, but I suspect
you have maybe other things in mind...

Oh Gosh!, this has now turned into a diatribe, many apologies...
Regards,
Vangelis. 




More information about the get_iplayer mailing list