Log in

View Full Version : Ac3 with ffmpeg


DVB-Freak
12th July 2012, 20:45
Hello,

From 6 Monowavs I want to create a Ac3(5.1)-file with ffmpeg.
I use the following command:

c:\ffmpeg.exe -i d:\audio\test.L.wav -i d:\audio\test.R.wav -i d:\audio\test.C.wav -i d:\audio\test.LFE.wav -i d:\audio\test.SL.wav -i d:\audio\test.SR.wav -acodec ac3 -ab 448k -ac 6 d:\audio\test.ac3

Ffmpeg take only the 1st input, so the ac3 isn't correct.
Can someone explain, where is the mistake?

Thanks

tebasuna51
13th July 2012, 00:39
ffmpeg only accept one input file.

You can use Aften:
Aften -b 448 -ch_fl L.wav -ch_fr R.wav -ch_fc C.wav -ch_lfe LFE.wav -ch_sl SL.wav -ch_sr SR.wav test.ac3

Kurtnoise
13th July 2012, 07:41
you have to use avfilter (http://ffmpeg.org/libavfilter.html) (amix option)...

spawnbsd
13th July 2012, 08:26
Ffmpeg take only the 1st input, so the ac3 isn't correct.
Can someone explain, where is the mistake?

Try using SoX to combine them (see below), and then feed into ffmpeg/libav. I wouldn't recommend using Aften, the code isn't maintained, it lacks channel coupling and libav/ffmpeg's AC3 encoder has long surpassed it in quality.


%soxbin% -M audio_temp.L.wav audio_temp.R.wav audio_temp.C.wav audio_temp.LFE.wav audio_temp.SL.wav audio_temp.SR.wav audio_6-channel_TMP.w64

%libavbin% -i audio_6-channel_TMP.w64 -y -acodec ac3 -ab 640k -channel_coupling 1 audio.ac3

ramicio
13th July 2012, 16:36
%soxbin% -M audio_temp.L.wav audio_temp.R.wav audio_temp.C.wav audio_temp.LFE.wav audio_temp.SL.wav audio_temp.SR.wav audio_6-channel_TMP.w64

%libavbin% -i audio_6-channel_TMP.w64 -y -acodec ac3 -ab 640k -channel_coupling 1 audio.ac3


Why not just try to pipe it instead of taking up all that time and space?

sox -M L.wav R.wav C.wav LFE.wav SL.wav SR.wav -t w64 - | ffmpeg -i - -y -codec ac3 -ab 640k -channel_coupling 1 output.ac3

spawnbsd
13th July 2012, 20:04
Why not just try to pipe it instead of taking up all that time and space?

sox -M L.wav R.wav C.wav LFE.wav SL.wav SR.wav -t w64 - | ffmpeg -i - -y -codec ac3 -ab 640k -channel_coupling 1 output.ac3

Oh definitely, I just cut that out of a larger script of mine, where piping wasn't possible (its a larger script for 7.1 -> 5.1 w/ EX processing).

ramicio
13th July 2012, 20:06
I see.

DVB-Freak
14th July 2012, 08:30
@spanwnbsd
@ramicio

Thanks for your reply. I have the following commandline:
c:\sox\sox.exe -M d:\audio\test.L.wav d:\audio\test.R.wav d:\audio\test.C.wav d:\audio\test.LFE.wav d:\audio\test.SL.wav d:\audio\test.SR.wav -t test.w64 -
But there comes only an error:
c:\sox\sox.exe FAIL formats: no handler for given file type `test.w64'
Can you help me?

DVB-Freak
14th July 2012, 14:00
Hello,

Thanks all for the help. I have found a way to feed ffmpeg,
but you pointed me to the solution.

ramicio
14th July 2012, 17:18
The -t switch is to specify a file type, like for when you use pipe, because pipe isn't a file or filename, and gives sox no clue as to what format you want.

Reino
7th September 2013, 22:46
From 6 Monowavs I want to create a Ac3(5.1)-file with ffmpeg.ffmpeg -i fl.wav -i fr.wav -i fc.wav -i lfe.wav -i bl.wav -i br.wav ^
-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6" -c:a ac3 merge.ac3

raffriff42
8th September 2013, 01:43
ffmpeg.exe -i fl.wav -i fr.wav -i fc.wav -i lfe.wav -i bl.wav -i br.wav ^
-filter_complex "join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-LFE|4.0-BL|5.0-BR" ^
-ac 6 -channel_layout 5.1 -acodec ac3 -ab 448k merged.ac3

tebasuna51
8th September 2013, 11:06
raffriff42 was deleted the previous post like "redundant", but I think, if work, is good to know alternative syntax to solve the problem.

ffmpeg have many options unknow for many users (like me).

Maybe is a good idea open a post like "ffmpeg audio mannagement" to explain alternatives to common audio tasks than be solved with eac3to, sox or BeHappy/AviSynth.

There are a volunteer than know ffmpeg to do the job?

Selur
15th September 2013, 21:54
I agree, the whole ffmpeg audio filter stuff is relatively new and there aren't many usable examples (I'm aware off).