VideoHelp Forum
+ Reply to Thread
Results 1 to 28 of 28
Thread
  1. 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.
    Quote Quote  
  2. Originally Posted by jack_666 View Post
    Thanks - I read through that but couldn't find an option for my specific situation. It doesn't seem like that one is described there.
    Quote Quote  
  3. 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
    So your command is
    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.wav
    Last edited by ProWo; 1st Feb 2023 at 10:46. Reason: typo
    Quote Quote  
  4. Originally Posted by ProWo View Post
    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
    I see. So if I have it correctly I would do "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.wav" ?
    Quote Quote  
  5. Originally Posted by Boxcart View Post
    I see. So if I have it correctly I would do "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.wav" ?
    Yes
    Quote Quote  
  6. Originally Posted by ProWo View Post
    Originally Posted by Boxcart View Post
    I see. So if I have it correctly I would do "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.wav" ?
    Yes
    Great thanks I'll give this a try. And I'd assume this would be lossless given the lack of encoding following this process?
    Quote Quote  
  7. Yes, it's lossless.
    Quote Quote  
  8. Originally Posted by ProWo View Post
    Yes, it's lossless.
    Alright I was able to get it to work to fix the channels however it does not appear lossless. The input audio was 6,912 kb/s, 48 kHZ, 24 bits, 6 channel, and the output is 4,608 kb/s, 48 kHZ, 16bits, 6 channels. I used the exact command above. This is from MediaInfo.
    Quote Quote  
  9. Is the original big or little endian?

    -c:a pcm_s24be => 24bit big endian
    -c:a pcm_s24le => 24bit little endian
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    Is the original big or little endian?

    -c:a pcm_s24be => 24bit big endian
    -c:a pcm_s24le => 24bit little endian
    Little
    Quote Quote  
  11. Add to the command line before the output file:

    Code:
    -c:a pcm_s24le
    Quote Quote  
  12. Originally Posted by poisondeathray View Post
    Add to the command line before the output file:

    Code:
    -c:a pcm_s24le
    Thanks, it's now processing losslessly but failing with the error "Filesize 6045185208 invalid for wav, output file will be broken." The output file sounds great and MediaInfo confirms lossless/same but there's only 80 minutes out of a 2 hour input mkv.
    Quote Quote  
  13. what ffmpeg version are you using ? Try git version or a very recent version
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    what ffmpeg version are you using ? Try git version or a very recent version
    I tried with the latest 5.1.2 version from VideoHelp and a version from github, same problem.
    Quote Quote  
  15. 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
    Quote Quote  
  16. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    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
    Quote Quote  
  17. Originally Posted by Cornucopia View Post
    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 18:55.
    Quote Quote  
  18. 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"
    Quote Quote  
  19. Originally Posted by poisondeathray View Post
    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\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"
    I attempted it but cancelled it since it's running much, much slower that way. Assuming it works I could let it do it and then swap the audio in the mkv's?
    Last edited by Boxcart; 2nd Feb 2023 at 18:55.
    Quote Quote  
  20. 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
    Quote Quote  
  21. Originally Posted by poisondeathray View Post
    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"
    Thanks!
    Last edited by Boxcart; 2nd Feb 2023 at 18:55.
    Quote Quote  
  22. Originally Posted by Boxcart View Post

    I'm not in front of the PC right now but I will give that a try. Will this code provided above accomplish that?

    Originally Posted by poisondeathray View Post
    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


    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"
    Quote Quote  
  23. Originally Posted by poisondeathray View Post
    Originally Posted by Boxcart View Post

    I'm not in front of the PC right now but I will give that a try. Will this code provided above accomplish that?

    Originally Posted by poisondeathray View Post
    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


    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\Admin\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"
    The video stream are identical. I'll give it a shot, thanks again
    Last edited by Boxcart; 2nd Feb 2023 at 18:54.
    Quote Quote  
  24. Originally Posted by Boxcart View Post
    Originally Posted by ProWo View Post
    Yes, it's lossless.
    Alright I was able to get it to work to fix the channels however it does not appear lossless. The input audio was 6,912 kb/s, 48 kHZ, 24 bits, 6 channel, and the output is 4,608 kb/s, 48 kHZ, 16bits, 6 channels. I used the exact command above. This is from MediaInfo.
    Do you really need 24 bit audio?
    Quote Quote  
  25. 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
    Quote Quote  
  26. Originally Posted by ProWo View Post
    Originally Posted by Boxcart View Post
    Originally Posted by ProWo View Post
    Yes, it's lossless.
    Alright I was able to get it to work to fix the channels however it does not appear lossless. The input audio was 6,912 kb/s, 48 kHZ, 24 bits, 6 channel, and the output is 4,608 kb/s, 48 kHZ, 16bits, 6 channels. I used the exact command above. This is from MediaInfo.
    Do you really need 24 bit audio?
    Yes, since that's the output I'm capturing and I'm going for lossless.
    Quote Quote  
  27. All set, that latest idea of doing the whole mkv worked. Thanks!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!