Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
15th July 2020, 01:02 | #1 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
ffmpeg downmix 7.1 -> 5.1
The simple way to do the downmix 7.1 -> 5.1 is:
Code:
ffmpeg -i INPUT71 -af "pan=5.1(side)|FL=FL|FR=FR|FC=FC|LFE=LFE|SL=0.5*BL+0.5*SL|SR=0.5*BR+0.5*SR" OUT51.wav Then I make a separated chain for the surround channels with: Code:
ffmpeg -i INPUT71 -filter_complex "asplit [f][s]; \ [f] pan=4c|c0=c0|c1=c1|c2=c2|c3=c3 [r]; \ [s] pan=2c|c0=0.5*c4+0.5*c6|c1=0.5*c5+0.5*c7, \ acontrast=2, aformat=sample_fmts=s16:channel_layouts=stereo [d]; \ [r][d] amerge=inputs=2,pan=5.1(side) [a]" -map "[a]" OUT51.wav Only the previous command work without errors, the output wav have the format, length, ... correct, but is empty. I only obtain silence. Please, there are some ffmpeg guru than can help me.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 15th July 2020 at 01:26. Reason: typo |
15th July 2020, 21:48 | #3 | Link | ||||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
Quote:
The alimiter don't work for me, distort very much the signal. The best, for me, is: Code:
compand=attacks=0:decays=0:points=-90/-84|-10/-4|-6/-2|-0/-0.3 Quote:
Thanks, only adding the obvious: |c0=c0|c1=c1|c2=c2|c3=c3|c4=c4|c5=c5 work now. One more question: Quote:
For what is downsampled to 16 bits? The filters can't work with more precission?
__________________
BeHappy, AviSynth audio transcoder. |
||||
16th July 2020, 10:00 | #5 | Link | |
Registered User
Join Date: Jan 2012
Posts: 271
|
Quote:
As compand works with dblp sample format only you could use aformat=dblp prior to calling pan. For outputing 24bit sample format use pcm_s24be/le codec. |
|
16th July 2020, 18:47 | #6 | Link | |||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
With this command line:
Quote:
Quote:
Any comments? 2) Without aformat=channel_layouts=stereo I obtain: Quote:
__________________
BeHappy, AviSynth audio transcoder. |
|||
16th July 2020, 20:21 | #8 | Link | ||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
I don't understand what is the problem, but we can live with that.
Quote:
Quote:
But ok, that is my final command line recommended to downsample 7.1 -> 5.1 with ffmpeg: Code:
FFMPEG -i 8v341.dts -filter_complex "asplit [f][s]; \ [f] pan=3.1|c0=c0|c1=c1|c2=c2|c3=c3 [r]; \ [s] pan=stereo|c0=0.5*c4+0.5*c6|c1=0.5*c5+0.5*c7, \ compand=attacks=0:decays=0:points=-90/-84|-10/-4|-6/-2|-0/-0.3, \ aformat=channel_layouts=stereo [d]; \ [r][d] amerge [a]" -map "[a]" -c:a pcm_s24le zz51.wav
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 16th July 2020 at 20:25. |
||
16th July 2020, 20:29 | #9 | Link |
Guest
Posts: n/a
|
I don't understand ffmpeg's logic either. AFAIK, if you specify .wav, you get 16-bit simply because it's the default for wav (regardless of context). It's not like eac3to, which attempts to adopt logical behavior based on the nature of the conversion. With ffmpeg, you have to specify everything; otherwise, you get the defaults.
Last edited by Richard1485; 16th July 2020 at 20:45. |
14th January 2021, 11:46 | #10 | Link |
Registered User
Join Date: Mar 2011
Posts: 59
|
"But I want preserve the volume balance between front and surround channels,"
Do you mean preserve the positioning between front/side/back? Traditionally, Side is just mixed 100% into back for 71>51. But you want to change this. ## Pan law If you want to do this, you might typically go 0.5*side into front & back so that 0.5+0.5=1. However, the perceived volume will be reduced by 3dB since 1 mono source is played into 2 speakers. The correct coefficients for equal power, is 0.7*side into front & back. 0.7+0.7=1.4. It looks wrong, but sounds correct in 5.1. When you then downmix this to stereo, the side will sound too loud since 0.7+0.7=1.4. But if you did 0.5, it will sound correct. This is the dilemma. You can now see why Traditionally, Side is just mixed 100% into back. The positioning is not preserved, but the volume for the side will be correct regardless if you do successive downmixing 71>51>20. Alternatively, you can use the compromise coefficient of 0.6 ## Implementation Instead of using FFMPEG to make a file, mpv supports FFMPEG filters. Or you can use the matrix mixer in AC3filter. |
14th January 2021, 22:04 | #11 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
The mix is 50% + 50% to avoid clip but the compand amplify by 2 most the time without clip.
__________________
BeHappy, AviSynth audio transcoder. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|