Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Easiest way to convert my flac files using the ffmpeg library? (Read 25258 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?

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/

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.
It's only audiophile if it's inconvenient.

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 #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

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.

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.
It's only audiophile if it's inconvenient.


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.

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?

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).

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
It's only audiophile if it's inconvenient.

 

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" ?

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.
"I hear it when I see it."

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?
"I hear it when I see it."

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.

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.

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."