Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In all cases the conversion breaks and the program displays the message such as:
Code:
Playing MPEG stream from file.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
-: 2% complete, ratio=0.509
[3:53] Decoding of file.mp3 finished.
-: WARNING: unexpected EOF; expected 536870900 samples, got 10289152 samples
-: ERROR during read of data pad byte
or:
Code:
Playing: file.ogg
Ogg Vorbis stream: 2 channel, 44100 Hz
Done.
-: WARNING: unexpected EOF; expected 536870900 samples, got 10289152 samples
-: ERROR during read of data pad byte
All such conversions doesn’t produce any *.flac file. It seems flac doesn’t accept minus sign for the standard input although flac manual allows to use it.
So my question is how I can use the standard input in order to decode audio data with flac?
It makes no sense to convert an mp3 file to flac.
If you think flac sounds better than mp3: no, because with the mp3 encoding part of the musical information is cut in favour of a high compression rate, an irreversible process. The resulting flac audio will sound as limited as the mp3 version did, but it will take more disk space.
But if you insist try:
Code:
ogg123 -d wav -f - file.ogg | flac -0 file.flac
I removed the unneccesary dash after the flac command and replaced the character 'o' with a true zero.
ERROR: can't open input file file.flac: No such file or directory
You removed - and -o switches. In result flac interprets non-existing file.flac as source file but it can’t find it. So your tip is completely useless, Sjonnie48.
I’m not here to argue whether these or the other conversions have or haven’t point. I’m preparing audio converter and I’d like to allow in it different conversions. These two from MP3 and OGG to FLAC are two from thirty one conversions I try to implement. Now all conversions work except for three conversions from M4A, MP3, and OGG to FLAC.
What’s interesting the conversion from FLAC to FLAC works well:
Code:
flac -d -c file.flac | flac - -o file.flac.flac
The conversions from APE and MPC to FLAC work well too while the mentioned above conversions from M4A, MP3, and OGG to FLAC fail. It seems flac, mac, and mpcdec programs send valid data to standard output, while faad, mpg321, and ogg123 don’t send the information about the size of the data and flac fails to convert it.
To convert M4A files to FLAC ones I use the command:
Code:
faad -o - file.m4a | flac - -o file.flac
As I mentioned above that command fails displaying the message:
Code:
0% decoding file.m4a.
flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.
-: ERROR: 'data' subchunk has size of 0
I’m aware I can convert these files to WAV ones and then convert WAV ones to FLAC ones but I’d like to avoid that. So my question is still the same: how I can convert audio files from M4A, MP3, and OGG formats to FLAC one using standard output and standard input (or alternatively fifo).
The decoding part works for me using 'mpg123 -s file.mp3' in place of your 'mpg321' bit. However, you will need to give the '--endian' '--sign' '--channels' '--bps' and '--sample-rate' options to flac, as it will be trying to encode from a raw format.
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309
Original Poster
Rep:
As I mentioned before I’m not here to argue whether these or the other conversions have or haven’t point. I prepared the tool for the users. I leave the decision which conversions they’ll use to them.
It makes no sense to convert an mp3 file to flac.
If you think flac sounds better than mp3: no, because with the mp3 encoding part of the musical information is cut in favour of a high compression rate, an irreversible process. The resulting flac audio will sound as limited as the mp3 version did, but it will take more disk space.
Exactly.
@ w1k0- Why do you want to convert lossy to lossless?
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309
Original Poster
Rep:
I don’t want to convert MP3, or OGG, or the other lossy format files to lossless FLAC ones except for the testing purposes. I mentioned for the two times I wrote a script converting from different formats to FLAC, MP3, OGG, and WAV ones. It performs thirty one conversions in total. I don’t deliberate which conversions have point and which haven’t it. I prepared the tool. I left the decision how to use it to the users.
The hammer is the tool too. Most people don’t use the hammer to hit their heads. Some people do that. The producer of the hammers is aware some people will use them in an inappropriate way. He produces the hammers despite of that.
In an old French comic strip its hero named Pif tries autosuggestion. He repeats for the many times: “I have the head of wood. I have the head of wood”. Then he hits his head with a hammer. As a result a big bump appears. Pif says: “Here’s the wooden bump”.
FLAC file get from MP3 or OGG one is a wooden bump.
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309
Original Poster
Rep:
Maybe I should mention that sox reads MP3 files when compiled with lame and mad libraries support. Usually it requires the recompilation of sox with the following patch:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.