0

Id like to create a video C with audio from video A but video from video B. Video A and video B have nearly the same length in seconds.

Since the videos are a couple GBs, I guess it would be slower if I first extract audio from video A, then later merge that audio into video B (I mean, one step should be faster than two steps, right?). However, if this is the only way (extract audio, then merge), then I will do it.

Actually, video B was generated from video A and it took a 4 consecutive days of video processing to generate it (but lost the audio due to a mistake); that is why I am initially seeking a solution to do everything "at once".

2
  • 1
    ffmpeg dumps audio almost inchantly, so you could 1) dump audio 2) use this audio as ffmpeg -i video -i audio -c copy out.mkv Commented Feb 12, 2023 at 19:27
  • i thought it would take too long, but it was actually pretty fast indeed. thanks!
    – user462354
    Commented Feb 12, 2023 at 20:17

1 Answer 1

0

I've been using this for a while:

ffmpeg -y \
  -i "$videofile" \
  -i "$audiofile" \
  -c:v copy -c:a aac \
  -map 0:v:0 -map 1:a:0 \
  "$outfile"

I haven't tried it with files that are only "nearly" the same length, though.

1
  • thanks for the answer, it worked
    – user462354
    Commented Feb 12, 2023 at 20:18

You must log in to answer this question.