News:

--

Main Menu

MP4 to MKV Script

Started by vinniel, June 13, 2012, 04:15:58 PM

Previous topic - Next topic

vinniel

I think I'm slowly getting the hang of Avidemux scripts, but I need some help on the container part.  Has anyone written a script to convert all the files in a directory from MP4 to MKV?  Nothing fancy, here, just copy the video -- output as MKV. 

I can get it to work, manually, and Avidemux does some wonderful MKVs for the USB input on my DVD player, but I checked, and I have 147 mp4 files in one directory.  I'm not real anxious to do all those files manually.

Thanks!

Jan Gruuthuse

Source: Command-line only batch processing

Windows
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
set videocodec=Copy
set audiocodec=Copy
set container=Matroska
for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --output-format %container% --force-alt-h264 --load "%%f" --save "%%f.mkv" --quit


Linux:
#!/bin/bash
VIDEOCODEC="Copy"
AUDIOCODEC="Copy"
CONTAINER="Matroska"
for FIL in `ls *mp4 | sort` ; do
  avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --output-format $CONTAINER --force-alt-h264 --load "$FIL" --save ${FIL%.*}.mkv --quit
done

vinniel

Thanks!  I'll give it a whirl.

Jan Gruuthuse

Keep in mind this is not re-encoding. The settings in GUI are for Video: Copy and Audio: Copy. If you need re-encoding need to work with run your specific job saved in avidemux (--run anyjob.py).