You are not logged in.

#1 2014-12-15 19:06:59

stefano
Member
Registered: 2011-04-09
Posts: 287

[SOLVED] Using ffmpeg to convert Flac to mp3 320

The handy script used to convert flac to mp3  in the wiki [1] converts to the format V0.
I want to modify it to convert flac files to a fixed bitrate of 320,
but I cannot find the proper option in ffmpeg documentation.

the relevant line in the (very simple)  is

 < /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"

now, the ffmpeg option -qscale: a is only valid for variable bitrate encodings.

What would be the option for fixed bitrate?

The closest suggestion I got is from ffmepg's website, where the documentation lists the following among the audio options:

-ar[:stream_specifier] freq (input/output,per-stream)

    Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. 
    For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. 

But I am lost on how to use this option.

Help appreciated










[1] https://wiki.archlinux.org/index.php/Co … lac_to_Mp3

Last edited by stefano (2014-12-15 22:14:49)

Offline

#2 2014-12-15 20:05:01

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Using ffmpeg to convert Flac to mp3 320

Why do you need this particular quality?

You can first decode flac then use 'lame <infile> <outfile> -b 320' w/o ffmpeg.
https://wiki.archlinux.org/index.php/Co … out_FFmpeg

Last edited by karol (2014-12-15 20:05:42)

Offline

#3 2014-12-15 22:01:31

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: [SOLVED] Using ffmpeg to convert Flac to mp3 320

I pipe flac input into

lame -S --noreplaygain --preset insane

wink

Offline

#4 2014-12-15 22:14:35

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: [SOLVED] Using ffmpeg to convert Flac to mp3 320

karol wrote:

Why do you need this particular quality?

Long story....

But I found the solution using ffmpeg on an ubuntu forum. Apparently the correct parameter is:

-c:a libmp3lame -b:a 320k

so a version of the wiki's script for 320 fixed bit rate conversion would be:

#!/bin/bash

for a in *.flac; do
  < /dev/null ffmpeg -i "$a" -c:a libmp3lame -b:a 320k "${a[@]/%flac/mp3}"
done

Offline

#5 2014-12-16 01:27:06

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: [SOLVED] Using ffmpeg to convert Flac to mp3 320

I see no reason to use a bitrate of 320k when encoding with lame. FLAC achieves any need for archiving, and lame VBR of 0-4 normally achieves transparency.

Offline

Board footer

Powered by FluxBB