Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support avconv (from libav) for --extract-audio #344

Closed
joshtriplett opened this issue May 10, 2012 · 12 comments
Closed

Please support avconv (from libav) for --extract-audio #344

joshtriplett opened this issue May 10, 2012 · 12 comments

Comments

@joshtriplett
Copy link

@joshtriplett joshtriplett commented May 10, 2012

--extract-audio currently requires the ffmpeg command-line tool. Please consider supporting the equivalent avconv tool from the libav project. The command-line syntax of avconv has evolved a bit from ffmpeg, but still remains quite similar.

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented May 29, 2012

avconv is a rename and slightly uncompatible evolution of ffmpeg

Here are the differences
http://libav.org/index.html#fftools_rename

And there I read that ffmpeg is indeed dead, also

Furthermore, the legacy ffmpeg conversion tool has been removed. Only avconv is available now.

I am for using a cross-compatible syntax and then checking first for avconv and then for ffmpeg as a fallback.

@reagle
Copy link

@reagle reagle commented Sep 10, 2012

I'm running Kubuntu 12.04 and hence encountered this problem of ffmpeg actually being a renaming of avconv with some incompatibilities. After seeing this issue, I thought the git version would work. So I uninstalled ffprobe and ffmpeg, installed avprobe (avconv was already installed), and cloned the repository. However, I still get:

[avconv] Destination: mp3
ERROR: audio conversion failed: Unable to find a suitable output format for 'mp3'

Oddly, my git clone still reports its version of 2012.02.27 and my clone seems to include a binary so I'm not sure how to have a look at the code to see what is going on.

@CharliePicorini
Copy link

@CharliePicorini CharliePicorini commented Sep 15, 2012

Reagle,

Did you try providing libmp3lame to the command line instead of mp3 alone? It used to work like this with ffmpeg.

Regards,

@reagle
Copy link

@reagle reagle commented Sep 17, 2012

youtube-dl -o '%(stitle)s' --extract-audio --audio-format=libmp3lame does not work either, is this what you are suggesting?

@CharliePicorini
Copy link

@CharliePicorini CharliePicorini commented Sep 17, 2012

Actually it is liblamemp3. Did you try to launch avconv from the command line, and ask it to convert a video into an mp3 (to spot if the error comes from your avconv installation, or from an incorrect use of youtube-dl)? There you should supply liblamemp3 if it's like ffmpeg. If this works then you could use a pipe and feed avconv with youtube-dl's output (just an idea).

@reagle
Copy link

@reagle reagle commented Sep 17, 2012

Yes, here is a sequence of commands that show youtube-dl and avconf work fine, but not the audio option.

urd:~$ youtube-dl -o '%(title)s' http://www.youtube.com/watch?v=FxhNPKU2vRs
[youtube] Setting language
[youtube] FxhNPKU2vRs: Downloading video webpage
[youtube] FxhNPKU2vRs: Downloading video info webpage
[youtube] FxhNPKU2vRs: Extracting video information
[download] M-Audio AV40 Short Test has already been downloaded

Downloading is successful.

urd:~$ avconv -i "M-Audio AV40 Short Test" "M-Audio AV40 Short Test.mp3" 
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jun 12 2012 16:52:09 with gcc 4.6.3
[flv @ 0xe3b9c0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'M-Audio AV40 Short Test':
  Metadata:
    starttime       : 0
    totalduration   : 21
    totaldatarate   : 408
    bytelength      : 1068313
    canseekontime   : true
    sourcedata      : B4A7DD684HH1347916228109568
    purl            : 
    pmsg            : 
  Duration: 00:00:20.80, start: 0.000000, bitrate: 410 kb/s
    Stream #0.0: Video: h264 (Main), yuv420p, 568x320, 311 kb/s, 30 tbr, 1k tbn, 60 tbc
    Stream #0.1: Audio: aac, 44100 Hz, mono, s16, 99 kb/s
Output #0, mp3, to 'M-Audio AV40 Short Test.mp3':
  Metadata:
    starttime       : 0
    totalduration   : 21
    totaldatarate   : 408
    bytelength      : 1068313
    canseekontime   : true
    sourcedata      : B4A7DD684HH1347916228109568
    purl            : 
    pmsg            : 
    TSSE            : Lavf53.21.0
    Stream #0.0: Audio: libmp3lame, 44100 Hz, mono, s16, 200 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size=     493kB time=21.00 bitrate= 192.1kbits/s    
video:0kB audio:492kB global headers:0kB muxing overhead 0.071619%

Extracting to mp3 is easy enough.

urd:~$ youtube-dl -o '%(title)s' --extract-audio --audio-format=liblamemp3 http://www.youtube.com/watch?v=FxhNPKU2vRs
Usage: youtube-dl [options] url [url...]
youtube-dl: error: invalid audio format specified

urd:~$ youtube-dl -o '%(title)s' --extract-audio --audio-format=mp3 http://www.youtube.com/watch?v=FxhNPKU2vRs
[youtube] Setting language
[youtube] FxhNPKU2vRs: Downloading video webpage
[youtube] FxhNPKU2vRs: Downloading video info webpage
[youtube] FxhNPKU2vRs: Extracting video information
[download] M-Audio AV40 Short Test has already been downloaded
[avconv] Destination: mp3
ERROR: audio conversion failed: Unable to find a suitable output format for 'mp3'

No joy.

@CharliePicorini
Copy link

@CharliePicorini CharliePicorini commented Sep 18, 2012

A look at the source code shows that "mp3" should work:

postproc.add_option('--audio-format', metavar='FORMAT', dest='audioformat', default='best',

help='"best", "aac", "vorbis", "mp3", "m4a", or "wav"; best by default')

So what you could do is provide nothing for the --audio-format option. Then "best" will be selected which turns to be what you want:

else:

MP3 otherwise.

acodec = 'libmp3lame'
extension = 'mp3'
more_opts = []
if self._preferredquality is not None:
more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality]

If all of this works, then maybe you could try using "" instead of ''.

----- Mail original -----
De: "Joseph Reagle" notifications@github.com
À: "rg3/youtube-dl" youtube-dl@noreply.github.com
Envoyé: Lundi 17 Septembre 2012 23:14:47
Objet: Re: [youtube-dl] Please support avconv (from libav) for --extract-audio (#344)

Yes, here is a sequence of commands that show youtube-dl and avconf work fine, but not the audio option.

[youtube] Setting language 
[youtube] FxhNPKU2vRs: Downloading video webpage 
[youtube] FxhNPKU2vRs: Downloading video info webpage 
[youtube] FxhNPKU2vRs: Extracting video information 
[download] M-Audio AV40 Short Test has already been downloaded Downloading is successful. 

urd:~$ avconv -i "M-Audio AV40 Short Test" "M-Audio AV40 Short Test.mp3" 
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers 
built on Jun 12 2012 16:52:09 with gcc 4.6.3 
[flv @ 0xe3b9c0] Estimating duration from bitrate, this may be inaccurate 
Input #0, flv, from 'M-Audio AV40 Short Test': 
Metadata: 
starttime : 0 
totalduration : 21 
totaldatarate : 408 
bytelength : 1068313 
canseekontime : true 
sourcedata : B4A7DD684HH1347916228109568 
purl : 
pmsg : 
Duration: 00:00:20.80, start: 0.000000, bitrate: 410 kb/s 
Stream #0.0: Video: h264 (Main), yuv420p, 568x320, 311 kb/s, 30 tbr, 1k tbn, 60 tbc 
Stream #0.1: Audio: aac, 44100 Hz, mono, s16, 99 kb/s 
Output #0, mp3, to 'M-Audio AV40 Short Test.mp3': 
Metadata: 
starttime : 0 
totalduration : 21 
totaldatarate : 408 
bytelength : 1068313 
canseekontime : true 
sourcedata : B4A7DD684HH1347916228109568 
purl : 
pmsg : 
TSSE : Lavf53.21.0 
Stream #0.0: Audio: libmp3lame, 44100 Hz, mono, s16, 200 kb/s 
Stream mapping: 
Stream #0:1 -> #0:0 (aac -> libmp3lame) 
Press ctrl-c to stop encoding 
size= 493kB time=21.00 bitrate= 192.1kbits/s 

video:0kB audio:492kB global headers:0kB muxing overhead 0.071619% Extracting to mp3 is easy enough. 

urd:~$ youtube-dl -o '%(title)s' --extract-audio --audio-format=liblamemp3 http://www.youtube.com/watch?v=FxhNPKU2vRs 
Usage: youtube-dl [options] url [url...] 
youtube-dl: error: invalid audio format specified 

urd:~$ youtube-dl -o '%(title)s' --extract-audio --audio-format=mp3 http://www.youtube.com/watch?v=FxhNPKU2vRs 
[youtube] Setting language 
[youtube] FxhNPKU2vRs: Downloading video webpage 
[youtube] FxhNPKU2vRs: Downloading video info webpage 
[youtube] FxhNPKU2vRs: Extracting video information 
[download] M-Audio AV40 Short Test has already been downloaded 
[avconv] Destination: mp3 
ERROR: audio conversion failed: Unable to find a suitable output format for 'mp3' No joy. 

— 
Reply to this email directly or view it on GitHub .
@reagle
Copy link

@reagle reagle commented Sep 18, 2012

It doesn't for me, so can anyone at least confirm my bug? (What happens when you type youtube-dl -o '%(title)s' --extract-audio --audio-format=mp3 http://www.youtube.com/watch?v=FxhNPKU2vRs .) Again, I was using ubuntu 2012.02.27-1 and am now using githubs 2012.02.27.

@reagle
Copy link

@reagle reagle commented Oct 1, 2012

I downloaded the 2012.09.27 binary off of github and still have this problem. Which format am I suppose to specify on Kubuntu 12.04 to get an mp3? (libmp3lame and mp3 don't work.)

@phihag
Copy link
Contributor

@phihag phihag commented Oct 1, 2012

Argh, sorry, should've seen it right away: Your output format is missing the extension. Therefore, ffmpeg detection fails. Try

youtube-dl -o '%(title)s.%(ext)s' --extract-audio --audio-format=mp3 FxhNPKU2vRs
@reagle
Copy link

@reagle reagle commented Oct 1, 2012

On 10/01/2012 04:21 PM, Philipp Hagemeister wrote:

Argh, sorry, should've seen it right away: Your output format is missing
the extension. Therefore, ffmpeg detection fails. Try

|youtube-dl -o '%(title)s.%(ext)s' --extract-audio --audio-format=mp3 FxhNPKU2vRs

Works! Thanks!

@rziman
Copy link

@rziman rziman commented Oct 19, 2013

Don't. Solve by building ffmpeg from source with libmp3lame enabled (e.g. for Ubuntu: https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide).

For anyone confused about avconv and ffmpeg, be sure to read this: http://stackoverflow.com/questions/9477115/who-can-tell-me-the-difference-and-relation-between-ffmpeg-libav-and-avconv/9477756#9477756 -- as well as the final link mentioned in that answer: http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.