get_iplayer forums

How to get FFmpeg to convert downloaded m4a to mp3 on Raspbian/Pi3? - Printable Version

+- get_iplayer forums (https://forums.squarepenguin.co.uk)
+-- Forum: Off-Topic (https://forums.squarepenguin.co.uk/forum-23.html)
+--- Forum: Converting Radio Programmes to MP3 (https://forums.squarepenguin.co.uk/forum-24.html)
+---- Thread: How to get FFmpeg to convert downloaded m4a to mp3 on Raspbian/Pi3? (https://forums.squarepenguin.co.uk/thread-1155.html)

Pages: 1 2 3


How to get FFmpeg to convert downloaded m4a to mp3 on Raspbian/Pi3? - startreksteve - 06-02-2017

Hi guys,
I've been using 2.97 and older versions for yonks, and with the deprecation of aactomp3 function, Im wondering if there's a switch to invoke ffmpeg to convert from M4a to mp3 when downloaded. Im running get_iplayer on the latest Raspbian on a Pi3.

Steve


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

See advanced section of FAQ list


RE: How to get FFmpeg to convert downloaded m4a to mp3? - Andrew Taylor - 06-02-2017

Apologies for being a bit thick but...

I've reverted back to version 2.97 (Win 10) after finding that the output to mp3 no longer works.
Am I correct in thinking that to get an mp3 output with version 2.98 I need to type in... 

Code:
get_iplayer --get 123 --command-radio='ffmpeg -i "<filename>" -c:v copy -c:a libmp3lame -b:a 320k -y "<dir>/<fileprefix>.mp3"'

...then use ...

Code:
get_iplayer --get 12345 --preset=aactomp3

...to download a show?

If that's correct will I have type in '--preset=aactomp3' every time?

Thanks,

Andrew.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

You're mixing up two different examples. Have another look at the documentation. It shows you how to create a preset before using it.

A preset gives you the choice of converting radio programmes to MP3 only when you need to, so you would need to include --preset in your commands as shown in the example. If you want to convert every single radio programme to MP3 every single time no matter what, you can set --command-radio in your default preferences. Use just --prefs-add instead of --prefs-add --preset aactomp3. Just remember to override --command-radio manually if you want to do something different with your radio programmes.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - Andrew Taylor - 06-02-2017

Thanks.

I'll take another look at the docs to see if I can understand what to do.
I only use get_iplayer for radio rips, essentially to copy to CD for the missus to listen to stuff in her car.

Andrew


RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 06-02-2017

Sorry, Im really struggling with this, where do I save --command-radio, and would I need to type anything other than get_iplayer --pvr, when all settings are entered correctly?
Id I do prefs-add command-radio, it saves a blank file in .get_iplayer/presets.

TIA
Steve

If I type this
get_iplayer --force --pid b08crt5z --command-radio='ffmpeg -i "<filename>" -c:v copy -c:a libmp3lame -b:a 320k -y "<dir>/<fileprefix>.mp3"'

It works and converts to an mp3, how do I incorporate this into my permanent preferences?
(I only ever download Radio)

Steve


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

(06-02-2017, 06:02 PM)startreksteve Wrote: It works and converts to an mp3, how do I incorporate this into my permanent preferences?
(I only ever download Radio)
The documentation provides an example (using MP3 VBR) of exactly that. Have another look and adjust to suit if you want to use other ffmpeg parameters.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - gsullymorgan - 06-02-2017

Er, where in the docs?  I've got exactly the same question but following the link in the Radio section (https://squarepenguin.co.uk/guides/radio-download-guide/#how-do-i-make-get-iplayer-automatically-convert-radio-programmes-to-mp3) just takes me to "This is an advanced topic beyond the scope of this introductory guide" and then links to the Custom Commands WIKI with "Create a preset named aactomp3  that can be used to extract the audio from a radio programme "


RE: How to get FFmpeg to convert downloaded m4a to mp3? - SquarePenguin - 06-02-2017

@startreksteve

Scroll a little further down than you're currently reading in the Example Commands list.

@dinky

Do you use bold heading instead of h4 for a set reason (i.e. something breaks if you don't)? If not, I'll change the smaller headings like I have done in this example above (they're visually identical) as you can get anchor links directly to them with a simple click.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

(06-02-2017, 07:41 PM)SquarePenguin Wrote: Do you use bold heading instead of h4 for a set reason (i.e. something breaks if you don't)? If not, I'll change the smaller headings like I have done in this example above (they're visually identical) as you can get anchor links directly to them with a simple click.
By all means, edit away. The idea was to get people to read the whole section on custom commands so they might actually understand the different ways to approach the problem, but that has clearly failed at the first hurdle.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 06-02-2017

Aha!
got it, that seems to work fine but the finished mp3 is a little larger, no worries, I'll have a fiddle about with the bitrates..

Cheers
Steve


RE: How to get FFmpeg to convert downloaded m4a to mp3? - SquarePenguin - 06-02-2017

I think it might just be above most users desire to parse the volume of info now.

The amount of 'adjacent knowledge' needed is higher too, like these commands come from simple building block principles but collecting that knowledge over the wiki is a big barrier for many (not least the time factor, let alone motivation).

It'll probably reduce the support burden to be able to link directly to this solution (at least) as I'm sure there will be more coming who were relying on the `--aactomp3` option.

I'll edit the Wiki as time allows.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

(06-02-2017, 08:08 PM)startreksteve Wrote: got it, that seems to work fine but the finished mp3 is a little larger, no worries, I'll have a fiddle about with the bitrates..
One more thing: Previous versions of get_iplayer used constant bit rate encoding for MP3 by default. If you opt to try variable bit rate encoding to save a bit on storage, I suggest that before going all in, you test a few files with your particular hardware to make sure they play OK and that the sound quality suits you. Everyone's hardware (and ears) are different.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 06-02-2017

One final question, after conversion, can I tell it to automatically delete the m4a?

Steve


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

(06-02-2017, 08:39 PM)startreksteve Wrote: One final question, after conversion, can I tell it to automatically delete the m4a?
You can string together multiple system commands in --command-radio. Combine them just as you would if typing them at a command prompt. Obviously, you need to be careful and only call rm if ffmpeg completes successfully. Work out your desired sequence at a command prompt before trying it with --command-radio. That said, if you're going to use more a couple of commands you will likely find it better to encapsulate all your post-processing in a shell script and then invoke the script from --command-radio.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 06-02-2017

Yeah, I used to do that with version 2.95..
I used to move the converted m4a's to another folder and delete them manually every few weeks.
Steve


RE: How to get FFmpeg to convert downloaded m4a to mp3? - dinky - 06-02-2017

(06-02-2017, 08:56 PM)startreksteve Wrote: I used to move the converted m4a's to another folder and delete them manually every few weeks.
Wise move. For anyone else: This would be preferable to deleting m4a files as you go. No point in wasting bandwidth to re-download if something goes wrong when you don't have to.


RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 07-02-2017

I checked that M4A folder after I said that, and there was 10gb of files in it! obviously I DONT empty it every few weeks! No wonder Im running out of space!


V2.98 saving direct to mp3 - mrg9999 - 10-02-2017

(06-02-2017, 06:02 PM)Steve. If you do get it working, can you post an example. I\ve had problems getting command to work. I was post using ffmpeg to boost the audio volume with post saving and would like to do it all in one hit.  ffmpeg -i "%%f" -acodec libmp3lame -q:a %quality% -af Wrote: Sorry, Im really struggling with this, where do I save --command-radio, and would I need to type anything other than get_iplayer --pvr, when all settings are entered correctly?
Id I do prefs-add command-radio, it saves a blank file in .get_iplayer/presets.

TIA
Steve

If I type this
get_iplayer --force --pid b08crt5z --command-radio='ffmpeg -i "<filename>" -c:v copy -c:a libmp3lame -b:a 320k -y "<dir>/<fileprefix>.mp3"'



It works and converts to an mp3, how do I incorporate this into my permanent preferences?
(I only ever download Radio)

Steve



RE: How to get FFmpeg to convert downloaded m4a to mp3? - startreksteve - 10-02-2017

Its stopped working again now with the following error:

libmp3lame IS installed

: A B7 production for BBC Radio 4.
                    :
                    : EPISODE
                    : http://www.bbc.co.uk/programmes/b08crt5z
                    :
                    : SERIES
                    : http://www.bbc.co.uk/programmes/b08f1dfw
  Duration: 00:13:37.92, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 150x84 [SAR 72:72 DAR 25:14], 90k tbr, 90k tbn, 90k tbc
Unknown encoder 'libmp3lame'
INFO: Command exit code 1 (raw code = 256)
ERROR: Command Exit Code: 1