4

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!

DavidPostill
  • 162,382
Vlad
  • 41

0 Answers0