Konversi mkv ke avi

From OnnoWiki
Jump to navigation Jump to search

Sumber: http://www.larsen-b.com/Article/261.html

Sebelum melakukan ini sebaiknya install tool mkv

apt-get install mkvtoolnix mkvtoolnix-gui


Today, I discover that my M3100 player doesn’t know how to play Mastroka files. Mastroka files are really kool since the subtitles are embeded in .. but that’s it, my player refuse to play open it.

This stuff can be repack in a AVI (xivd..) file with some open source tools. Here, a little script to do the hard stuff ;)

You can find the script here : http://svn.pythonfr.org/public/pythonfr/utils/video/mkv2avi.py

#!/usr/bin/python
# Little script to depack Matroska file, and repack them
# in a AVI + subtitle format.

import sys
import os

def message(msg):
    print "=" * 78
    print "= %s" % msg
    print "=" * 78

def usage():
    print "Mastroka repacker script"
    print "  Usage: "+sys.argv[0]+ " filename"

if __name__ == "__main__":
    if len(sys.argv) < 2:
       usage()
    else:
       filename = sys.argv[1]
       basename = filename[:-4]
       message("Unpacking file: %s" % filename)
       os.system("mkvextract tracks %s 1:temp_video.avi 2:temp_audio.ogg 3:%s.srt" % (filename,basename) ) 

       message("Repacking file: %s.avi" % basename)
       os.system("ffmpeg -i temp_audio.ogg  -i temp_video.avi  -vcodec copy  %s.avi" % (basename) ) 

       message("Cleaning files")
       os.system("rm temp_video.avi temp_audio.ogg")


Referensi


Pranala Menarik