実行ファイル化するには、まずスクリプトに
#! /usr/bin/env python
を足し
あとはファイルのパーミッションで実行許可を設定
これで通常の実行ファイルと同じようにクリックでプログラムを起動出来る
進行状況をコンソールで表示させるため、lxterminal内でffmpegを実行させるよう変更
別の効能として、ファイルの上書き確認などy/n表示が出るので、エラー率も減る
コンソールが消えたら完了のため、DONE表示もいらないから削除
なぜシステムモジュールをインポートしてるか、は聞いてはいけない(^_^;)
#! /usr/bin/env python
# coding: utf-8
from Tkinter import *
import ttk
import tkFileDialog
import commands
import sys
inp=""
mado=Tk()
mado.title('ffmpeg GUI')
waku=Frame(mado, width=320, height = 240,bd = 2, relief = RAISED)
waku.pack(fill=BOTH, expand=1)
def load():
global inp
inp=tkFileDialog.askopenfilename()
waku0.label0_textvariable=inp
label0.configure(text=inp)
labelhelp.configure(text='2.SELECT OPTIONS')
botan1=Button(waku, text="load", command = load)
botan1.grid(row=0, column=0,sticky=W+E)
def combo(*args):
global option,outp
opt=box.get()
a = opt.split(',')
option=a[0]
kaku=a[1]
outp = inp[:-4] + kaku
label1.configure(text=outp)
label2.configure(text='')
box = ttk.Combobox(waku, values= (' -vn -acodec copy ,.m4a', ' -vcodec copy -an ,.m4v',' -aspect 16:9 -codec copy ,16:9.mp4',' -aspect 4:3 -codec copy ,4:3.mp4',' -codec copy ,'))
box.current(0)
box.bind("<<ComboboxSelected>>",combo)
box.bind("<Enter>",combo)
box.grid(row=0, column=1,sticky=W+E)
waku0=Frame(waku, width=320, height = 240,bd = 2)
waku0.grid(row=1, column=0, columnspan=2,sticky=W+E)
labelhelp=Label(waku0, text='1.PRESS LOAD !', width=32)
labelhelp.pack()
label0=Label(waku0, text='')
label0.pack()
label1=Label(waku0,text='')
label1.pack()
label2=Label(waku0,text='')
label2.pack()
def go():
avcmd = 'lxterminal --command=\'ffmpeg -i "' + inp + '"' + option + '"' + outp + '"\''
commands.getoutput(avcmd.encode('utf-8'))
botan3=Button(waku, text="GO!!", command = go)
botan3.grid(row=2, column=0, columnspan=2,sticky=W+E)
mado.mainloop()

