Using ffmpeg for FLV to MP3 demux (includes patch)
Kyzer
stuart.caie at gmail.com
Sat Jan 8 11:56:50 EST 2011
Hello everyone.
First, many thanks for keeping get_iplayer going. It's a fantastic
piece of software and I'm glad it still works.
I don't use mplayer (I think it's a buggy frontend to ffmpeg's
libavcodec, and prefer VLC), so I was dismayed to see that get_iplayer
always uses mplayer instead of ffmpeg for converting FLV->MP3
(flashaudio mode).
Checking the version history, this decision was made two years ago in
version 1.18 and hasn't changed since:
> * Now use mplayer to demux the flv stream into mp3, ffmpeg can only seem to retranscode the flv to mp3 with obvious loss in quality.
This is simply not the case for me, using Ubuntu's ffmpeg 0.5.1.
ffmpeg transcodes flawlessly. Perhaps it was true two years ago?
A survey could clear things up. Who has a broken ffmpeg installed that
produces bad or lower quality MP3s when you run "ffmpeg -i x.flv
-acodec copy x.mp3"?
In any case, here is a patch to use ffmpeg if mplayer doesn't exist.
--- a/get_iplayer
+++ b/get_iplayer
@@ -8103,14 +8103,10 @@ sub get {
move($file_tmp, $prog->{filename}) if $file_tmp ne
$prog->{filename} && ! $opt->{stdout};
return 0;
- # Convert flv to mp3/aac
- } elsif ( $mode =~ /^flashaudio/ ) {
+ # Convert flv to mp3 using mplayer
+ } elsif ( $mode =~ /^flashaudio/ && main::exists_in_path('mplayer')) {
# We could do id3 tagging here with ffmpeg but id3v2
does this later anyway
- # This fails
- # $cmd = "$bin->{ffmpeg} -i \"$file_tmp\" -vn -acodec
copy -y \"$prog->{filepart}\" 1>&2";
- # This works but it's really bad bacause it
re-transcodes mp3 and takes forever :-(
- # $cmd = "$bin->{ffmpeg} -i \"$file_tmp\" -acodec
libmp3lame -ac 2 -ab 128k -vn -y \"$prog->{filepa
- # At last this removes the flv container and dumps the
mp3 stream! - mplayer dumps core but apparen
+ # old versions of ffmpeg may fail, so use mplayer if available
@cmd = (
$bin->{mplayer},
@{ $binopts->{mplayer} },
@@ -8118,8 +8114,8 @@ sub get {
$file_tmp,
'-dumpfile', $prog->{filepart},
);
- # Convert flv to aac/mp4a
- } elsif ( $mode =~ /flashaac/ ) {
+ # Convert flv to aac or mp3 using ffmpeg
+ } elsif ( $mode =~ /flashaac|flashaudio/ ) {
# This works as long as we specify aac and not mp4a
More information about the get_iplayer
mailing list