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. |
2nd December 2024, 10:01 | #1 | Link |
Registered User
Join Date: Feb 2011
Posts: 51
|
Help with channel up- & downmixing using ffmpeg
Hello,
I'm trying to remix some channels, e.g. layout "L R C LFE Ls Rs" 5.1 as well as "L R" 2.0 to the 5.1 channel layout "C L R Ls Rs LFE". On top of that, I need to remix "L R C LFE Ls Rs" 5.1 to "L R" stereo. I will also have to resample some parts. The reason is that I need to stitch some audio tracks with different sample sizes and channel layouts together to match multiple main feature audio tracks. All files are PCM/Wav64 audio, which I intend to just concatenate. But for that to work, the layouts and sample sizes need to match. Resampling is super easy, but remixing is royally confusing me. With one of the sources which comes in the layout "L R C LFE Ls Rs" I tried this for instance: Code:
ffmpeg -i input.w64 -filter_complex "pan=5.1|c0=c2|c1=c0|c2=c1|c3=c4|c4=c5|c5=c3[a]" -map "[a]" -ac 6 -acodec pcm_s24le output.w64 The result is confusing me, however, as mediainfo now claims the resulting file has the layout "L R C LFE Lb Rb". Huh? And I haven't even started upmixing the stereo parts or downmixing the surround parts yet... So in my helplessness, I ran to the great machine god (ChatGPT) and asked it to fix my mess, but it didn't produce anything that would've worked either. Most commands it gave me only produced errors. So here I am, asking for help. Inputs that require remixing: 1.) 2.0: Layout "L R", sample size 16 bits 2.) 5.1: Layout "L R C LFE Ls Rs", sample size 24 bits My desired outputs: a.) 2.0: Layout "L R", sample size 16 bits b.) 5.1: Layout "C L R Ls Rs LFE", sample size 24 bits All files come with a 48 kHz sampling frequency. Every single input file needs to be remixed and partially resampled to match each given output format. So "1." needs to be converted to both "a." and "b." and "2." needs the same. If possible, I'd like not to throw channels away entirely, so that the resulting streams lose as little audio information as possible. For getting the channel layouts I use mediainfo, as mentioned, in the hope that it produces correct information. It would be really nice if you could give me the correct commands for this, and even nicer if you could explain them to me as well, so I can finally understand this stuff. Thanks a lot!
__________________
Proud owner of a 3dfx Voodoo5 6000 AGP HiNT Rev.A-3700 prototype No RISC, no fun! |
3rd December 2024, 01:37 | #2 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 7,160
|
Quote:
For what do you need that channel order? Please don't mistake the internal order in any codec format with the order in wav/w64 format. Any encoder must translate the order in wav/w64 source to the internal codec order.
__________________
BeHappy, AviSynth audio transcoder. |
|
4th December 2024, 09:59 | #3 | Link | |
Registered User
Join Date: Feb 2011
Posts: 51
|
Quote:
Additionally, there are some logos, notices and some epilogue for this feature, but they come as separate files (it's a community project). I think it's either linked MKVs, or the viewer was expected to just watch them one after another. Those additional files have either no audio, or audio that does not match the main features audio. I want to stitch that all together doing simple concatenation. So the idea was:
I'm worried that concatenating multiple .w64 streams with different channel layouts ("L R C LFE Ls Rs" & "C L R Ls Rs LFE") will quite likely mess the resulting stream up. Thank you very much!
__________________
Proud owner of a 3dfx Voodoo5 6000 AGP HiNT Rev.A-3700 prototype No RISC, no fun! Last edited by GrandAdmiralThrawn; 4th December 2024 at 14:31. |
|
4th December 2024, 11:34 | #4 | Link |
Registered User
Join Date: Mar 2011
Posts: 63
|
1. As Teba said, "C L R Ls Rs LFE" is an internal order useful mainly to developers, not editors. "L R C LFE Ls Rs" is used for editing & playback.
ED: If you're encoding to DTS, most encoders accept the latter input, or single channels as input. Please perform a full workflow test including listening to see what happens. 2. If you're upmixing, chances are you're going to mess it up (ruin balance, image, downmix compatibility) if you don't know what youre doing. Just pad 2ch to 5.1ch with silence on other channels. 3. cat may or may not work, audio files have headers at the start/end to tell the specifications. At best, you will end up with small glitches & playable files. At worst, you may end up with broken files. Best to use a media or audio app to join. Last edited by junh1024; 4th December 2024 at 12:06. |
6th December 2024, 09:24 | #5 | Link | ||||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 7,160
|
Quote:
Read also about dwChannelMask in that link. I put the channel names in Microsoft wav style, see here the equivalences with MediaInfo or other names. Quote:
Quote:
Use ffmpeg: ffmpeg -i 01.w64 -i 02.w64 -filter_complex "concat=n=2:v=0:a=1" output.w64 To convert parts 2.0 to the main audio 5.1 you can use also: ffmpeg -i 20.w64 -af "surround=lfe_out=0" 51.w64 Quote:
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 6th December 2024 at 09:28. |
||||
6th December 2024, 13:07 | #6 | Link |
Registered User
Join Date: Feb 2011
Posts: 51
|
Thank you very much, I will just try it out and listen to my output before progressing further, especially at the positions where streams intersect.
Also thanks for the tip about padding the 5.1 stream with silent audio! I was just assuming I could cat wav/w64 together because I tried this before and it just worked without any glitches. It may depend on the decoder I guess. I will follow your suggestion about doing this with ffmpeg instead though, better safe than sorry.
__________________
Proud owner of a 3dfx Voodoo5 6000 AGP HiNT Rev.A-3700 prototype No RISC, no fun! |
Tags |
ffmpeg, remixing |
Thread Tools | Search this Thread |
Display Modes | |
|
|