Related to this thread in the german doom9/Gleitz board (http://forum.gleitz.info/showthread.php?t=38560):
A user would like to use ffmpeg as generic input decoder and NeroAacEnc as AAC encoder, receiving input via pipe from ffmpeg. In general, this works even with multi-channel sources. Just the channel mapping in the output of ffmpeg seems to be not in the order one should use to feed NeroAacEnc.
Is there a solution preferably without the need to store intermediate files?
Already discussed here:
http://forum.doom9.org/showthread.php?p=1192821#post1192821 (http://forum.doom9.org/showthread.php?p=1192821#post1192821)
Regarding the intermediate solution, there might be a tool that can read from stdin and write to stdout and does the channel reordering. Maybe SoX can do that?
That's the same "Selur"; he forgot his account details here at HA.
SoX is indeed a suggestion he will gladly test.
sox should do it, if you can construct the cli from the incredibly sparse docs.
Regarding the intermediate solution, there might be a tool that can read from stdin and write to stdout and does the channel reordering. Maybe SoX can do that?
Seems sox don't accept the incomplete wav header send by ffmpeg (worse than the old neroaacenc):
ffmpeg -i test.ac3 -acodec pcm_s16le -ac 6 -f wav -ar 48000 - | sox -t wav - -t wav - remix 2 4 3 1 5 6 | neroAacEnc -ignorelength -if - -of audio.mp4
...
\sox wav: Length in output .wav header will be wrong since can't seek to fix it
av_interleaved_write_frame(): Error while opening file
We need a intermediate wav file to do the conversion properly:
ffmpeg -i test.ac3 -acodec pcm_s16le -ac 6 -f wav -ar 48000 z1.wav
sox -t wav z1.wav -t wav - remix 2 4 3 1 5 6 | neroAacEnc -ignorelength -if - -of audio.mp4
BTW, Windows users only need:
eac3to test.ac3 audio.mp4
(neroaacenc at same folder than eac3to, libav decoder used like ffmpeg).
Regarding the intermediate solution, there might be a tool that can read from stdin and write to stdout and does the channel reordering. Maybe SoX can do that?
Seems sox don't accept the incomplete wav header send by ffmpeg (worse than the old neroaacenc):
ffmpeg -i test.ac3 -acodec pcm_s16le -ac 6 -f wav -ar 48000 - | sox -t wav - -t wav - remix 2 4 3 1 5 6 | neroAacEnc -ignorelength -if - -of audio.mp4
...
\sox wav: Length in output .wav header will be wrong since can't seek to fix it
av_interleaved_write_frame(): Error while opening file
We need a intermediate wav file to do the conversion properly:
ffmpeg -i test.ac3 -acodec pcm_s16le -ac 6 -f wav -ar 48000 z1.wav
sox -t wav z1.wav -t wav - remix 2 4 3 1 5 6 | neroAacEnc -ignorelength -if - -of audio.mp4
BTW, Windows users only need:
eac3to test.ac3 audio.mp4
(neroaacenc at same folder than eac3to, libav decoder used like ffmpeg).
If SoX doesn't like ffmpeg's wav header then the obvious solution is to send headerless PCM
ffmpeg -i test.ac3 -f u16le -acodec pcm_s16le - | sox -t raw -s -2 -c6 -r48000 - -t wav - remix 2 4 3 1 5 6 | neroAacEnc.exe -ignorelength -if - -of audio.mp4
Be careful about channel counts and sample rates. Without headers it's your responsibility to send them.
If SoX doesn't like ffmpeg's wav header then the obvious solution is to send headerless PCM
ffmpeg -i test.ac3 -f u16le -acodec pcm_s16le - | sox -t raw -s -2 -c6 -r48000 - -t wav - remix 2 4 3 1 5 6 | neroAacEnc.exe -ignorelength -if - -of audio.mp4
Be careful about channel counts and sample rates. Without headers it's your responsibility to send them.
Yep, this work now.
But, obviously, we must know previously the channel count and samplerate. If ffmpeg output the correct channel order this workaround is unnecessary.