View Full Version : How to use flaccl in combination with ffmpeg&sox ?
Selur
11th May 2013, 00:39
When I call:
"G:\Hybrid\ffmpeg.exe" -y -analyzeduration 500000000 -threads 8 -v -10 -i "H:\Temp\iId_2_aid_1_01_19_56_0910_05.mp3" -ac 2 -acodec pcm_s16le -f wav - | "G:\Hybrid\CUETools.FLACCL.cmd.exe" -5 -o "H:\Output\iId_2_aid_1_01_19_56_091005.flac" -
the output is properly produced, but if I add sox to the mix:
"G:\Hybrid\ffmpeg.exe" -y -analyzeduration 500000000 -threads 8 -v -10 -i "H:\Temp\iId_1_aid_1_01_11_20_6710_01.mp3" -ac 2 -f sox - | "G:\Hybrid\sox.exe" --multi-threaded --temp "H:\Temp" --buffer 524288 -t sox - -b 16 -t wavpcm - | "G:\Hybrid\CUETools.FLACCL.cmd.exe" -5 -o "H:\Output\iId_1_aid_1_01_11_20_671001.flac" -
it aborts with
Error : Incomplete file read.
I suspect this might be due to a warning sox throws:
"WARN wav: Length in output .wav header will be wrong since can't seek to fix it"
Does anyone know what really is the problem and how to fix it?
I don't want to:
a. skip sox, since I'd like to do some additional filtering through sox
or
b. create a temporal wav file
Cu Selur
Kurtnoise
11th May 2013, 11:06
did you try with the --ignore-length sox switch ?
Selur
11th May 2013, 11:14
I doubt it since the message doesn't come from sox, it comes from flacl, so I never thought about it.
-> tried it and flaccl still returns 'Error : Incomplete file read. '
LoRd_MuldeR
11th May 2013, 14:05
Well, the warning from SoX is quite clear. When using a pipe, it clearly is not possible to go back to the beginning of the stream and write the correct size into the RIFF/WAVE header, like it would be possible with a physical file. Consequently, all that SoX can do is writing a dummy/fake WAVE header at the beginning of the stream, whose size field typically will contain something like 0x00000000 or 0xFFFFFFFF. This is fine, as long as the application, who is going to read the stream, is prepared to deal with this kind of dummy/fake WAVE header. Or that application at least has an option to ignore the size filed of the WAVE header (which means it will just "blindly" continue reading until no more data can be read). In case this does not apply to FLACCL, there unfortunately is no way around the problem, except for modifying the FLACCL program.
(I think using "--ignore-length" with SoX doesn't help here, because it is not SoX but FLACCL which has to cope with the dummy/fake WAVE header)
Selur
11th May 2013, 14:09
Okay, so the question is: "Should flaccl be able to handle this and what I experience is a bug, or is this a missing feature?"
LoRd_MuldeR
11th May 2013, 14:15
Well, FLACCL is doing the "right" thing. You are piping something into FLACCL that looks like a WAVE file, but the size field in the WAVE/RIFF header contains a nonsense value (for the reason explained above).
I would not call this a bug, because failing on invalid input cannot be blamed on the application. On the other hand, adding support for handling dummy/fake WAVE headers would be a legitimate feature request.
As a matter of fact, it unfortunately is a common practice to use such dummy/fake WAVE headers when piping PCM data from one application to another - due to the lack of a better/standardized alternative.
Selur
11th May 2013, 14:21
Thanks, will post a feature request over at http://sourceforge.net/projects/cuetoolsnet/
-> https://sourceforge.net/p/cuetoolsnet/bugs/17/
tebasuna51
11th May 2013, 17:15
Flac encoder have the parameter --ignore-chunk-sizes for this purpose.
Selur
11th May 2013, 17:17
yeah, but flaccl doesn't have that parameter,...
Usage : CUETools.FLACCL.exe [options] <input.wav>
Options:
-0 .. -11 Compression level, default 7; 9..11 are non-subset
-o <file> Output filename, or "-" for stdout, or nul
-p # Padding bytes
-q --quiet Quiet mode
--verify Verify during encoding
--no-md5 Don't compute MD5 hash
--no-seektable Don't generate a seektable
--cpu-threads Use additional CPU threads
OpenCL Options:
--opencl-type <X> CPU or GPU, default GPU
--opencl-platform 'ATI Stream', 'NVIDIA CUDA', 'Intel OpenCL' etc
--group-size # Set GPU workgroup size (64,128,256)
--task-size # Set number of frames per multiprocessor, default 8
--slow-gpu Some encoding stages are done on CPU
--fast-gpu Experimental mode, not recommended
--define <X> <Y> OpenCL preprocessor definition
Advanced Options:
-b # Block size
-s <method> Stereo decorrelation (independent,search)
-r #[,#] Rice partition order {max} or {min},{max} (0..8)
LPC options:
-w <func>[,<func>] Window functions (bartlett,welch,hann,flattop,tukey)
-l #[,#] Prediction order {max} or {min},{max} (1..32)
--max-precision Coefficients precision search (0..1)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.