VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hello everybody, I have videos that I am trying to batch edit with ffmpeg, I'm only trying to modify the audio track and remove the 6th channel and only have 5 channels.


    I would also possibly like to just merge the 3rd and 4th channel into one and just leaving 5 total channels.


    Most of the time no matter what I try it leaves all 6 channels and just blanks one out for some reason

    I've tried different versions of FFMPEG, differentfilters and -af, -filter_complex, -filter:a, channelmap, channel_layout, pan, they all do the same thing


    So far the only thing that really works is converting the audio to a wav file, but you'd think AC3 or AAC would be able to do it as well

    for %%g in (*.mkv) do ffmpeg -i "%%g" -map 0:a:0 -af channelmap=channel_layout=5.0 -c:a pcm_s16le "%%~ng.wav"


    Using -filter:a "channelmap=channel_layout=4.0" does create 4 channels, but I'm wanting 5


    Even trying AAC does the same thing and leaves just an empty channel
    for %%g in (*.mkv) do ffmpeg -i "%%g" -map 0:v -map 0:a:0 -sn -c:v copy -filter:a "channelmap=channel_layout=5.0" -c:a aac "%%~ng.mp4"
    Last edited by rushmusashi; 21st Oct 2023 at 12:55.
    Quote Quote  
  2. It is unclear to me channel layout you are trying to achieve?

    Instead numbers use channel names, please use ffmpeg naming convention provided below:

    Code:
    Individual channels:
    NAME           DESCRIPTION
    FL             front left
    FR             front right
    FC             front center
    LFE            low frequency
    BL             back left
    BR             back right
    FLC            front left-of-center
    FRC            front right-of-center
    BC             back center
    SL             side left
    SR             side right
    TC             top center
    TFL            top front left
    TFC            top front center
    TFR            top front right
    TBL            top back left
    TBC            top back center
    TBR            top back right
    DL             downmix left
    DR             downmix right
    WL             wide left
    WR             wide right
    SDL            surround direct left
    SDR            surround direct right
    LFE2           low frequency 2
    TSL            top side left
    TSR            top side right
    BFC            bottom front center
    BFL            bottom front left
    BFR            bottom front right
    
    Standard channel layouts:
    NAME           DECOMPOSITION
    mono           FC
    stereo         FL+FR
    2.1            FL+FR+LFE
    3.0            FL+FR+FC
    3.0(back)      FL+FR+BC
    4.0            FL+FR+FC+BC
    quad           FL+FR+BL+BR
    quad(side)     FL+FR+SL+SR
    3.1            FL+FR+FC+LFE
    5.0            FL+FR+FC+BL+BR
    5.0(side)      FL+FR+FC+SL+SR
    4.1            FL+FR+FC+LFE+BC
    5.1            FL+FR+FC+LFE+BL+BR
    5.1(side)      FL+FR+FC+LFE+SL+SR
    6.0            FL+FR+FC+BC+SL+SR
    6.0(front)     FL+FR+FLC+FRC+SL+SR
    hexagonal      FL+FR+FC+BL+BR+BC
    6.1            FL+FR+FC+LFE+BC+SL+SR
    6.1(back)      FL+FR+FC+LFE+BL+BR+BC
    6.1(front)     FL+FR+LFE+FLC+FRC+SL+SR
    7.0            FL+FR+FC+BL+BR+SL+SR
    7.0(front)     FL+FR+FC+FLC+FRC+SL+SR
    7.1            FL+FR+FC+LFE+BL+BR+SL+SR
    7.1(wide)      FL+FR+FC+LFE+BL+BR+FLC+FRC
    7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
    7.1(top)       FL+FR+FC+LFE+BL+BR+TFL+TFR
    octagonal      FL+FR+FC+BL+BR+BC+SL+SR
    cube           FL+FR+BL+BR+TFL+TFR+TBL+TBR
    hexadecagonal  FL+FR+FC+BL+BR+BC+SL+SR+TFL+TFC+TFR+TBL+TBC+TBR+WL+WR
    downmix        DL+DR
    22.2           FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+TC+TFL+TFC+TFR+TBL+TBC+TBR+LFE2+TSL+TSR+BFC+BFL+BFR
    Quote Quote  
  3. Originally Posted by pandy View Post
    It is unclear to me channel layout you are trying to achieve?

    Instead numbers use channel names, please use ffmpeg naming convention provided below:

    Thanks for replying. I was just looking for any working 5 channel setup, I've been trying to put in many different layouts but it doesn't seem to alter the audio properly.

    I guess 5.0(side) looks like it should work, but I've tried putting that in different ways as well and it doesn't seem to make the proper changes.

    I was just playing around with it some more and found that it seems to work if I output the audio to an AC3 file, but it does not work when outputting to an mkv or mp4 file for some reason. I can make that work I guess and just batch process them into ac3 files and then batch remux them into new video files with those audio files, but you'd think you should be able to just do it in one go.

    After looking at it I'm thinking the best thing to do would be to just combine the 3rd and 4th channels into one and leave the others intact, so not sure how to do that exactly.
    Quote Quote  
  4. Originally Posted by ProWo View Post
    pan=5.0
    Thanks, but that does nothing lol, only putting that in just created 6 empty channels in an mkv or mp4, trying to create an AC3 file made 5 empty channels
    Quote Quote  
  5. So I also have been playing around with the PAN filter before ProWo commented.

    Putting in this actually created the correct AC3 file that I'm looking for, but it does not work in an MKV or MP4, so I don't know what's up with it, maybe a bug in ffmpeg.

    for %%g in (*.mkv) do ffmpeg -i "%%g" -map 0:a:0 -af "pan=5.0(side)|c0=FL|c1=FR|c2=FC+LFE|c3=SL|c4= SR" -c:a ac3 "%%~ng.ac3"

    c0 1 2 3 4 5 would be the 6 audio channels for 5.1 (side) (FL+FR+FC+LFE+SL+SR)

    so I just combined the 2 center channels into 1 channel, the 3rd channel for 5.0(side) c2=FC+LFE
    Last edited by rushmusashi; 21st Oct 2023 at 12:52.
    Quote Quote  
  6. This commandline gives a 5 channel ac3.
    ffmpeg -i input.mkv -map 0:x -af "pan=5.0|c0=c0|c1=c1|c2=c2|c3=c3|c4=c4" -c:a ac3 output.ac3
    (where x is the desired audio stream, e.g. 2)

    Image
    [Attachment 74461 - Click to enlarge]


    No problem at all for muxing this ac3 to m4 or mkv.
    Quote Quote  
  7. Originally Posted by ProWo View Post
    This commandline gives a 5 channel ac3.
    ffmpeg -i input.mkv -map 0:x -af "pan=5.0|c0=c0|c1=c1|c2=c2|c3=c3|c4=c4" -c:a ac3 output.ac3
    (where x is the desired audio stream, e.g. 2)


    No problem at all for muxing this ac3 to m4 or mkv.
    Thanks. I used -map 0:a:0 because there are 2 audio tracks in the videos and I only want to reencode the first one.

    The commandline I posted looks to work perfect for making the right 5 channel audio ac3 file from the 6 channel.

    The problem I'm running into is that it won't encode it directly from the mkv into the new mkv or mp4, so I will have to do it all the harder way and create all ac3 files and then remux them into the videos, there's around 300 videos, that's why I was trying to get a proper batch script lol. I'll just have to do it all with 2 batch scripts instead of one, there must be a bug somewhere in something.
    Quote Quote  



Similar Threads

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