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: Join FLAC files on decoding process (Read 11244 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Join FLAC files on decoding process

Is it possible by command line to join more FLAC files on decoding process and write to stdout?

Join FLAC files on decoding process

Reply #1
Code: [Select]
sox file1.flac file2.flac ..... fileN.flac -t wav -

Join FLAC files on decoding process

Reply #2
For something like this using Foobar's converter is much easier. Avisynth is even another option, but it can be done by command line:

Code: [Select]
ffmpeg.exe -i track1.flac -i track2.flac -i track3.flac ... -i trackN.flac -filter_complex "[0:0][1:0][2:0][3:0][4:0][5:0][6:0][7:0]concat=n=8:v=0:a=1" -f wav - | Takc.exe -e -pMax -ihs - album.tak

Code: [Select]
ffmpeg.exe -i "concat:track1.flac|track2.flac|track3.flac|...|trackN.flac" -f wav - | Takc.exe -e -pMax -ihs - album.tak

or as phofman has pointed out...
Code: [Select]
sox.exe track1.flac track2.flac track3.flac ... trackN.flac -t wav - | Takc.exe -e -pMax - album.tak

Note that for transcoding to Opus, for ffmpeg you'd need -f s16le instead of -f wav and for sox you'd need -t raw instead of -t wav.

Join FLAC files on decoding process

Reply #3
For something like this using Foobar's converter is much easier.


Easier is a relative term. I am done with the task using CLI tools before foobar even starts up  Of course it requires a decent shell of which cmd is not a good example.

Join FLAC files on decoding process

Reply #4
I'm a Linux user. I would be able to get something like this:
Code: [Select]
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3

Join FLAC files on decoding process

Reply #5
I'm a Linux user. I would be able to get something like this:
Code: [Select]
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3


You have been already given two ways - sox, ffmpeg

Code: [Select]
sox track1.flac track2.flac track3.flac -t wav - | lame - joined_tracks.mp3


What is wrong with that?


Join FLAC files on decoding process

Reply #7
I'm looking for a Linux script to decode and concatenate on fly without using extra software as SOX or FFmpeg.
SOX and FFmpeg are valid tools but I'd like to harness the Linux script power.

Join FLAC files on decoding process

Reply #8
You've been offered two nice power lawn mowers and you decide you can't even use a push mower.

Enjoy watching your grass grow, I guess.


Join FLAC files on decoding process

Reply #9
SOX and FFmpeg are valid tools but I'd like to harness the Linux script power.


Well then I am afraid it is time for your to learn the linux script power yourself, not ask others to do it for you :-)

Join FLAC files on decoding process

Reply #10
I'm a Linux user. I would be able to get something like this:
Code: [Select]
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3

Interesting. I didn't know flac.exe accepts multiple inputs just like sox.exe. BUT unlike sox and ffmpeg, with flac's (piped) output you can hear a nasty click on each transition. Maybe I'm forgetting something, I don't know.
Btw, lame.exe needs -r (raw input) to handle flac's output.

Join FLAC files on decoding process

Reply #11
BUT unlike sox and ffmpeg, with flac's (piped) output you can hear a nasty click on each transition.
That sounds like it's outputting wav headers. Add --force-raw-format to the command line.

Join FLAC files on decoding process

Reply #12
I'm looking for a Linux script to decode and concatenate on fly without using extra software as SOX or FFmpeg.
SOX and FFmpeg are valid tools but I'd like to harness the Linux script power.

Harnessing the power of the Windows command shell, I came up with this:
Code: [Select]
for %%i in (*.flac) do flac -d "%%i" --endian=little --sign=signed --force-raw-format -c >> merged.raw
lame -r --signed --little-endian merged.raw merged.mp3
del merged.raw

I guess you can do something less verbose (avoid the tempfile) in Linux bash/csh/whatever and also Windows cmd/Powershell, but that is pretty straightforward.
It's only audiophile if it's inconvenient.

Join FLAC files on decoding process

Reply #13
I'm a Linux user. I would be able to get something like this:
Code: [Select]
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3


Code: [Select]
flac -d -c --force-raw-format --endian=little --sign=signed *.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3

Join FLAC files on decoding process

Reply #14
Perhaps a bit off-topic, but what about TAK? Takc.exe doesn't accept flac's output that way.

Join FLAC files on decoding process

Reply #15
Code: [Select]
flac -d -c --force-raw-format --endian=little --sign=signed *.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3
Sometimes I hate that Windows cmd doesn't expand the wildcard operator...  Time to use Powershell.

Perhaps a bit off-topic, but what about TAK? Takc.exe doesn't accept flac's output that way.
You could use SoX to add a WAV header to that raw output stream, since Takc apparently doesn't accept raw input. Isn't it fun running in circles?
It's only audiophile if it's inconvenient.


Join FLAC files on decoding process

Reply #17
Code: [Select]
flac -d -c --force-raw-format --endian=little --sign=signed *.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3
Sometimes I hate that Windows cmd doesn't expand the wildcard operator...  Time to use Powershell.

Although cmd doesn't expand wildcard,  flac 1.3.0 will expand it for you.
That's the side effect of new flac using __wgetmainargs() function, in order to support Unicode pathnames on Windows.

Join FLAC files on decoding process

Reply #18
Code: [Select]
flac -d -c --force-raw-format --endian=little --sign=signed *.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3

This is wonderful, it works!
I tried this and it works also:

Code: [Select]
flac -cd --force-raw-format --endian=little --sign=signed track1.flac track2.flac track3.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3


Thanks!