I'm recording video with a Blackmagic card and the input has 5.1 audio. Apparently it's a longstanding flaw of Blackmagic cards that the center channel is #4 and the LFE is #3, when it is supposed to be the other way around. The result is my video has quiet dialogue since the center (dialogue heavy) channel is being interpreted as the LFE. How can I flip these two channels to their proper positions without re-encoding?
I've heard ffmpeg can do it with a specific command, but have not been able to find anything for my situation in particular.
Thanks.
+ Reply to Thread
Results 1 to 28 of 28
-
-
-
From the link above:
Remap channels
The channelmap audio filter can re-arrange the channel layout. For example, to switch the FL and FR channels in a 5.1 input:
ffmpeg -i input.wav -filter_complex "channelmap=map=FL-FR|FR-FL|FC-FC|LFE-LFE|BL-BL|BR-BR:channel_layout=5.1" output.wav
ffmpeg -i input.wav -filter_complex "channelmap=map=FL-FL|FR-FR|FC-LFE|LFE-FC|BL-BL|BR-BR:channel_layout=5.1" output.wavLast edited by ProWo; 1st Feb 2023 at 09:46. Reason: typo
-
-
-
-
Is the original big or little endian?
-c:a pcm_s24be => 24bit big endian
-c:a pcm_s24le => 24bit little endian -
-
-
I don't know, might be a bug, you'd have to file a bug report , if it's not already reported
The search isn't great on their bug reporting site, but you'd check synonyms and related phrases
https://trac.ffmpeg.org/timeline
You'd need the full console report , you can add -report to the command line to write it to a text file
5.1.2 is considered "ancient" by developers, you have to check the git head, so today's version, or depending on where you are, that's "expired" already . They won't accept a bug report if your ffmpeg build is even a day old -
WAV file format is 32bit, so has a 4GB limit. You file is 6+GB. You must save as another format, such as W64 (the 64bit variant of wav) or something else, like FLAC.
Scott -
Thanks, I just tried FLAC using:
"ffmpeg -i C:\Users\Admin\Videos\AUDIOFIX.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-LFE|LFE-FC|BL-BL|BR-BR:channel_layout=5.1" -c:a pcm_s24le output.flac"
and it failed with the error: "[flac @ 000002515ff589c0] Invalid audio stream. Exactly one FLAC audio stream is required.
[out#0/flac @ 000002515ff588c0] Could not write header (incorrect codec parameters ?): Invalid argument
[vost#0:1/png @ 000002515fee4f00] Error initializing output stream:"
I tried W64 (by changing output extension from .wav to .w64 in the code) and it processed the output file which has the right size and correct properties in MediaInfo, but I can't get it to play in anything.Last edited by Boxcart; 2nd Feb 2023 at 17:55.
-
If source is in a mkv container, did you try putting it in a mkv container ? If there is video as well, you can use -c:v copy
Code:ffmpeg -i C:\Users\Tom\Videos\AUDIOFIX.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-LFE|LFE-FC|BL-BL|BR-BR:channel_layout=5.1" -c:a pcm_s24le output.mkv"
-
Last edited by Boxcart; 2nd Feb 2023 at 17:55.
-
Why swap the audio later in a 2nd step? It would take even longer. You should be able to swap it in the same command at the same time. Or what are the details of the "video" or your situation ?
Use a different source and destination drives -
I'm not in front of the PC right now but I will give that a try. Will this code provided above accomplish that?
Code:ffmpeg -i C:\Users\Admin\Videos\AUDIOFIX.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-LFE|LFE-FC|BL-BL|BR-BR:channel_layout=5.1" -c:a pcm_s24le output.mkv"
Last edited by Boxcart; 2nd Feb 2023 at 17:55.
-
If "AUDIOFIX.mkv" has the video stream as well, add -c:v copy to copy the video stream at the same time . Otherwise you need to use 2 inputs and -map to specify which streams
To specify different destination drive, you can set the path of output.mkv
Code:ffmpeg -i C:\Users\Tom\Videos\AUDIOFIX.mkv -c:v copy -filter_complex "channelmap=map=FL-FL|FR-FR|FC-LFE|LFE-FC|BL-BL|BR-BR:channel_layout=5.1" -c:a pcm_s24le "D:\someotherpath\output.mkv"
-
Last edited by Boxcart; 2nd Feb 2023 at 17:54.
-
I'm guessing the "much slower" was because you had video, and it was re-encoding the video because you didn't specify a video codec for -c:v (it defaults to libx264)
-c:v copy means copy the video stream. Stream copy should be very fast
-vn means discard the video stream - so it would be audio only in the mkv container if you wanted to do something in another step -
Similar Threads
-
Why do subs change when encoding to x265?
By Unknown01 in forum Newbie / General discussionsReplies: 6Last Post: 14th Nov 2022, 09:40 -
Missing Channels on Atmos Audio
By Loup in forum Video ConversionReplies: 5Last Post: 18th Apr 2022, 02:35 -
Encoding audio in DTS in multi-channels with ffmpeg.
By Malkovich in forum Video ConversionReplies: 20Last Post: 13th Jul 2021, 17:14 -
can i copy an audio cd with 4 channels?
By rama in forum AudioReplies: 15Last Post: 23rd Dec 2019, 23:19 -
Re-encoding audio and video to lower bitrate and change channel to mono
By DennisO in forum AudioReplies: 7Last Post: 26th Dec 2018, 14:25