View Full Version : audio encoding with ffmpeg | sox | ffmpeg
cameris
14th October 2009, 15:35
Hi,
I have a problem to encode audio tracks in my encoding script. It uses ffmpeg to encode to aac and for 5.1 tracks also sox to get the channel order right. I have tested it on a couple of tv-series (longest was 45 min) and everything has worked great.
But now I have tested it on some full featured movies and on every 5.1 audio track it hangs aroung 80MB (output file, bitrate: 128k) and I dont have a clue why. It doesnt give a error message neither quits, it just stops doing anything.
The command for 5.1 looks like this:
ffmpeg -i $input -async 1 -vsync 1 -v 0 -map $map -vn -sn -ac 6 -acodec pcm_s16le -ar $afreq -f wav - | \
sox -t raw -s -2 -c 6 -r $afreq - -t wav - remix -m 6 5 1 2 3 4 | \
ffmpeg -i - -ac 6 -v 0 -y -acodec libfaac -ab $audioquality $audiofile
Has anybody has an idea why?
nm
14th October 2009, 15:47
Does the same thing happen if you redirect WAV data from the first ffmpeg process or sox to a file? If not, what happens when you encode that file?
However, I'd recommend switching to neroAacEnc if you're on x86(-64). It's much better than FAAC.
cameris
14th October 2009, 19:04
I have testet ffmpeg | sox -> wav, no error. But when encoding the wav to aac I've got
[pcm_s16le @ 0x9970d60]invalid PCM packet.3kbits/s
Error while decoding stream #0.0
I also tried a 6ch -> 2ch downmix without any problem.
Is nero really that much better? I thought the difference is only noticeable on bitrates below 128k.
If I try it, do I still need sox for channel ordering or does nero do the work?
nm
14th October 2009, 19:53
I have testet ffmpeg | sox -> wav, no error. But when encoding the wav to aac I've got
[pcm_s16le @ 0x9970d60]invalid PCM packet.3kbits/s
Error while decoding stream #0.0
Ok, I guess you're hitting the 4 GB WAV (RIFF) file size limit. I'm not sure if there's a workaround other than using raw PCM audio (http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-March/002541.html). NeroAACEnc has -ignorelength parameter that should allow you to read larger than 4 GB WAV files.
Is nero really that much better? I thought the difference is only noticeable on bitrates below 128k.
Perhaps for stereo, but you're encoding 5.1-channel audio. 128 kbps is actually a pretty low bitrate for that -- especially when using FAAC.
Also, while I haven't done a listening test myself, I'd guess that FAAC loses badly to both Lame and neroAACEnc at 128kbps stereo.
If I try it, do I still need sox for channel ordering or does nero do the work?
Nope, you'll probably need to order them first.
Selur
14th October 2009, 20:43
did you also try to use named pipes instead of | ?
cameris
15th October 2009, 13:26
Ok, I guess you're hitting the 4 GB WAV (RIFF) file size limit. I'm not sure if there's a workaround other than using raw PCM audio (http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-March/002541.html). NeroAACEnc has -ignorelength parameter that should allow you to read larger than 4 GB WAV files.
The WAV files had 3.8 GB, so I tried nero and it worked like a charm, only order had to be changed.
eventually my script is working :cool:. Many :thanks: ...
nm
15th October 2009, 13:49
The WAV files had 3.8 GB
Ok, then there may be some lower limit between 2 GB and 4 GB in ffmpeg WAV demuxer.
eventually my script is working :cool:. Many :thanks: ...
Cheers!
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.