Handbrake’s stereo downmixing of an MKV 5.1 audio track results in “Center” being right channel and...












2















So I have successfully used Handbrake (version 1.1.2) to convert many large MKV files into smaller, iOS and macOS compatible video files I can play on my iPhone and MacBook Air for a while without really having any issues until this one specific movie.



When I convert it with Handbrake using default “General” settings of seemingly any type—Fast, Very Fast, HQ or Super HQ—the audio downmixing from 5.1 audio results in weird stereo with essentially all of the audio going to the right channel and the left channel seems to have some channel that is just—for lack of a better term—background remnants. Just enough sound to not be silent but utterly no music or dialogue or anything is really audible.



I can play it on VLC (version 3.0.6) on my MacBook Air and I get the same odd sound through my speakers; heavy right barely anything left. But if I set the audio of VLC to “Headphones”… Wow! It becomes a normal stereo downmix.



What is happening and what can I do to properly downmix this? I hope I can do this in Handbrake, but if not I assume I would have to extract the AC3 out of the MKV, downmix it in some other tool and then toss it back into the MKV?



Details of the audio track here using ffmpeg -i:



Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : English
BPS-eng : 384000
DURATION-eng : 01:36:42.624000000
NUMBER_OF_FRAMES-eng: 181332
NUMBER_OF_BYTES-eng: 278525952


Details of the audio track here using mkvmerge --identify is:



Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AC-3)


Details of the audio track here using mkvinfo is:



| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3241101187
| + Track type: audio
| + Forced track flag: 1
| + Codec ID: A_AC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Name: English
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6


Details of the audio track here using exiftool is:



Track Number                    : 2
Track Type : Audio
Track Forced : Yes
Audio Codec ID : A_AC3
Default Duration : 32 ms
Track Name : English
Audio Sample Rate : 48000
Audio Channels : 6









share|improve this question


















  • 2





    I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

    – Gyan
    Jan 21 at 6:22











  • @Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

    – JakeGould
    Jan 21 at 6:28











  • @Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

    – JakeGould
    Jan 23 at 2:46
















2















So I have successfully used Handbrake (version 1.1.2) to convert many large MKV files into smaller, iOS and macOS compatible video files I can play on my iPhone and MacBook Air for a while without really having any issues until this one specific movie.



When I convert it with Handbrake using default “General” settings of seemingly any type—Fast, Very Fast, HQ or Super HQ—the audio downmixing from 5.1 audio results in weird stereo with essentially all of the audio going to the right channel and the left channel seems to have some channel that is just—for lack of a better term—background remnants. Just enough sound to not be silent but utterly no music or dialogue or anything is really audible.



I can play it on VLC (version 3.0.6) on my MacBook Air and I get the same odd sound through my speakers; heavy right barely anything left. But if I set the audio of VLC to “Headphones”… Wow! It becomes a normal stereo downmix.



What is happening and what can I do to properly downmix this? I hope I can do this in Handbrake, but if not I assume I would have to extract the AC3 out of the MKV, downmix it in some other tool and then toss it back into the MKV?



Details of the audio track here using ffmpeg -i:



Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : English
BPS-eng : 384000
DURATION-eng : 01:36:42.624000000
NUMBER_OF_FRAMES-eng: 181332
NUMBER_OF_BYTES-eng: 278525952


Details of the audio track here using mkvmerge --identify is:



Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AC-3)


Details of the audio track here using mkvinfo is:



| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3241101187
| + Track type: audio
| + Forced track flag: 1
| + Codec ID: A_AC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Name: English
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6


Details of the audio track here using exiftool is:



Track Number                    : 2
Track Type : Audio
Track Forced : Yes
Audio Codec ID : A_AC3
Default Duration : 32 ms
Track Name : English
Audio Sample Rate : 48000
Audio Channels : 6









share|improve this question


















  • 2





    I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

    – Gyan
    Jan 21 at 6:22











  • @Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

    – JakeGould
    Jan 21 at 6:28











  • @Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

    – JakeGould
    Jan 23 at 2:46














2












2








2








So I have successfully used Handbrake (version 1.1.2) to convert many large MKV files into smaller, iOS and macOS compatible video files I can play on my iPhone and MacBook Air for a while without really having any issues until this one specific movie.



When I convert it with Handbrake using default “General” settings of seemingly any type—Fast, Very Fast, HQ or Super HQ—the audio downmixing from 5.1 audio results in weird stereo with essentially all of the audio going to the right channel and the left channel seems to have some channel that is just—for lack of a better term—background remnants. Just enough sound to not be silent but utterly no music or dialogue or anything is really audible.



I can play it on VLC (version 3.0.6) on my MacBook Air and I get the same odd sound through my speakers; heavy right barely anything left. But if I set the audio of VLC to “Headphones”… Wow! It becomes a normal stereo downmix.



What is happening and what can I do to properly downmix this? I hope I can do this in Handbrake, but if not I assume I would have to extract the AC3 out of the MKV, downmix it in some other tool and then toss it back into the MKV?



Details of the audio track here using ffmpeg -i:



Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : English
BPS-eng : 384000
DURATION-eng : 01:36:42.624000000
NUMBER_OF_FRAMES-eng: 181332
NUMBER_OF_BYTES-eng: 278525952


Details of the audio track here using mkvmerge --identify is:



Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AC-3)


Details of the audio track here using mkvinfo is:



| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3241101187
| + Track type: audio
| + Forced track flag: 1
| + Codec ID: A_AC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Name: English
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6


Details of the audio track here using exiftool is:



Track Number                    : 2
Track Type : Audio
Track Forced : Yes
Audio Codec ID : A_AC3
Default Duration : 32 ms
Track Name : English
Audio Sample Rate : 48000
Audio Channels : 6









share|improve this question














So I have successfully used Handbrake (version 1.1.2) to convert many large MKV files into smaller, iOS and macOS compatible video files I can play on my iPhone and MacBook Air for a while without really having any issues until this one specific movie.



When I convert it with Handbrake using default “General” settings of seemingly any type—Fast, Very Fast, HQ or Super HQ—the audio downmixing from 5.1 audio results in weird stereo with essentially all of the audio going to the right channel and the left channel seems to have some channel that is just—for lack of a better term—background remnants. Just enough sound to not be silent but utterly no music or dialogue or anything is really audible.



I can play it on VLC (version 3.0.6) on my MacBook Air and I get the same odd sound through my speakers; heavy right barely anything left. But if I set the audio of VLC to “Headphones”… Wow! It becomes a normal stereo downmix.



What is happening and what can I do to properly downmix this? I hope I can do this in Handbrake, but if not I assume I would have to extract the AC3 out of the MKV, downmix it in some other tool and then toss it back into the MKV?



Details of the audio track here using ffmpeg -i:



Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : English
BPS-eng : 384000
DURATION-eng : 01:36:42.624000000
NUMBER_OF_FRAMES-eng: 181332
NUMBER_OF_BYTES-eng: 278525952


Details of the audio track here using mkvmerge --identify is:



Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AC-3)


Details of the audio track here using mkvinfo is:



| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3241101187
| + Track type: audio
| + Forced track flag: 1
| + Codec ID: A_AC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Name: English
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6


Details of the audio track here using exiftool is:



Track Number                    : 2
Track Type : Audio
Track Forced : Yes
Audio Codec ID : A_AC3
Default Duration : 32 ms
Track Name : English
Audio Sample Rate : 48000
Audio Channels : 6






audio ffmpeg handbrake audio-conversion






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 21 at 5:54









JakeGouldJakeGould

31.3k1096138




31.3k1096138








  • 2





    I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

    – Gyan
    Jan 21 at 6:22











  • @Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

    – JakeGould
    Jan 21 at 6:28











  • @Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

    – JakeGould
    Jan 23 at 2:46














  • 2





    I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

    – Gyan
    Jan 21 at 6:22











  • @Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

    – JakeGould
    Jan 21 at 6:28











  • @Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

    – JakeGould
    Jan 23 at 2:46








2




2





I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

– Gyan
Jan 21 at 6:22





I suspect that the input has a non-standard channel layout. When that happens, the demuxer will label it with a standard layout with the same number of channels. When rematrixing to another channel layout, obviously the selected rematrixing will be faulty. Do you know the exact channel layout of the input?

– Gyan
Jan 21 at 6:22













@Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

– JakeGould
Jan 21 at 6:28





@Gyan Makes sense. Have no idea what the source layout of the input is, but is there anyway for me to analyze the AC3 from the command line or even live? Wonder if there would be a tool out there that could allow for live down mixing of the input so I can—for example—just check off boxes to see what track is what.

– JakeGould
Jan 21 at 6:28













@Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

– JakeGould
Jan 23 at 2:46





@Gyan Just posted an answer that reflects the steps I took to fix this. If you know of a cleaner way to do this, please feel free to post an answer.

– JakeGould
Jan 23 at 2:46










2 Answers
2






active

oldest

votes


















2














Once you know the channel mapping, you can just use the channelmap filter, skipping the intermediate files.



ffmpeg -i my_movie.mkv -c:v copy -c:s copy -af "channelmap=0|2|1|3|4|5" -c:a ac3 out.mkv





share|improve this answer
























  • That’s great! Thanks.

    – JakeGould
    Jan 23 at 18:39



















1














The “Center” channel was actually “Right” and visa-versa.



Swapping them results in a properly balanced, normal sounding AC3 file.



I discovered this based on Gyan’s comment, I decided I can fix this only by actually breaking out individual mono tracks from the AC3, listening to each, and then reconstructing the AC3 to fix the audio layout. Thus, this discovery and the solution to this mini mess.



That said, all of the steps I outline below worked for me, but if anyone knows a cleaner way to do this in one command, please feel free to post as an answer. I will give you the glory since this is literally the most elaborate FFmpeg and MKV manipulation I have ever done, so it was a learning process.



First, I used mkvmerge to identify which tracks are which in my_movie.mkv:



mkvmerge --identify my_movie.mkv


Knowing that I extracted the AC3 file using FFmpeg to a file named my_movie.ac3:



ffmpeg -i my_movie.mkv -map 0:1 -c:a copy my_movie.ac3


Then I took that my_movie.ac3 and exploded it into 6 distinct mono tracks:



ffmpeg -i my_movie.ac3 -map_channel 0.0.0 front_left.wav -map_channel 0.0.2 front_right.wav -map_channel 0.0.1 front_center.wav -map_channel 0.0.3 back_left.wav -map_channel 0.0.4 back_right.wav -map_channel 0.0.5 lfe.wav


Then I just recombined those mono tracks into a new AC3 file called my_movie_fixed.ac3:



ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" my_movie_fixed.ac3


Then I added the newly created my_movie_fixed.ac3 to my_movie.mkv and called the resulting file my_movie_fixed.mkv:



ffmpeg -i my_movie.mkv -i my_movie_fixed.ac3 -map 0 -map 1 -c copy my_movie_fixed.mkv


It worked! Sound is great via normal “Stereo” playback in VLC as well as when the my_movie_fixed.mkv was converted via Handbrake.



That said, I also adjusted the metadata specifics for the track and set it as a default audio track using mkvpropedit like this:



mkvpropedit my_movie_fixed.mkv --edit track:a2 --set name=English --set language=en





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396479%2fhandbrake-s-stereo-downmixing-of-an-mkv-5-1-audio-track-results-in-center-bein%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Once you know the channel mapping, you can just use the channelmap filter, skipping the intermediate files.



    ffmpeg -i my_movie.mkv -c:v copy -c:s copy -af "channelmap=0|2|1|3|4|5" -c:a ac3 out.mkv





    share|improve this answer
























    • That’s great! Thanks.

      – JakeGould
      Jan 23 at 18:39
















    2














    Once you know the channel mapping, you can just use the channelmap filter, skipping the intermediate files.



    ffmpeg -i my_movie.mkv -c:v copy -c:s copy -af "channelmap=0|2|1|3|4|5" -c:a ac3 out.mkv





    share|improve this answer
























    • That’s great! Thanks.

      – JakeGould
      Jan 23 at 18:39














    2












    2








    2







    Once you know the channel mapping, you can just use the channelmap filter, skipping the intermediate files.



    ffmpeg -i my_movie.mkv -c:v copy -c:s copy -af "channelmap=0|2|1|3|4|5" -c:a ac3 out.mkv





    share|improve this answer













    Once you know the channel mapping, you can just use the channelmap filter, skipping the intermediate files.



    ffmpeg -i my_movie.mkv -c:v copy -c:s copy -af "channelmap=0|2|1|3|4|5" -c:a ac3 out.mkv






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 23 at 5:42









    GyanGyan

    15k21845




    15k21845













    • That’s great! Thanks.

      – JakeGould
      Jan 23 at 18:39



















    • That’s great! Thanks.

      – JakeGould
      Jan 23 at 18:39

















    That’s great! Thanks.

    – JakeGould
    Jan 23 at 18:39





    That’s great! Thanks.

    – JakeGould
    Jan 23 at 18:39













    1














    The “Center” channel was actually “Right” and visa-versa.



    Swapping them results in a properly balanced, normal sounding AC3 file.



    I discovered this based on Gyan’s comment, I decided I can fix this only by actually breaking out individual mono tracks from the AC3, listening to each, and then reconstructing the AC3 to fix the audio layout. Thus, this discovery and the solution to this mini mess.



    That said, all of the steps I outline below worked for me, but if anyone knows a cleaner way to do this in one command, please feel free to post as an answer. I will give you the glory since this is literally the most elaborate FFmpeg and MKV manipulation I have ever done, so it was a learning process.



    First, I used mkvmerge to identify which tracks are which in my_movie.mkv:



    mkvmerge --identify my_movie.mkv


    Knowing that I extracted the AC3 file using FFmpeg to a file named my_movie.ac3:



    ffmpeg -i my_movie.mkv -map 0:1 -c:a copy my_movie.ac3


    Then I took that my_movie.ac3 and exploded it into 6 distinct mono tracks:



    ffmpeg -i my_movie.ac3 -map_channel 0.0.0 front_left.wav -map_channel 0.0.2 front_right.wav -map_channel 0.0.1 front_center.wav -map_channel 0.0.3 back_left.wav -map_channel 0.0.4 back_right.wav -map_channel 0.0.5 lfe.wav


    Then I just recombined those mono tracks into a new AC3 file called my_movie_fixed.ac3:



    ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" my_movie_fixed.ac3


    Then I added the newly created my_movie_fixed.ac3 to my_movie.mkv and called the resulting file my_movie_fixed.mkv:



    ffmpeg -i my_movie.mkv -i my_movie_fixed.ac3 -map 0 -map 1 -c copy my_movie_fixed.mkv


    It worked! Sound is great via normal “Stereo” playback in VLC as well as when the my_movie_fixed.mkv was converted via Handbrake.



    That said, I also adjusted the metadata specifics for the track and set it as a default audio track using mkvpropedit like this:



    mkvpropedit my_movie_fixed.mkv --edit track:a2 --set name=English --set language=en





    share|improve this answer






























      1














      The “Center” channel was actually “Right” and visa-versa.



      Swapping them results in a properly balanced, normal sounding AC3 file.



      I discovered this based on Gyan’s comment, I decided I can fix this only by actually breaking out individual mono tracks from the AC3, listening to each, and then reconstructing the AC3 to fix the audio layout. Thus, this discovery and the solution to this mini mess.



      That said, all of the steps I outline below worked for me, but if anyone knows a cleaner way to do this in one command, please feel free to post as an answer. I will give you the glory since this is literally the most elaborate FFmpeg and MKV manipulation I have ever done, so it was a learning process.



      First, I used mkvmerge to identify which tracks are which in my_movie.mkv:



      mkvmerge --identify my_movie.mkv


      Knowing that I extracted the AC3 file using FFmpeg to a file named my_movie.ac3:



      ffmpeg -i my_movie.mkv -map 0:1 -c:a copy my_movie.ac3


      Then I took that my_movie.ac3 and exploded it into 6 distinct mono tracks:



      ffmpeg -i my_movie.ac3 -map_channel 0.0.0 front_left.wav -map_channel 0.0.2 front_right.wav -map_channel 0.0.1 front_center.wav -map_channel 0.0.3 back_left.wav -map_channel 0.0.4 back_right.wav -map_channel 0.0.5 lfe.wav


      Then I just recombined those mono tracks into a new AC3 file called my_movie_fixed.ac3:



      ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" my_movie_fixed.ac3


      Then I added the newly created my_movie_fixed.ac3 to my_movie.mkv and called the resulting file my_movie_fixed.mkv:



      ffmpeg -i my_movie.mkv -i my_movie_fixed.ac3 -map 0 -map 1 -c copy my_movie_fixed.mkv


      It worked! Sound is great via normal “Stereo” playback in VLC as well as when the my_movie_fixed.mkv was converted via Handbrake.



      That said, I also adjusted the metadata specifics for the track and set it as a default audio track using mkvpropedit like this:



      mkvpropedit my_movie_fixed.mkv --edit track:a2 --set name=English --set language=en





      share|improve this answer




























        1












        1








        1







        The “Center” channel was actually “Right” and visa-versa.



        Swapping them results in a properly balanced, normal sounding AC3 file.



        I discovered this based on Gyan’s comment, I decided I can fix this only by actually breaking out individual mono tracks from the AC3, listening to each, and then reconstructing the AC3 to fix the audio layout. Thus, this discovery and the solution to this mini mess.



        That said, all of the steps I outline below worked for me, but if anyone knows a cleaner way to do this in one command, please feel free to post as an answer. I will give you the glory since this is literally the most elaborate FFmpeg and MKV manipulation I have ever done, so it was a learning process.



        First, I used mkvmerge to identify which tracks are which in my_movie.mkv:



        mkvmerge --identify my_movie.mkv


        Knowing that I extracted the AC3 file using FFmpeg to a file named my_movie.ac3:



        ffmpeg -i my_movie.mkv -map 0:1 -c:a copy my_movie.ac3


        Then I took that my_movie.ac3 and exploded it into 6 distinct mono tracks:



        ffmpeg -i my_movie.ac3 -map_channel 0.0.0 front_left.wav -map_channel 0.0.2 front_right.wav -map_channel 0.0.1 front_center.wav -map_channel 0.0.3 back_left.wav -map_channel 0.0.4 back_right.wav -map_channel 0.0.5 lfe.wav


        Then I just recombined those mono tracks into a new AC3 file called my_movie_fixed.ac3:



        ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" my_movie_fixed.ac3


        Then I added the newly created my_movie_fixed.ac3 to my_movie.mkv and called the resulting file my_movie_fixed.mkv:



        ffmpeg -i my_movie.mkv -i my_movie_fixed.ac3 -map 0 -map 1 -c copy my_movie_fixed.mkv


        It worked! Sound is great via normal “Stereo” playback in VLC as well as when the my_movie_fixed.mkv was converted via Handbrake.



        That said, I also adjusted the metadata specifics for the track and set it as a default audio track using mkvpropedit like this:



        mkvpropedit my_movie_fixed.mkv --edit track:a2 --set name=English --set language=en





        share|improve this answer















        The “Center” channel was actually “Right” and visa-versa.



        Swapping them results in a properly balanced, normal sounding AC3 file.



        I discovered this based on Gyan’s comment, I decided I can fix this only by actually breaking out individual mono tracks from the AC3, listening to each, and then reconstructing the AC3 to fix the audio layout. Thus, this discovery and the solution to this mini mess.



        That said, all of the steps I outline below worked for me, but if anyone knows a cleaner way to do this in one command, please feel free to post as an answer. I will give you the glory since this is literally the most elaborate FFmpeg and MKV manipulation I have ever done, so it was a learning process.



        First, I used mkvmerge to identify which tracks are which in my_movie.mkv:



        mkvmerge --identify my_movie.mkv


        Knowing that I extracted the AC3 file using FFmpeg to a file named my_movie.ac3:



        ffmpeg -i my_movie.mkv -map 0:1 -c:a copy my_movie.ac3


        Then I took that my_movie.ac3 and exploded it into 6 distinct mono tracks:



        ffmpeg -i my_movie.ac3 -map_channel 0.0.0 front_left.wav -map_channel 0.0.2 front_right.wav -map_channel 0.0.1 front_center.wav -map_channel 0.0.3 back_left.wav -map_channel 0.0.4 back_right.wav -map_channel 0.0.5 lfe.wav


        Then I just recombined those mono tracks into a new AC3 file called my_movie_fixed.ac3:



        ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" my_movie_fixed.ac3


        Then I added the newly created my_movie_fixed.ac3 to my_movie.mkv and called the resulting file my_movie_fixed.mkv:



        ffmpeg -i my_movie.mkv -i my_movie_fixed.ac3 -map 0 -map 1 -c copy my_movie_fixed.mkv


        It worked! Sound is great via normal “Stereo” playback in VLC as well as when the my_movie_fixed.mkv was converted via Handbrake.



        That said, I also adjusted the metadata specifics for the track and set it as a default audio track using mkvpropedit like this:



        mkvpropedit my_movie_fixed.mkv --edit track:a2 --set name=English --set language=en






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 23 at 3:16

























        answered Jan 23 at 2:45









        JakeGouldJakeGould

        31.3k1096138




        31.3k1096138






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396479%2fhandbrake-s-stereo-downmixing-of-an-mkv-5-1-audio-track-results-in-center-bein%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix