IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Join FLAC files on decoding process
mikilion
post Sep 14 2013, 12:56
Post #1





Group: Members
Posts: 4
Joined: 14-September 13
From: Italy
Member No.: 110097



Is it possible by command line to join more FLAC files on decoding process and write to stdout?
Go to the top of the page
+Quote Post
phofman
post Sep 14 2013, 16:59
Post #2





Group: Members
Posts: 329
Joined: 14-February 12
Member No.: 97162



CODE
sox file1.flac file2.flac ..... fileN.flac -t wav -
Go to the top of the page
+Quote Post
CoRoNe
post Sep 15 2013, 12:33
Post #3





Group: Members
Posts: 186
Joined: 31-May 05
From: Netherlands
Member No.: 22417



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


--------------------
DC-Bass Source Mod: http://reino.degeelebosch.nl
Go to the top of the page
+Quote Post
phofman
post Sep 15 2013, 17:41
Post #4





Group: Members
Posts: 329
Joined: 14-February 12
Member No.: 97162



QUOTE (CoRoNe @ Sep 15 2013, 13:33) *
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 smile.gif Of course it requires a decent shell of which cmd is not a good example.
Go to the top of the page
+Quote Post
mikilion
post Sep 16 2013, 13:08
Post #5





Group: Members
Posts: 4
Joined: 14-September 13
From: Italy
Member No.: 110097



I'm a Linux user. I would be able to get something like this:
CODE
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3
Go to the top of the page
+Quote Post
phofman
post Sep 16 2013, 13:46
Post #6





Group: Members
Posts: 329
Joined: 14-February 12
Member No.: 97162



QUOTE (mikilion @ Sep 16 2013, 14:08) *
I'm a Linux user. I would be able to get something like this:
CODE
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3


You have been already given two ways - sox, ffmpeg

CODE
sox track1.flac track2.flac track3.flac -t wav - | lame - joined_tracks.mp3


What is wrong with that?
Go to the top of the page
+Quote Post
greynol
post Sep 16 2013, 15:51
Post #7





Group: Super Moderator
Posts: 10256
Joined: 1-April 04
From: San Francisco
Member No.: 13167



I looked at an old script to see how do it. I decoded to PCM, concatenated and reencoded. I would have used Sox had I thought to try.


--------------------
Your eyes cannot hear.
Go to the top of the page
+Quote Post
mikilion
post Sep 29 2013, 16:27
Post #8





Group: Members
Posts: 4
Joined: 14-September 13
From: Italy
Member No.: 110097



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.
Go to the top of the page
+Quote Post
greynol
post Sep 29 2013, 16:31
Post #9





Group: Super Moderator
Posts: 10256
Joined: 1-April 04
From: San Francisco
Member No.: 13167



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.

dry.gif

This post has been edited by greynol: Sep 29 2013, 16:55


--------------------
Your eyes cannot hear.
Go to the top of the page
+Quote Post
phofman
post Sep 29 2013, 17:03
Post #10





Group: Members
Posts: 329
Joined: 14-February 12
Member No.: 97162



QUOTE (mikilion @ Sep 29 2013, 17:27) *
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 :-)
Go to the top of the page
+Quote Post
CoRoNe
post Sep 29 2013, 17:24
Post #11





Group: Members
Posts: 186
Joined: 31-May 05
From: Netherlands
Member No.: 22417



QUOTE (mikilion @ Sep 16 2013, 14:08) *
I'm a Linux user. I would be able to get something like this:
CODE
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.


--------------------
DC-Bass Source Mod: http://reino.degeelebosch.nl
Go to the top of the page
+Quote Post
Octocontrabass
post Sep 29 2013, 18:35
Post #12





Group: Members
Posts: 61
Joined: 9-September 13
Member No.: 110004



QUOTE (CoRoNe @ Sep 29 2013, 09:24) *
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.
Go to the top of the page
+Quote Post
Kohlrabi
post Sep 29 2013, 20:56
Post #13





Group: Super Moderator
Posts: 1114
Joined: 12-March 05
From: Kiel, Germany
Member No.: 20561



QUOTE (mikilion @ Sep 29 2013, 17:27) *
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
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.

This post has been edited by Kohlrabi: Sep 29 2013, 21:00


--------------------
It's only audiophile if it's inconvenient.
Go to the top of the page
+Quote Post
skamp
post Sep 29 2013, 21:14
Post #14





Group: Developer
Posts: 1453
Joined: 4-May 04
From: France
Member No.: 13875



QUOTE (mikilion @ Sep 16 2013, 14:08) *
I'm a Linux user. I would be able to get something like this:
CODE
flac -cd track1.flac track2.flac track3.flac  | lame - joined_tracks.mp3


CODE
flac -d -c --force-raw-format --endian=little --sign=signed *.flac | lame -r --signed --little-endian --preset standard - joined_tracks.mp3


--------------------
See my profile for measurements, tools and recommendations.
Go to the top of the page
+Quote Post
CoRoNe
post Sep 29 2013, 21:46
Post #15





Group: Members
Posts: 186
Joined: 31-May 05
From: Netherlands
Member No.: 22417



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


--------------------
DC-Bass Source Mod: http://reino.degeelebosch.nl
Go to the top of the page
+Quote Post
Kohlrabi
post Sep 30 2013, 07:10
Post #16





Group: Super Moderator
Posts: 1114
Joined: 12-March 05
From: Kiel, Germany
Member No.: 20561



QUOTE (skamp @ Sep 29 2013, 22:14) *
CODE
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... sad.gif Time to use Powershell.

QUOTE (CoRoNe @ Sep 29 2013, 22:46) *
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?

This post has been edited by Kohlrabi: Sep 30 2013, 07:33


--------------------
It's only audiophile if it's inconvenient.
Go to the top of the page
+Quote Post
CoRoNe
post Sep 30 2013, 09:36
Post #17





Group: Members
Posts: 186
Joined: 31-May 05
From: Netherlands
Member No.: 22417



wacko.gif
That's why I much prefer Foobar for this task! biggrin.gif


--------------------
DC-Bass Source Mod: http://reino.degeelebosch.nl
Go to the top of the page
+Quote Post
nu774
post Sep 30 2013, 09:59
Post #18





Group: Developer
Posts: 562
Joined: 22-November 10
From: Japan
Member No.: 85902



QUOTE (Kohlrabi @ Sep 30 2013, 15:10) *
QUOTE (skamp @ Sep 29 2013, 22:14) *
CODE
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... sad.gif 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.
Go to the top of the page
+Quote Post
mikilion
post Oct 7 2013, 15:50
Post #19





Group: Members
Posts: 4
Joined: 14-September 13
From: Italy
Member No.: 110097



QUOTE (skamp @ Sep 29 2013, 22:14) *
CODE
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
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!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 27th November 2014 - 15:32