[FFmpeg-user] encode five wav files to one Dolby Prologic II encoded file

Martin Thomas Schrott list at mtsonline.at
Sun Mar 5 21:18:10 EET 2023


Hey Guys,


after days of reading documentary, searching the net and all lists, 
trying and loosing, I hope someone here can help me to succeed.


I read, some say ffmpeg is not capable of encoding, others say ffmpeg 
can do it. Some say it misses the phaseshift of the surround channels, 
others and the docu tell, it can.

So after all I found, I would guess ffmpeg should be able to take five 
wav files as input and output one wav file in stereo, that is correctly 
dolby Prologic II encoded including the phaseshifts. But I cannot find 
how this has to be done to work correctly and there is not a single 
example anywhere to be found.


I tryed countless ways so I post one of them and hope you can guide me 
where to go or what to change to be successful. :-)


This one is with manual phaseshift of the default 0.0 that should be 90 
degrees for the two back channels, as nowhere is stated if the 
matrix_encoding does apply this automatically.

/Applications/ffmpeg -y -i bl.wav -af aphaseshift bl_phaseshift.wav

/Applications/ffmpeg -y -i br.wav -af aphaseshift br_phaseshift.wav



/Applications/ffmpeg -y -i fl.wav -i fc.wav -i fr.wav -i 
bl_phaseshift.wav -i br_phaseshift.wav -map 0 -map 1 -map 2 -map 3 -map 
4 -af aresample=matrix_encoding=dplii surround.wav


it gives an error, that a wav file exactly expects one stream. I thought 
the matrix_encoding would output the five wav files in one stereo stream?

If I change to .aac as output I would get a file, but this would not be 
a correctly encoded Dolby Prologic II file. This would have distroyed 
back channels.

Same if I do not apply the phaseshift manually.


So I am doing something wrong - anybody here who can help me to find the 
correct commands?

Would be so thankful. I also did not find a working solution without 
ffmpeg, so if someone has an alternative this also would be okay - even 
I would prefer the ffmpeg way :-)



best wishes,

Martin




More information about the ffmpeg-user mailing list