#!/usr/bin/python
-- coding: utf-8 --
import Tkinter
import tkFileDialog
#from Tkinter import *
#master = Tk()
#Label(text=“Texte de la fenetre avec une largeur”, width=50).pack()
class Main(Tkinter.Tk):
def __init__(self,):
Tkinter.Tk.__init__(self)
self._videoPath="."
self._audioPath="."
self._finalPath="."
self.labelVideo=Tkinter.Label(self)
self.labelAudio=Tkinter.Label(self)
self.labelFinal=Tkinter.Label(self)
self.labelTexte1=Tkinter.Label(self,text=" \nLe script vous permet le multiplexage \n dune vidéo m2v et de l'audio ac3 ou mp3\n" ,width = 75)
self.entry=Tkinter.Entry(self,text=“texte”)
self.buttonVideo=Tkinter.Button(self,text="Choisir la vidéo")
self.buttonVideo=Tkinter.Button(self,text="Choisir la vidéo")
self.buttonAudio=Tkinter.Button(self,text="Choisir l'audio")
self.buttonFinal=Tkinter.Button(self,text="Choisir le fichier final")
self.buttonMux=Tkinter.Button(self,text="Lancer le Mux")
self.buttonVideo.bind('<Button-1>',self.videoPath)
self.buttonAudio.bind('<Button-1>',self.audioPath)
self.buttonFinal.bind('<Button-1>',self.finalPath)
self.buttonMux.bind('<Button-1>',self.mux)
self.labelTexte1.pack(fill='x')
self.buttonVideo.pack(fill='x')
self.labelVideo.pack(fill='x')
self.buttonAudio.pack(fill='x')
self.labelAudio.pack(fill='x')
self.buttonFinal.pack(fill='x')
self.entry.pack(fill=‘x’)
self.labelFinal.pack(fill='x')
self.buttonMux.pack(fill='x')
def videoPath(self,event):
self._videoPath=tkFileDialog.askopenfilename(parent=self,initialdir="$HOME",title='Choisissez la video',filetypes=[('Fichiers video', '*.m2v')])
self.labelVideo.__setitem__('text',self._videoPath)
# print self._videoPath
def audioPath(self,event):
self._audioPath=tkFileDialog.askopenfilename(parent=self,initialdir="$HOME",title="Choisissez l'audio",filetypes=[('Fichiers audio', "*.mp3 , *.ac3")])
self.labelAudio.__setitem__('text',self._audioPath)
# print self._audioPath
def finalPath(self,event):
self._finalPath=tkFileDialog.asksaveasfilename(parent=self,initialdir="$HOME",title="Choisissez le fichier final")
self.labelFinal.__setitem__('text',self._finalPath)
# print self._finalPath
def mux(self,event):
import subprocess
args=['ffmpeg','-aspect','16:9','-i',self._audioPath,'-i',self._videoPath,'-f','avi','-vtag','xvid','-vcodec','mpeg4','-acodec','copy','-sameq','-s','1440*1080',self._finalPath+'.avi']
try:
subprocess.Popen(args)
except Exception,e:
print "Trying to launch mplex with args : %s" % args
print e
if name==“main”:
root = Main()
root.title('Multiplexage m2v avec de l\' ac3 ou mp3')
root.mainloop()