Hello,
I was trying to create a batch command to easily convert popular lossless file formats (flac, tak, ape, ...) to lossyFLACs.
The plan was to use ffmpeg for the decoding stage - but I failed...
I started to create lossy WAVs first:
Can someone shed some light why this command doesn't work:
ffmpeg -i test.flac -f wav - | lossywav -
Error:
Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred
While this one works (and produces a "stdin.lossy.wav" output file as expected):
flac -d test.flac -c | lossywav -
Maybe it's the way lossyWAV works, because this one is working (though it doesn't make much sense):
ffmpeg -i test.flac -f wav - | qaac - -o test.m4a
.sundance.
When piping to stdout, ffmpeg writes zero in size field of data chunk.
Therefore, receiver usually requires option like --ignorelength to read it.
As for qaac, it will automatically falls back into ignore length mode if size field of data chunk is zero. Strictly speaking it may not be spec compliant, but I think it's much likely the case that data is coming from ffmpeg than user actually wants to pass zero length audio to qaac, so I think it's more "convenient" for users.
So, since lossyWAV hasn't got an option like "ignore-length", is there a solution for ffmpeg to output correct length information?
Or is using a temporary WAV file the only way to go?
So, since lossyWAV hasn't got an option like "ignore-length", is there a solution for ffmpeg to output correct length information?
Or is using a temporary WAV file the only way to go?
Try something like the following, it seems to work here:
ffmpeg -v 0 -i foo.flac -f wav - | qaac --silent -D - -o - | lossywav -
Here, qaac plays a role to convert size field of data chunk coming from ffmpeg to 0xffffffff, which qaac uses as a placeholder when input length is unknown.
Maybe other commands can do this as long as it has --ignorelenth like option, and writes sane size field to the pipe.
ffmpeg.exe -i "lossless.flac" -f wav - | lossyWAV.exe - -I -- | flac.exe --ignore-chunk-sizes -8 -b 512 - -o "lossy.flac"
This works for me.
Oh, thanks. I should have checked lossywav command line.
-I is shown by --longhelp.
I'm using lossyWAV v1.3.0 and -I is not shown @ --longhelp.
What version are you guys using?
In lossyWAV v1.3.0 a zero length file would cause an error. This has been changed in recent beta versions, along with added handling of WAVE64 and RF64 file formats.
Thanks Nick, nu774 and CoRoNe for the valuable pointers - will try the latest beta...
lossyWAV beta 1.3.0c 15/09/2012- Piped I/O implemented - please report problems
[/size]
I believe Nick.C added it in this version, so you'd be better off by downloading the latest version I guess.
I am trying to pipe M4A to WAV and back to M4A applying SoX equalization during the WAV phase:
... | [ffmpeg] -i - -c:a aac -strict -2 -b:a 320k -f adts -
This last part is not working and it may be because I do not know how to specify the stdout file type is M4A. Is it possible to do so?