A
A
Arris2019-07-05 11:14:36
fmpeg
Arris, 2019-07-05 11:14:36

How to properly transplant an audio track from one file to another?

There are two videos (containers), here are their roads:
First:

Duration: 01:24:13.28, start: 0.000000, bitrate: 2477 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 1567 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s Rus
    Stream #0:2: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s Eng

Second:
Duration: 01:24:13.28, start: 0.000000, bitrate: 3718 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1268x540 [SAR 1:1 DAR 317:135], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default) (forced)
    Stream #0:2(spa): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:3(rus): Subtitle: subrip (default) (forced)
    Stream #0:4(rus): Subtitle: subrip
    Stream #0:5(eng): Subtitle: subrip

Quest:
Transplant the first audio track from the first container into the second container (the second video has a good video sequence, but a completely ugly Russian translation). Without transcoding video or audio.
I do like this:
ffmpeg -i video_0.avi -i video_1.mkv -map 1:0 -map 0:1 -map 0:2 -map 1:3 -map 1:4 -map 1:5  -codec copy -f matroska out_new.mkv

And I seem to be getting results. But any seek on the resulting file gives a short fraction of a second of grinding and silence.
CHADNT?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moskus, 2019-07-15
@Moskus

Parse the sources into the desired tracks and use the more visual MKVToolnix (you can even use the GUI) to collect everything in one container and arrange the order/priorities/properties.
Personally, I always get tired of -mapmessing around with these when there are more than two of them, all the more so - I also try to edit metadata through ffmpeg.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question