<p>for f in .mkv;do ffmpeg -i &quot;$f&quot; -map 0:1 &quot;${f%mkv}wav&quot;;done &amp;&amp; for i in .mkv; do mkdir -p &quot;${i%.}&quot; &amp;&amp; mkvmerge -o &quot;${i%.}/${i%.}.mkv&quot; -A &quot;$i&quot; &quot;${i%.}.wav&quot;; done</p>

CC BY-SA 4.0
2020-12-24T21:11:38.803Z
2020-12-24T21:11:38.803Z
For Fun
<h3>How can BATCH remux video and audio to one file?</h3>
<p>I'm trying this on mine android termux.
So what I'm trying:</p>
<ol>
<li>I want to rip audio from video and convert to wav. <strong>ffmpeg -i inp.mkv -map 0:1 audio.wav</strong></li>
<li>Extract only video. <strong>mkvextract tracks &quot;inp.mkv&quot; 0:video.mkv</strong></li>
<li>Remux Combine extracted video and wav audio file. <strong>mkvmerge -o final.mkv video.mkv audio.wav</strong></li>
</ol>
<h1>UPDATE</h1>
<p>I Have found the command Solved myself</p>
<blockquote>
<p>for f in <em>.mkv;do ffmpeg -i &quot;$f&quot; -map 0:1 &quot;${f%mkv}wav&quot;;done &amp;&amp; for i in <em>.mkv; do mkdir -p &quot;${i%.</em>}&quot; &amp;&amp; mkvmerge -o &quot;${i%.</em>}/${i%.<em>}.mkv&quot; -A &quot;$i&quot; &quot;${i%.</em>}.wav&quot;; done</p>
</blockquote>
<h1>Another Question</h1>
<p>How can I batch convert ssa to srt and send it to folder and also give subtitle the same name as video?</p>
<p>for f in <em>.mkv;do ffmpeg -i &quot;$f&quot; -map 0:1 &quot;${f%mkv}wav&quot;;done &amp;&amp; for i in <em>.mkv; do mkdir -p &quot;${i%.</em>}&quot; &amp;&amp; mkvmerge -o &quot;${i%.</em>}/${i%.<em>}.mkv&quot; -A &quot;$i&quot; &quot;${i%.</em>}.wav&quot;; done &amp;&amp; for f in *.ass;do ffmpeg -i &quot;$f&quot; &quot;${f%ass}srt&quot;;done</p>

<ffmpeg><mkv><android>
How to BATCH remux combine video and audio to one file?
For Fun
# How to BATCH remux combine video and audio to one file?

(Asked by: username_0 on 2020-12-24)

### 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**

# UPDATE

I Have found the command Solved myself

> 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

# Another Question

How can I batch convert ssa to srt and send it to folder and also give subtitle the same name as video?

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 && for f in \*.ass;do ffmpeg -i "$f" "${f%ass}srt";done

**Tags:** ffmpeg, mkv, android


---

## 1 answers

### Answer by username_0 on 2020-12-24. Score: 0 | Accepted answer

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


---

