How to remap channels of AC3 stream within .mkv or .mp4? (ffmpeg, 3f2m/lfe - > 3f2r/lfe)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















So this is my problem, I've backed up quite a number of DVDs and a few Blu-Ray discs to .mkv files for archival purposes, and for my plex server. I used:




  • x264 for video

  • ac3 for audio (for compatibility's sake, Dolby Digital is supported by just about everything, DTS and lossless codecs are not supported by a huge number of TVs or home theater setups).


So far so good. However, after a time I discovered that my transcoder created files that have audio setup in:




  • 3F2M/LFE (3 Front, 2 Middle), which is in ffmpeg known as "5.1(side)"


instead of:




  • 3F2R/LFE (3 Front, 2 Rear) which is called "5.1" without the side in
    brackets.


This is causing an issue with my surround sound setup.



To fix this, I'm trying to remap channels using ffmpeg in terminal, but I'm not getting something right. I don't want to re-transcode everything, so I just want to swap SL to BL, and SR to BR channels.



When I run ffprobe filename.mkv I get:



ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'filename.mkv':
Metadata:
encoder : libebml v0.7.7 + libmatroska v0.8.1
creation_time : 2018-06-30T14:44:07.000000Z
Duration: 03:48:17.82, start: 0.000000, bitrate: 5020 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default)


I have tried with:



ffmpeg -i filename.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" output.mkv


but this start re-encoding video as well, and changes audio codec.



So, next I tried with:



ffmpeg -i filename.mkv -codec:0 copy -acodec:1 copy -filter:1 "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" newfilename.mkv 


and with that I get:



Filtergraph 'channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1' was defined for audio output stream 0:1 but codec copy was selected.
Filtering and streamcopy cannot be used together.


Is there a way to just swap side to rear channels without transcoding? I really would not like to spend countless hours transcoding again... :(



Thanks!










share|improve this question























  • You don't have to re-encode the video!. Set -c:v copy -c:a ac3

    – Gyan
    Feb 7 at 5:16




















0















So this is my problem, I've backed up quite a number of DVDs and a few Blu-Ray discs to .mkv files for archival purposes, and for my plex server. I used:




  • x264 for video

  • ac3 for audio (for compatibility's sake, Dolby Digital is supported by just about everything, DTS and lossless codecs are not supported by a huge number of TVs or home theater setups).


So far so good. However, after a time I discovered that my transcoder created files that have audio setup in:




  • 3F2M/LFE (3 Front, 2 Middle), which is in ffmpeg known as "5.1(side)"


instead of:




  • 3F2R/LFE (3 Front, 2 Rear) which is called "5.1" without the side in
    brackets.


This is causing an issue with my surround sound setup.



To fix this, I'm trying to remap channels using ffmpeg in terminal, but I'm not getting something right. I don't want to re-transcode everything, so I just want to swap SL to BL, and SR to BR channels.



When I run ffprobe filename.mkv I get:



ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'filename.mkv':
Metadata:
encoder : libebml v0.7.7 + libmatroska v0.8.1
creation_time : 2018-06-30T14:44:07.000000Z
Duration: 03:48:17.82, start: 0.000000, bitrate: 5020 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default)


I have tried with:



ffmpeg -i filename.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" output.mkv


but this start re-encoding video as well, and changes audio codec.



So, next I tried with:



ffmpeg -i filename.mkv -codec:0 copy -acodec:1 copy -filter:1 "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" newfilename.mkv 


and with that I get:



Filtergraph 'channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1' was defined for audio output stream 0:1 but codec copy was selected.
Filtering and streamcopy cannot be used together.


Is there a way to just swap side to rear channels without transcoding? I really would not like to spend countless hours transcoding again... :(



Thanks!










share|improve this question























  • You don't have to re-encode the video!. Set -c:v copy -c:a ac3

    – Gyan
    Feb 7 at 5:16
















0












0








0








So this is my problem, I've backed up quite a number of DVDs and a few Blu-Ray discs to .mkv files for archival purposes, and for my plex server. I used:




  • x264 for video

  • ac3 for audio (for compatibility's sake, Dolby Digital is supported by just about everything, DTS and lossless codecs are not supported by a huge number of TVs or home theater setups).


So far so good. However, after a time I discovered that my transcoder created files that have audio setup in:




  • 3F2M/LFE (3 Front, 2 Middle), which is in ffmpeg known as "5.1(side)"


instead of:




  • 3F2R/LFE (3 Front, 2 Rear) which is called "5.1" without the side in
    brackets.


This is causing an issue with my surround sound setup.



To fix this, I'm trying to remap channels using ffmpeg in terminal, but I'm not getting something right. I don't want to re-transcode everything, so I just want to swap SL to BL, and SR to BR channels.



When I run ffprobe filename.mkv I get:



ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'filename.mkv':
Metadata:
encoder : libebml v0.7.7 + libmatroska v0.8.1
creation_time : 2018-06-30T14:44:07.000000Z
Duration: 03:48:17.82, start: 0.000000, bitrate: 5020 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default)


I have tried with:



ffmpeg -i filename.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" output.mkv


but this start re-encoding video as well, and changes audio codec.



So, next I tried with:



ffmpeg -i filename.mkv -codec:0 copy -acodec:1 copy -filter:1 "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" newfilename.mkv 


and with that I get:



Filtergraph 'channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1' was defined for audio output stream 0:1 but codec copy was selected.
Filtering and streamcopy cannot be used together.


Is there a way to just swap side to rear channels without transcoding? I really would not like to spend countless hours transcoding again... :(



Thanks!










share|improve this question














So this is my problem, I've backed up quite a number of DVDs and a few Blu-Ray discs to .mkv files for archival purposes, and for my plex server. I used:




  • x264 for video

  • ac3 for audio (for compatibility's sake, Dolby Digital is supported by just about everything, DTS and lossless codecs are not supported by a huge number of TVs or home theater setups).


So far so good. However, after a time I discovered that my transcoder created files that have audio setup in:




  • 3F2M/LFE (3 Front, 2 Middle), which is in ffmpeg known as "5.1(side)"


instead of:




  • 3F2R/LFE (3 Front, 2 Rear) which is called "5.1" without the side in
    brackets.


This is causing an issue with my surround sound setup.



To fix this, I'm trying to remap channels using ffmpeg in terminal, but I'm not getting something right. I don't want to re-transcode everything, so I just want to swap SL to BL, and SR to BR channels.



When I run ffprobe filename.mkv I get:



ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'filename.mkv':
Metadata:
encoder : libebml v0.7.7 + libmatroska v0.8.1
creation_time : 2018-06-30T14:44:07.000000Z
Duration: 03:48:17.82, start: 0.000000, bitrate: 5020 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default)


I have tried with:



ffmpeg -i filename.mkv -filter_complex "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" output.mkv


but this start re-encoding video as well, and changes audio codec.



So, next I tried with:



ffmpeg -i filename.mkv -codec:0 copy -acodec:1 copy -filter:1 "channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1" newfilename.mkv 


and with that I get:



Filtergraph 'channelmap=map=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:channel_layout=5.1' was defined for audio output stream 0:1 but codec copy was selected.
Filtering and streamcopy cannot be used together.


Is there a way to just swap side to rear channels without transcoding? I really would not like to spend countless hours transcoding again... :(



Thanks!







audio video ffmpeg video-conversion ac3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 6 at 19:25









VladVlad

1




1













  • You don't have to re-encode the video!. Set -c:v copy -c:a ac3

    – Gyan
    Feb 7 at 5:16





















  • You don't have to re-encode the video!. Set -c:v copy -c:a ac3

    – Gyan
    Feb 7 at 5:16



















You don't have to re-encode the video!. Set -c:v copy -c:a ac3

– Gyan
Feb 7 at 5:16







You don't have to re-encode the video!. Set -c:v copy -c:a ac3

– Gyan
Feb 7 at 5:16












0






active

oldest

votes












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%2f1402823%2fhow-to-remap-channels-of-ac3-stream-within-mkv-or-mp4-ffmpeg-3f2m-lfe-3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















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%2f1402823%2fhow-to-remap-channels-of-ac3-stream-within-mkv-or-mp4-ffmpeg-3f2m-lfe-3%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

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...