Skip to main content

Topic: Easiest way to convert my flac files using the ffmpeg library? (Read 17775 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Easiest way to convert my flac files using the ffmpeg library?
This is an odd request, but I use audiogalaxy, which has problems with libFLAC, but not ffmpeg. I was wondering if there's a program that would make it easy to convert my flac library using ffmpeg?

  • Fandango
  • [*][*][*][*][*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #1
Uhm, is it that Audiogalaxy? The one which was one of the first peer-to-peer music sharing services in the 90s?

Anyway, a little bit of more information about what it is that you are actually trying to do would be helpful. Convert FLAC to what for example?

Easiest way to convert my flac files using the ffmpeg library?
Reply #2
Uhm, is it that Audiogalaxy? The one which was one of the first peer-to-peer music sharing services in the 90s?

Anyway, a little bit of more information about what it is that you are actually trying to do would be helpful. Convert FLAC to what for example?


I'm actually converting flac to flac. But instead of using LibFlac, I want to use ffmpeg (which is what Audiogalaxy uses to decode).

btw, audiogalaxy is actually a streaming service now... You can stream your whole music collection to your android device and what have you: http://audiogalaxy.com/

  • Kohlrabi
  • [*][*][*][*][*]
  • Global Moderator
Easiest way to convert my flac files using the ffmpeg library?
Reply #3
The program making it easy to convert FLAC with ffmpeg is... ffmpeg. You can use it as a command line encoder for say foobar2000 or EAC with no problems:
Code: [Select]
ffmpeg -i inputfile -vn -sn -acodec flac out.flac

You can specify "-aq x" to tune the compression ratio at the cost of compression speed.

To use it as command line encoder in foobar2000 you can use pipes:
Code: [Select]
ffmpeg -i - -vn -sn -acodec flac %d


I'm still unsure what the point of converting FLAC to FLAC really is, though.
  • Last Edit: 27 April, 2011, 05:09:12 AM by Kohlrabi
It's only audiophile if it's inconvenient.

  • _m²_
  • [*][*][*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #4
Code: [Select]
ffmpeg & copy /b in.flac out.flac

Easiest way to convert my flac files using the ffmpeg library?
Reply #5
Aight. Sorry to be such a noob, but I really am when it comes to encoding... where would I get the ffmpeg. exe to use in foobar?

Easiest way to convert my flac files using the ffmpeg library?
Reply #6
Aight. Sorry to be such a noob, but I really am when it comes to encoding... where would I get the ffmpeg. exe to use in foobar?

you can try http://win32.libav.org/

and you can use the -compression_level option for better compression.  the -aq option has no effect, as quality is not an issue since flac is lossless.

Easiest way to convert my flac files using the ffmpeg library?
Reply #7
I'm just going to post a screen of my setup for the encoder:



And here's what happens when I try to convert




no idea what I'm doing wrong here, lol
  • Last Edit: 27 April, 2011, 10:12:48 PM by Fractal_Mortality

  • marc2003
  • [*][*][*][*][*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #8
try removing "ffmpeg" in the parameters - the encoder dialog is already pointed directly at the .exe file.
  • Last Edit: 28 April, 2011, 03:02:01 AM by marc2003

  • Kohlrabi
  • [*][*][*][*][*]
  • Global Moderator
Easiest way to convert my flac files using the ffmpeg library?
Reply #9
the -aq option has no effect, as quality is not an issue since flac is lossless.

You sure that -aq isn't mapped to compression level? Damned if ffmpeg doesn't try to keep its option names consistent.  Let's hope libav will have proper documentation of options.
  • Last Edit: 28 April, 2011, 04:20:57 AM by Kohlrabi
It's only audiophile if it's inconvenient.

Easiest way to convert my flac files using the ffmpeg library?
Reply #10
try removing "ffmpeg" in the parameters - the encoder dialog is already pointed directly at the .exe file.


That worked, thanks

Easiest way to convert my flac files using the ffmpeg library?
Reply #11
the -aq option has no effect, as quality is not an issue since flac is lossless.

You sure that -aq isn't mapped to compression level? Damned if ffmpeg doesn't try to keep its option names consistent.  Let's hope libav will have proper documentation of options.

I'm sure. -compression_level is for lossless, -aq is for lossy. I'll try to add an entry in the Libav docs for the flac encoder at some point in the near future.

  • RastaMan
  • [*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #12
Tried, over and over again to use the 'compression_level switch in FFmpeg to convert a file to FLAC at a certain compression level. Totally uselsss. File size was the same no matter what level I chose. Switch doesn't work at all. Docs I've seen at their web site say nothing about FLAC, or any other lossless codec. IMO, if people want to use FFmpeg to do lossless conversion, they should just say no. Total waste of time.

Easiest way to convert my flac files using the ffmpeg library?
Reply #13
Tried, over and over again to use the 'compression_level switch in FFmpeg to convert a file to FLAC at a certain compression level. Totally uselsss. File size was the same no matter what level I chose. Switch doesn't work at all. Docs I've seen at their web site say nothing about FLAC, or any other lossless codec. IMO, if people want to use FFmpeg to do lossless conversion, they should just say no. Total waste of time.

It works just fine for me. Always has. I use avconv now, but the commandline options are still the same as ffmpeg.

avconv -i test.wav -compression_level 1 -y test.flac
bitrate= 798.7kbits/s   
avconv -i test.wav -compression_level 12 -y test.flac
bitrate= 715.8kbits/s   

What is the command are you're using?

  • danutz
  • [*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #14
avconv -i test.wav -compression_level 1 -y test.flac
bitrate= 798.7kbits/s   
avconv -i test.wav -compression_level 12 -y test.flac
bitrate= 715.8kbits/s


Sorry for the zombie thread, but I've searched for a long time and the above is the answer: -compression_level must occut after -i. Amazingly, if you put the level before -i, it gets ignored (and the default FLAC compression_level of 5 gets used). I've searched for the answer for quite a while, as I have to convert m4a's to flac's losslessly (and I prefer the smaller size of course).
  • Last Edit: 17 December, 2013, 12:55:27 AM by danutz

  • Kohlrabi
  • [*][*][*][*][*]
  • Global Moderator
Easiest way to convert my flac files using the ffmpeg library?
Reply #15
Sorry for the zombie thread, but I've searched for a long time and the above is the answer: -compression_level must occut after -i. Amazingly, if you put the level before -i, it gets ignored (and the default FLAC compression_level of 5 gets used).
It gets ignored, because options before the -i are options regarding the following input file, not the output file:
Code: [Select]
ffmpeg <inputoptions> -i infile <inputoptions2> -i infile2 ... <outputoptions> outfile
  • Last Edit: 17 December, 2013, 02:22:20 AM by Kohlrabi
It's only audiophile if it's inconvenient.

  • SokilOff
  • [*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #16
Sorry for bumping this ancient thread.

I need to specify the output format as "-acodec copy" to extract audio from container file (i.e. matroska) without re-encoding. I use ffmpeg.exe as encoder and "-i - -vn -sn -acodec copy %d" as parameters, but it gives me this error: "An error occurred while writing to file (The encoder has terminated prematurely with code 1 (0x00000001); please re-check parameters)"

It works if I give it specific output format i.e. "-acodec flac" or "-acodec mp3", but is there a way to make it work with "-acodec copy" ?

  • xnor
  • [*][*][*][*][*]
  • Developer
Easiest way to convert my flac files using the ffmpeg library?
Reply #17
You are probably trying to put audio of a format into a container that does not support that format.

E.g. if your mkv contains AAC audio then you have to put it into an mp4 or m4a.
  • Last Edit: 28 September, 2015, 11:06:42 AM by xnor
"I hear it when I see it."

  • xnor
  • [*][*][*][*][*]
  • Developer
Easiest way to convert my flac files using the ffmpeg library?
Reply #18
Oh you are using the decoded audio as input? What are you trying to do actually? What are the formats involved?
  • Last Edit: 28 September, 2015, 11:15:08 AM by xnor
"I hear it when I see it."

  • SokilOff
  • [*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #19
Source file: mkv container with audio and video.
The task is: to extract audio only using foobar converter.

If I specify "-acodec flac" to extract the audiostream as flac (-i - -vn -sn -acodec flac -y %d) or "-acodec mp3" (-i - -vn -sn -acodec mp3 -y %d) to extract it as mp3, everything works. But if I use "-acodec copy" (to store audio as is), I get that error.

If I do it directly from the command line (f.i. "ffmpeg -i file.mkv -vn -sn -acodec copy -y file.mp3", assuming that output file has the same format as the one stored in mkv) everything works as it should.
  • Last Edit: 28 September, 2015, 11:28:18 AM by SokilOff

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Easiest way to convert my flac files using the ffmpeg library?
Reply #20
It's not possible to do anything without re-encoding with foobar2000 converter.
But you can use foo_run to run ffmpeg.

  • xnor
  • [*][*][*][*][*]
  • Developer
Easiest way to convert my flac files using the ffmpeg library?
Reply #21
Yup, foobar2000 decodes the audio of your input file then feeds it your encoder for re-encoding. That's the way it is.
"I hear it when I see it."

  • SokilOff
  • [*]
Easiest way to convert my flac files using the ffmpeg library?
Reply #22
But you can use foo_run to run ffmpeg.

Thank you for the hint ! Now I'll need to figure out how to do it using foobar internal syntax.