cross-posted from: https://lemmy.pe1uca.dev/post/317214

I'm cross-posting it here to check if you guys know or if you have an idea which would be the best community to ask.

I'm trying to add the audio of a video to another one so I can have multiple tracks for my media service (Jellyfin).

The issue is the new track doesn't have any sound, it's just there with the proper metadata but it's just mute.
I tried playing it with Jellyfin and with VLC.
The original audio tracks play fine.

This is my command.

ffmpeg -i .\3.english.mkv -i .\3.french.mp4 -c copy -map 0 -map 1:a:0 -y .\3.mix.mkv

I also already tried adding -c:a:1 ac3 since this is the format of the audio in the mkv file.

The data of the original audio of the mkv is

Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      title           : English
      BPS-eng         : 384000
      DURATION-eng    : 02:21:42.176000000
      NUMBER_OF_FRAMES-eng: 265693
      NUMBER_OF_BYTES-eng: 408104448
      _STATISTICS_WRITING_APP-eng: mkvmerge v25.0.0 ('Prog Noir') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-07-23 09:18:58
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

The data of the file I'm trying to inject from the mp4 is

Stream #0:1[0x2](fre): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2014-04-17T18:14:55.000000Z
      handler_name    : movie.track_2.aac
      vendor_id       : [0][0][0][0]

do you guys have any idea of what might be the issue?

I also tried extracting the audio to a file and the aac file works fine, it's just when adding it to the mkv which doesn't work.

  • Pyro@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    I've never seen the 1:a:0 as an arg to -map before, but maybe that's just me following old tutorials.

    Does it work if you manually specify which tracks you want? For example: -map 0:0 -map 0:1 -map 1:1 should take the video and audio from the 1st input and just the audio from the 2nd input (assuming each input has video as the 1st track and audio as the 2nd).

    • pe1uca@lemmy.pe1uca.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      That's exactly what 1:a:0 does, from the first stream, from the audio streams, select the first stream.
      In this case since the audio is the second stream 1:a:0 is the same as 1:1

      I just tried it the other way, moving the audio from the mkv to the mp4 and it works properly.
      Probably I can try to bundle the video of the mkv into an mp4 since Jellyfin is going to be doing it anyway when I try to stream to most devices.