21
submitted 6 months ago* (last edited 6 months ago) by YamiYuki@lemmy.kde.social to c/kde@lemmy.kde.social
top 3 comments
sorted by: hot top controversial new old
[-] e0qdk@reddthat.com 11 points 6 months ago

I don't know how to do it with KDE's tools, but on the command line with ffmpeg you can do something like this:

ffmpeg -i video_track.mp4 -i audio_jp.m4a -i audio_en.m4a -map 0:v -map 1:a -map 2:a -metadata:s:a:0 language=jpn -metadata:s:a:1 language=eng -c:v copy -c:a copy output.mp4

Breaking it down, it:

  • runs ffmpeg
  • with three inputs (-i flag) -- a video file, and two audio files.
  • The streams are explicitly mapped into the result, counting the inputs from 0 -- i.e. -map 0:v maps input 0 (the first file) as video (v) to the output file and -map 1:a maps the next input as audio (a), etc.
  • It sets the metadata for the audio tracks -metadata:s:a:0 language=jpn sets the first audio track (again counting from 0...) to Japanese; the second metadata option sets the next audio track to English.
  • -c:v copy specifies that the video codec should be copied directly (i.e. don't re-encode -- remove this if you DO need to re-encode)
  • -c:a copy specifies that the audio codec should be copied directly (i.e. don't re-encode -- remove this if you DO need to re-encode)
  • output.mp4 -- finally, list the name of the file you want the result written into.

See documentation here: https://ffmpeg.org/ffmpeg.html

If you need another language in the future, I think the language abbreviations are the three letter codes from here: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -- but I'm not certain on that.

[-] VHS@hexbear.net 2 points 6 months ago* (last edited 6 months ago)

You can just use MKVToolNix to add the second track to the MKV file after rendering, it's still another step but doesn't require re-encoding.

If you're just trying to multiplex tracks and not actually edit the video, I'd recommend doing it entirely with MKVToolNix and skipping Kdenlive for this use. I've done this previously to combine a subbed video and a dubbed one into one file, you can offset or stretch the audio if needed as well.

[-] mox@lemmy.sdf.org 1 points 6 months ago

Not rendering. Muxing, which is short for multiplexing. Lots of software can do this, including MKVToolNix, ffmpeg, and GPAC/MP4Box. If you're also encoding the video, Handbrake could do the job.

this post was submitted on 29 May 2024
21 points (100.0% liked)

KDE

5391 readers
60 users here now

KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE’s software runs on GNU/Linux, BSD and other operating systems, including Windows.

Plasma 6 Bugs

If you encounter a bug, proceed to https://bugs.kde.org, check whether it has been reported.

If it hasn't, report it yourself.

PLEASE THINK CAREFULLY BEFORE POSTING HERE.

Developers do not look for reports on social media, so they will not see it and all it does is clutter up the feed.

founded 1 year ago
MODERATORS