Log in

View Full Version : How to BATCH remux combine video and audio to one file?


For Fun
24th December 2020, 17:57
How can BATCH remux video and audio to one file?

I'm trying this on mine android termux.
So what I'm trying:
1. I want to rip audio from video and convert to wav. ffmpeg -i inp.mkv -map 0:1 audio.wav
2. Extract only video. mkvextract tracks "inp.mkv" 0:video.mkv
3. Remux Combine extracted video and wav audio file. mkvmerge -o final.mkv video.mkv audio.wav

So I have multiple videos from tv show and I want to batch convert the things I mentioned above?

example:
Movie1.mkv and Movie1.wav remux to Movie1.mkv

Movie2.mkv and Movie2.wav remux to Movie2.mkv

And then I want movie1.mkv and movie1.wav files to be deleted and only the combined video and audio file to exist.

I did try myself but I couldn't figure it out further:


for f in *.mkv;do ffmpeg -i "$f" -map 0:1 "${f%mkv}wav";done &&


Could I create a new folder and send the converted file to the folder would that do the trick?
İf someone could help I would be appreciated.

For Fun
24th December 2020, 22:12
I have solved it my self for f in .mkv;do ffmpeg -i "$f" -map 0:1 "${f%mkv}wav";done && for i in .mkv; do mkdir -p "${i%.}" && mkvmerge -o "${i%.}/${i%.}.mkv" -A "$i" "${i%.}.wav"; done