Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How To Set Mp3 Quality in avconv?

  1. #1
    Join Date
    Aug 2007
    Beans
    66

    How To Set Mp3 Quality in avconv?

    hi

    the utility avconv has a codec-specific quality option "-aq". i cannot find documentation for allowed values for Mp3 output. I'm trying to convert from mp4 video to mp3 audio.

    this helpfile doesn't explain this, that i can see:
    https://libav.org/avconv.html

    maybe i misunderstood.

    can anyone refer me to documentation on this?

    would it be the same quality settings listed here?
    https://trac.ffmpeg.org/wiki/Encode/MP3
    the range is 0-9 where a lower value is a higher quality
    confused-- somebody here is using "-aq 128k"
    http://www.stackoverflow.dluat.com/q...ord-with-aconv

    thx~
    Last edited by johny why; September 4th, 2015 at 01:26 PM.

  2. #2
    Join Date
    Jun 2007
    Beans
    17,337

    Re: How To Set Mp3 Quality in avconv?

    likely any of these would work
    Code:
    avconv -i  input-file -codec:a libmp3lame -aq 2 output.mp3
    
    avconv -i  input-file -codec:a libmp3lame -q:a 2 output.mp3
    
    avconv -i  input-file -c:a libmp3lame -aq 2 output.mp3
    
    avconv -i  input-file -c:a libmp3lame -q:a 2 output.mp3
    Last edited by mc4man; September 4th, 2015 at 05:02 PM. Reason: missing 1 -

  3. #3
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: How To Set Mp3 Quality in avconv?

    You can also set a specific bitrate if you wish with, for example
    Code:
    avconv -i file.flac -acodec libmp3lame -ab 320k file.mp3
    which not surprisingly will give you a bitrate of 320kb/s

    The command that mc4man shows will, however, probably give a better variable bitrate quality; the -aq figures go from 1 for the best to 9 for the lowest and 6 is often good enough for general listening or recordings of speech, but with storage space being so cheap these days why not go for a better quality.

    Try a few to see if the differences matter to you.

  4. #4
    Join Date
    Aug 2007
    Beans
    66

    Re: How To Set Mp3 Quality in avconv?

    Quote Originally Posted by ajgreeny View Post
    Code:
    avconv -i file.flac -acodec libmp3lame -ab 320k file.mp3
    which not surprisingly will give you a bitrate of 320kb/s
    i'm not seeing "-ab" in the man page i linked, nor in "avconv -h". Is it documented someplace?

    also, there's another option, '-b', which is for bitrate, right? Wouldn't that potentially conflict?

    also, no point trying to make my ouput bitrate higher than the input bitrate, right?

    Quote Originally Posted by ajgreeny View Post
    the -aq figures go from 1 for the best to 9 for the lowest
    so, not down to 0 for best, as with ffmpeg? (see link in op)

    Quote Originally Posted by ajgreeny View Post
    with storage space being so cheap these days why not go for a better quality. Try a few to see if the differences matter to you.
    yeah, i just want to set highest quality and forgetaboutit, and not bother with listening tests.



    wrt that, i want 2-pass vbr-- can avconv do that? in that man page, i'm seeing the following under 'private options'. Is this all i need to get 2-pass?
    ‘-stats string’ - Filename for 2 pass stats.
    (answered here, you have to run avconv twice with the -pass option http://askubuntu.com/questions/23119...ng-with-avconv)




    Hm, problem with 2-pass, i'm getting:
    $ avconv -vn -y -i "movie.mp4" -pass 1 /dev/null
    avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
    built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Current Value - Running.mp4':
    Metadata:
    major_brand : mp42
    minor_version : 0
    compatible_brands: isommp42
    creation_time : 2015-02-07 18:18:58
    Duration: 00:06:02.11, start: 0.000000, bitrate: 656 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 462 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 191 kb/s
    Metadata:
    creation_time : 2015-02-07 18:18:59
    Unable to find a suitable output format for '/dev/null'


    i'm not specifiying codec at all. Is that important? i'm getting an mp3 output file with:
    $ avconv -vn -aq 0 -i "movie.mp4" "audio.mp3"
    answered here:
    ‘-f fmt (input/output)’ - Force input or output file format. The format is normally autodetected for input files and guessed from file extension for output files, so this option is not needed in most cases.
    https://libav.org/avconv.html
    thx!
    Last edited by johny why; September 4th, 2015 at 08:00 PM.

  5. #5
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: How To Set Mp3 Quality in avconv?

    i'm not seeing "-ab" in the man page i linked, nor in "avconv -h". Is it documented someplace?

    also, there's another option, '-b', which is for bitrate, right? Wouldn't that potentially conflict?

    also, no point trying to make my ouput bitrate higher than the input bitrate, right?
    Interesting point and I have a nasty suspicion you're right about the -ab option as I've just looked and can't find it either, but having just used it without any errors to make a mp3 file at both bitrates, it has apparently worked, and mediainfo reports the two output files as being at either the 320 or 128 kb/s.

    I am baffled! And with "man avconv" being 5672 lines in length it is not exactly easy reading. Perhaps you need to wait for an avconv expert to come along and answer.

    You are absolutely right, however, about the quality of the input file being the limiting factor, and there being no point in turning a 128kb/s file into a 320kb/s file.

  6. #6
    Join Date
    Aug 2007
    Beans
    66

    Re: How To Set Mp3 Quality in avconv?

    i wonder if -ab is a shorthand for "audio bitrate".

    any ideas about my issue, above, re 2-pass?

    also, is 0 not best quality?

    thx!
    Last edited by johny why; September 4th, 2015 at 08:59 PM.

  7. #7
    Join Date
    Dec 2006
    Beans
    7,359

    Re: How To Set Mp3 Quality in avconv?

    Quote Originally Posted by ajgreeny View Post
    The command that mc4man shows will, however, probably give a better variable bitrate quality; the -aq figures go from 1 for the best to 9 for the lowest and 6 is often good enough for general listening or recordings of speech, but with storage space being so cheap these days why not go for a better quality.
    Mind you conventional wisdom is that rather than use a high bitrate mp3 (of the 320k type) you should use a lossless format such as flac, alac or wavpack... Then the argument that 'storage space is cheap' has very real meaning. I am in the process of converting my music to alac (via qaac and abcde) for this reason.
    You think that's air you're breathing now?

  8. #8
    Join Date
    Aug 2007
    Beans
    66

    Re: How To Set Mp3 Quality in avconv?

    Quote Originally Posted by andrew.46 View Post
    you should use a lossless format such as flac, alac or wavpack... Then the argument that 'storage space is cheap' has very real meaning.
    Thank you very much for this superb info. My current purpose is Android playback, which i believe those formats can't do. But i'm always on a quest for holy grail formats. i appreciate it.

  9. #9
    Join Date
    Dec 2006
    Beans
    7,359

    Re: How To Set Mp3 Quality in avconv?

    Quote Originally Posted by johny why View Post
    Thank you very much for this superb info. My current purpose is Android playback, which i believe those formats can't do. But i'm always on a quest for holy grail formats. i appreciate it.
    I am a little out of touch with Android but from dim memory vlc runs on Android, and this should be able to playback many of the codecs I have mentioned. But I have been wrong before
    You think that's air you're breathing now?

  10. #10
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,267
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How To Set Mp3 Quality in avconv?

    Quote Originally Posted by johny why View Post
    i wonder if -ab is a shorthand for "audio bitrate".

    any ideas about my issue, above, re 2-pass?

    also, is 0 not best quality?

    thx!

    -ab became -b:a a while back in avconv as in ffmpeg so easiest conversion goes thus:

    Code:
    avconv -i input.flac -b:a 320k output.mp3

    it knows to use the right codec for mp3 ; and change 320 for 64,128,156,192,224,256, to suit your wish does the same as -q in effect
    change flac for mp4 in your case


    IF you want to do a bulk conversion place them all in one folder and run this:

    Code:
    for f in *.flac; do avconv -i "$f" -b:a 320k  "${f%.flac}.mp3"; done
    Last edited by shantiq; September 5th, 2015 at 04:32 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •