'FFmpeg upmix command stereo ~> 5.1
I need to upmix stereo mkv files with chapter, subtitle, audio and video streams to 5.1 flac with a silent center channel. The audio is a single stereo stream, not two mono streams. I need the resulting mkv to contain a single 6 channel flac stream.
My desired channel layout is FR = FR, FR ~> SR, FL = FL, FL ~> SL, Center silent, LFE = FR+FL
I followed the FFmpeg documentation and was unable to produce the desired mapping.
The command so far (generated with help from Axiom GUI):
./ffmpeg -i TestIN.mkv -c:v copy -map 0:v? -map_chapters 0 -c:s copy -map 0:s? -c:a flac -sample_fmt s16 -rematrix_maxval 1.0 -ac 6 -map 0:a:0? -map_metadata 0 -f matroska -threads 0 X:\TestOUT.mkv
Any help would be greatly appreciated.
Solution 1:[1]
Use the pan filter:
ffmpeg -i input.mkv -filter_complex "[0:a]pan=5.1(side)|FL=FL|FR=FR|LFE<FL+FR|SL=FL|SR=FR[a]" -map 0 -map -0:a -map "[a]" -c copy -c:a flac output.mkv
Solution 2:[2]
To avoid precisely same audio in front and rear they can be filtered:
SL=FL-FR|SR=FR-FL
I made a test with two channel mono audio and rear channels were muted.
Also, if you want to decrease the volume in rear channels use a decimal factor:
SL=0.3*FL-0.3*FR|SR=0.3*FR-0.3*FL
I believe there are more sophisticated ways than these but could not find any.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | llogan |
Solution 2 |