multimedia/sinthgunt: Update patch.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Chernov 2017-03-07 23:43:48 +07:00 committed by Willy Sudiarto Raharjo
parent 1d0d32388a
commit 07f4f4b98e
2 changed files with 318 additions and 108 deletions

View file

@ -24,7 +24,7 @@
PRGNAM=sinthgunt
VERSION=${VERSION:-2.1.0}
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then

View file

@ -1,6 +1,15 @@
diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
2017-02-17
Initial patch
2017-03-04
Additional information
2 pass encoding
To apply two pass encoding use "2Pass" in the preset name.
Example: <label>Asha 2Pass</label>
diff -3ur a/Sinthgunt/app.py b/Sinthgunt/app.py
--- a/Sinthgunt/app.py 2010-11-22 21:27:55.000000000 +0300
+++ b/Sinthgunt/app.py 2017-02-17 22:03:35.886000000 +0300
+++ b/Sinthgunt/app.py 2017-03-04 20:18:39.000000000 +0300
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
@ -32,7 +41,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
def main():
####################
@@ -58,14 +63,15 @@
@@ -58,20 +63,22 @@
print('It seems, that ffmpeg is not installed on this computer. \nSee http://www.sinthgunt.org for installation instructions.') # Display error message, then carry on
# Define data and temp directories
@ -47,13 +56,20 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- logfile.writelines('****** Sinthgunt log file START - '+
- str(time.ctime())+' *******\n')
- logo_filename=DATA_DIR+"logo.png"
+ logfile.writelines('\n****** Sinthgunt log file START - '+
+ logfile.writelines('\n******* Sinthgunt log file START - '+
+ str(time.ctime())+' *******\n\n')
+ logo_filename = DATA_DIR+"logo.png"
# Carry over variables to class
sinthgunt.logo_filename = logo_filename
@@ -98,7 +104,7 @@
sinthgunt.DATA_DIR = DATA_DIR
sinthgunt.logfile = logfile
sinthgunt.TEMP_DIR = TEMP_DIR
+ sinthgunt.function_activate = False
# Run the main loop
program = sinthgunt()
@@ -98,7 +105,7 @@
# -
####################
@ -62,7 +78,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -112,10 +118,10 @@
@@ -112,10 +119,10 @@
#
####################
# Write default stuff to gui
@ -75,7 +91,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
self.labelInput.set_text('')
# Load the logo
@@ -143,8 +149,8 @@
@@ -143,8 +150,8 @@
# Load XML config file
self.parseXML()
# Local variables
@ -86,8 +102,11 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
# Connect to menu
actionmenu = self.wTree.get_widget("menu2")
# Constants
@@ -154,7 +160,7 @@
@@ -152,9 +159,10 @@
self.Npreset = len(presetlist) # Number of presets
counter = 0 # Counter that keeps track of the categories in the categorylist
counter2 = 0 # Counter that keeps track of the codecs in the self.preset_enabled list
+ self.already_executed = False
# Create first, dummy item in group. All later items are attached to this group
- item = gtk.RadioMenuItem(group=None,label='')
@ -95,7 +114,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
# Initialise presetmenuheaderholder, a holder for the submenues
self.presetmenu1headerholder = []
self.preset_enabled = []
@@ -170,32 +176,32 @@
@@ -170,32 +178,32 @@
if presetlist[i][0] == categorylist[counter]:
self.preset_enabled.append('')
# Create radio button for the preset
@ -137,7 +156,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
counter2 = counter2+1
# add item to the headerholder
self.presetmenu1headerholder[counter].append(item)
@@ -219,41 +225,42 @@
@@ -219,41 +227,39 @@
# ===============
#
####################
@ -147,11 +166,11 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
try:
output_raw = str(self.process.stdout.read(80))
- output = output_raw.replace('\n','')
+ output = output_raw.replace('\n', '').replace('\r', '').replace('fps=', 'fps= ')
+ output = output_raw.replace('=', ' ').replace('\r', '\n')
except:
pass
- self.logfile.writelines('Conversion status: '+output+'\n')
+ self.logfile.writelines('Output: '+output+'\n')
+ self.logfile.writelines(output)
output_split = output.split(' ')
- N=len(output_split)
+ N = len(output_split)
@ -174,20 +193,17 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- ' of '+str(self.file_frames)+' frames converted.')
- except:
- pass
+ if i >= 2 and output_split[i] == 'fps=':
+ if i >= 2 and output_split[i] == 'fps':
+ file_frames_completed = output_split[i-1]
+ split_file_frames_completed = file_frames_completed.replace('frame=', '')
+ # update progressbar and statusbar
+ try:
+ context_id = self.statusbar.get_context_id("Activation")
+ self.statusbar.push(context_id, 'Frames converted: '+str(split_file_frames_completed))
+ self.statusbar.push(context_id, 'Frames converted: '+str(file_frames_completed))
+ except:
+ pass
+ try:
+ self.progressbar.set_fraction(float(\
+ split_file_frames_completed)/float(self.file_frames))
+ #self.progressbar.set_text(str(split_file_frames_completed)+\
+ #' of '+str(self.file_frames)+' frames converted.')
+ file_frames_completed)/float(self.file_frames))
+ self.progressbar.set_text('Converting '+self.input[self.NextInputFileToConvert])
+ except:
+ pass
@ -202,19 +218,21 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
self.progressbar.set_fraction(0.0)
self.progressbar.set_text('')
return False
@@ -261,24 +268,25 @@
@@ -261,24 +267,25 @@
# if no output detected, stop watching the process and write to statusbar
- if output =='':
- self.statusbar.push(context_id,'Conversion completed!')
- self.progressbar.set_fraction(0.99999)
+ if output == '':
+ self.statusbar.push(context_id, 'Conversion completed!')
+ self.progressbar.set_text('')
self.progressbar.set_fraction(0.99999)
+ self.progressbar.set_text('')
+ self.progressbar.set_fraction(1.0)
# We are now done with the current file. Move on to next one if there are any left
if self.NextInputFileToConvert <= len(self.input) - 2:
self.NextInputFileToConvert = self.NextInputFileToConvert + 1
- self.NextInputFileToConvert = self.NextInputFileToConvert + 1
+ self.NextInputFileToConvert = self.NextInputFileToConvert+1
self.activate(self.window)
else:
- self.NextInputFileToConvert = 0
@ -233,7 +251,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -322,6 +330,8 @@
@@ -322,6 +329,8 @@
filter.add_pattern("*.3G2")
filter.add_pattern("*.mts")
filter.add_pattern("*.MTS")
@ -242,7 +260,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
fc.add_filter(filter)
# all files
filter = gtk.FileFilter()
@@ -357,7 +367,7 @@
@@ -357,7 +366,7 @@
#
####################
# generate thumbnail from input file
@ -251,7 +269,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
# update thumbnail
try:
@@ -369,20 +379,19 @@
@@ -369,20 +378,23 @@
# fill label with file info
self.labelInput.set_text('')
@ -263,12 +281,16 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- +'\nVideo bitrate: '+ str(self.video_codec[3])\
- +'\n'+'Number of frames: '+str(self.file_frames))
- self.ListOfInputFiles='\n'
+ self.labelInput.set_text('Codec info for\n'\
+ + self.input[-1] +'\n\n'\
+ 'Audio codec: '+ str(self.audio_codec[0]) +'\n'\
+ 'Video codec: '+ str(self.video_codec[0]) +'\n'\
+ 'Bitrate: '+ str(self.video_codec[1])+'\n'
+ 'Number of frames: '+str(self.file_frames)+'\n')
+ self.labelInput.set_text(' Codec info for\n '+self.input[-1]+'\n\n'\
+ ' Audio codec: '+str(self.audio_codec[0])+\
+ ', '+str(self.audio_codec[1])+\
+ ', '+str(self.audio_codec[2])+'\n'\
+ ' Video codec: '+str(self.video_codec[0])+\
+ ', '+str(self.video_codec[1])+\
+ ', '+str(self.video_codec[2])+\
+ ', '+str(self.video_codec[3])+'\n'\
+ ' Bitrate: '+str(self.bitrate_info[0])+'\n'
+ ' Number of frames: '+str(self.file_frames)+'\n')
+ self.ListOfInputFiles = '\n'
for i in range(len(self.input)):
- StringToAdd=str(i+1)+'. '+self.input[i]+'\n'
@ -282,7 +304,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -398,7 +407,7 @@
@@ -398,7 +410,7 @@
#
####################
#base this on a message dialog
@ -291,7 +313,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
dialog.set_markup('Enter the number of the input file you wish to remove')
#create the text input field
entry = gtk.Entry()
@@ -414,18 +423,17 @@
@@ -414,18 +426,17 @@
dialog.vbox.pack_end(hbox, True, True, 0)
dialog.show_all()
#go go go
@ -312,7 +334,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
except:
pass
@@ -447,25 +455,20 @@
@@ -447,25 +458,21 @@
# This function uses ffmpeg to generate a thumbnail.
####################
@ -323,6 +345,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- # set thumbnail filename
- thumbnailFileName = sinthgunt.TEMP_DIR+str(videoFileBaseName)+".jpg"
+ thumbnailFileName = sinthgunt.TEMP_DIR+"videothumbnail.jpg"
+ logfile_remove(thumbnailFileName)
# ffmpeg command line
- subcommand = ['ffmpeg', '-y', '-itsoffset', '-5' ,'-i' ,videoFile,\
@ -330,7 +353,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- thumbnailFileName]
+ subcommand = ['ffmpeg', '-v', 'warning', '-y', '-itsoffset', '-5', '-i', videoFile, \
+ '-vcodec', 'mjpeg', '-vframes', '1', '-an', '-f', 'rawvideo', '-s', '172x129', \
+ '-vf', 'crop=4/3*in_h:in_h', thumbnailFileName]
+ '-vf', 'crop=4/3*in_h:in_h', '-filter', 'format=rgb24', thumbnailFileName]
- thumbProcess = subprocess.Popen(args=subcommand,
- stdout=subprocess.PIPE,stdin=subprocess.PIPE,
@ -340,13 +363,14 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
+ stderr = subprocess.STDOUT, shell = False)
# Read output from thumbnail process and write it to the log file
output = str(thumbProcess.stdout.read(100))
- output = str(thumbProcess.stdout.read(100))
- self.logfile.writelines('Thumbnail process status: '+output+'\n')
+ self.logfile.writelines('\n\nThumbnail process status: '+output+'\n')
+ output = str(thumbProcess.stdout.read(300))
+ self.logfile.writelines('\n\nThumbnail process status:\n'+output+'\n')
# Wait for thumbnail process to complete
thumbProcess.wait()
@@ -474,7 +477,7 @@
@@ -474,7 +481,7 @@
return thumbnailFileName
@ -355,7 +379,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -495,17 +498,17 @@
@@ -495,17 +502,64 @@
try:
operation = self.operation_radiobutton
context_id = self.statusbar.get_context_id("Activation")
@ -365,20 +389,68 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
#for now, operate on last input file
- InputFileName=self.input[-1]
+ InputFileName = self.input[-1]
+
for i in range(self.Npreset):
if operation == self.presetlist[i][1]:
- if operation == self.presetlist[i][1]:
+ if operation == self.presetlist[i][1] and '2Pass' in self.presetlist[i][1]:
# generate command line in subprocess syntax
- subcommand = ['/usr/bin/ffmpeg','-y','-i']
+ subcommand = ['/usr/bin/ffmpeg', '-y', '-i']
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
subcommand.extend([InputFileName])
- subcommand.extend(['-t','5'])
- temp1=self.presetlist[i][2].split(' ')
+ subcommand.extend(['-t', '5', '-an', '-pass', '1', '-passlogfile', '/tmp/twopass'])
+ temp1 = self.presetlist[i][2].split(' ')
+ # remove empty entries ('') from the array
+ for ii in range(20):
+ try:
+ temp1.remove('')
+ except:
+ pass
+ temp1.extend(['/dev/null'])
+ subcommand.extend(temp1)
+ # Start converting
+ first_pass_process = subprocess.Popen(args = subcommand,
+ stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell = False)
+
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+
+ first_pass_process.wait()
+
+ # generate command line in subprocess syntax
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+ subcommand.extend([InputFileName])
+ subcommand.extend(['-t', '5', '-pass', '2', '-passlogfile', '/tmp/twopass'])
+ temp1 = self.presetlist[i][2].split(' ')
+ # remove empty entries ('') from the array
+ for ii in range(20):
+ try:
+ temp1.remove('')
+ except:
+ pass
+ temp1.extend([str(InputFileName+"_preview_twopass."+self.presetlist[i][3])])
+ # path to output file
+ self.output = str(InputFileName+"_preview_twopass."+self.presetlist[i][3])
+ subcommand.extend(temp1)
+ # Start converting
+ second_pass_process = subprocess.Popen(args = subcommand,
+ stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell = False)
+
+ self.logfile.writelines('\n'+str(subcommand)+'\n')
+
+ second_pass_process.wait()
+
+ if operation == self.presetlist[i][1] and '2Pass' not in self.presetlist[i][1]:
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+ subcommand.extend([InputFileName])
+ subcommand.extend(['-t', '5'])
+ temp1 = self.presetlist[i][2].split(' ')
# remove empty entries ('') from the array
for ii in range(20):
try:
@@ -514,19 +517,19 @@
@@ -514,19 +568,21 @@
pass
temp1.extend([str(InputFileName+"_preview."+self.presetlist[i][3])])
# path to output file
@ -389,12 +461,14 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- self.process = subprocess.Popen(args=subcommand,
- stdout=subprocess.PIPE,stdin=subprocess.PIPE,
- stderr=subprocess.STDOUT,shell=False)
+ self.process = subprocess.Popen(args = subcommand,
+ converting_process = subprocess.Popen(args = subcommand,
+ stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell = False)
+
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
- self.logfile.writelines('Conversion command: '+str(subcommand)+'\n')
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+ converting_process.wait()
except:
self.no_file_selected_dialog(widget)
@ -404,7 +478,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -542,7 +545,7 @@
@@ -542,7 +598,7 @@
####################
@ -413,30 +487,113 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -563,17 +566,17 @@
@@ -556,24 +612,96 @@
# ===============
#
####################
+
+ self.function_activate = True
# Get selected operation from menu
try:
operation = self.operation_radiobutton
self.progressbar.set_fraction(0.01)
context_id = self.statusbar.get_context_id("Activation")
- self.progressbar.set_fraction(0.01)
- context_id = self.statusbar.get_context_id("Activation")
- self.statusbar.push(context_id,'Converting '+self.input[self.NextInputFileToConvert])
+ self.statusbar.push(context_id, 'Converting '+self.input[self.NextInputFileToConvert])
+ InputFileName = self.input[self.NextInputFileToConvert]
+ # generate thumbnail from input file
+ self.thumbnail_filename = self.generateThumbnail(InputFileName)
#start watching output
- #start watching output
- self.source_id = gobject.timeout_add(500, self.checkfile)
- InputFileName=self.input[self.NextInputFileToConvert]
+ self.source_id = gobject.timeout_add(300, self.checkfile)
+ InputFileName = self.input[self.NextInputFileToConvert]
+ # update thumbnail
+ try:
+ self.thumbnail.set_from_file(self.thumbnail_filename)
+ except:
+ pass
+ # get media file info
+ mediaFileInformation = self.file_getinfo()
+
+ # fill label with file info
+ self.labelInput.set_text('')
+ self.labelInput.set_text(' Codec info for\n '+InputFileName+'\n\n'\
+ ' Audio codec: '+str(self.audio_codec[0])+\
+ ', '+str(self.audio_codec[1])+\
+ ', '+str(self.audio_codec[2])+'\n'\
+ ' Video codec: '+str(self.video_codec[0])+\
+ ', '+str(self.video_codec[1])+\
+ ', '+str(self.video_codec[2])+\
+ ', '+str(self.video_codec[3])+'\n'\
+ ' Bitrate: '+str(self.bitrate_info[0])+'\n'
+ ' Number of frames: '+str(self.file_frames)+'\n')
+
for i in range(self.Npreset):
if operation == self.presetlist[i][1]:
- if operation == self.presetlist[i][1]:
+
+ if operation == self.presetlist[i][1] and '2Pass' in self.presetlist[i][1]:
+ # generate command line in subprocess syntax
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+ subcommand.extend([InputFileName])
+ subcommand.extend(['-an', '-pass', '1', '-passlogfile', '/tmp/twopass'])
+ temp1 = self.presetlist[i][2].split(' ')
+ # remove empty entries ('') from the array
+ for ii in range(20):
+ try:
+ temp1.remove('')
+ except:
+ pass
+ temp1.extend(['/dev/null'])
+ subcommand.extend(temp1)
+ # Start converting
+ first_pass_process = subprocess.Popen(args = subcommand,
+ stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell = False)
+
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+
+ first_pass_process.wait()
+
+ # generate command line in subprocess syntax
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-stats', '-y', '-i']
+ subcommand.extend([InputFileName])
+ subcommand.extend(['-pass', '2', '-passlogfile', '/tmp/twopass'])
+ temp1 = self.presetlist[i][2].split(' ')
+ # remove empty entries ('') from the array
+ for ii in range(20):
+ try:
+ temp1.remove('')
+ except:
+ pass
+ temp1.extend([str(InputFileName+"_twopass."+self.presetlist[i][3])])
+ # path to output file
+ self.output = str(InputFileName+"_twopass."+self.presetlist[i][3])
+ subcommand.extend(temp1)
+ # Start converting
+ self.process = subprocess.Popen(args = subcommand,
+ stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell = False)
+
+ self.logfile.writelines('\n'+str(subcommand)+'\n\n')
+ self.progressbar.set_fraction(0.0)
+ context_id = self.statusbar.get_context_id("Activation")
+ self.statusbar.push(context_id, 'Converting '+self.input[self.NextInputFileToConvert]+' (second pass)')
+ #start watching output
+ self.source_id = gobject.timeout_add(500, self.checkfile)
+ self.function_activate = False
+
+ if operation == self.presetlist[i][1] and '2Pass' not in self.presetlist[i][1]:
# generate command line in subprocess syntax
- subcommand = ['/usr/bin/ffmpeg','-y','-i']
+ subcommand = ['/usr/bin/ffmpeg', '-y', '-i']
+ subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-stats', '-y', '-i']
subcommand.extend([InputFileName])
- temp1=self.presetlist[i][2].split(' ')
+ temp1 = self.presetlist[i][2].split(' ')
# remove empty entries ('') from the array
for ii in range(20):
try:
@@ -582,19 +585,19 @@
@@ -582,19 +710,25 @@
pass
temp1.extend([str(InputFileName+"."+self.presetlist[i][3])])
# path to output file
@ -452,7 +609,13 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
+ stderr = subprocess.STDOUT, shell = False)
- self.logfile.writelines('Conversion command: '+str(subcommand)+'\n')
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+ self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n\n')
+ self.progressbar.set_fraction(0.0)
+ context_id = self.statusbar.get_context_id("Activation")
+ self.statusbar.push(context_id, 'Converting '+self.input[self.NextInputFileToConvert])
+ #start watching output
+ self.source_id = gobject.timeout_add(500, self.checkfile)
+ self.function_activate = False
except:
self.no_file_selected_dialog(widget)
@ -462,7 +625,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -608,19 +611,19 @@
@@ -608,19 +742,19 @@
#
####################
try:
@ -486,27 +649,31 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -634,7 +637,7 @@
@@ -634,7 +768,7 @@
#
####################
self.stop
- self.logfile.writelines('****** Sinthgunt log file STOP - '+str(time.ctime())+' *******\n')
+ self.logfile.writelines('\n****** Sinthgunt log file STOP - '+str(time.ctime())+' *******\n\n')
+ self.logfile.writelines('\n******* Sinthgunt log file STOP - '+str(time.ctime())+' *******\n\n')
self.logfile.close
gtk.main_quit()
@@ -653,17 +656,17 @@
@@ -653,17 +787,21 @@
# ===============
#
####################
- self.audio_codec = ['N/A','N/A','N/A','N/A','N/A']
- self.video_codec = ['N/A','N/A','N/A','N/A','N/A']
+ self.audio_codec = ['N/A']
+ self.video_codec = ['N/A', 'N/A']
+ self.audio_codec = ['N/A', 'N/A', 'N/A']
+ self.video_codec = ['N/A', 'N/A', 'N/A', 'N/A']
+ self.bitrate_info = ['N/A']
self.file_frames = 0
- InputFileName=self.input[-1]
- command = ["ffmpeg","-i",InputFileName]
+ InputFileName = self.input[-1]
+ if self.function_activate == True:
+ InputFileName = self.input[self.NextInputFileToConvert]
+ else:
+ InputFileName = self.input[-1]
+ command = ['ffmpeg', '-i', InputFileName]
- process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
@ -520,9 +687,12 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
try:
while flag == 1:
try:
@@ -674,56 +677,50 @@
@@ -672,49 +810,66 @@
break
if output != '\n' and output != '':
self.logfile.writelines('Get file info status: '+output+'\n')
- self.logfile.writelines('Get file info status: '+output+'\n')
+ self.logfile.writelines('\nGet file info status:\n'+output+'\n')
output_split = output.split(' ')
- N=len(output_split)
+ N = len(output_split)
@ -543,6 +713,10 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
+ file_length_sec = 3600*float(file_length_min_split[0])+\
60*float(file_length_min_split[1])+\
float(file_length_min_split[2])
+
+ # Find video bitrate
+ if output_split[i] == 'bitrate:':
+ self.bitrate_info[0] = output_split[i+1].strip(',')+' kb/s'
# Find video codec
- if output_split[i]=='Video:':
@ -550,12 +724,25 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
self.video_codec[0] = output_split[i+1].strip(',')
- self.video_codec[1] = output_split[i+2].strip(',')
- self.video_codec[2] = output_split[i+3].strip(',')
# Find video bitrate
-
- # Find video bitrate
- if output_split[i]=='bitrate:':
- self.video_codec[3] = output_split[i+1].strip(',')+' kb/s'
+ if output_split[i] == 'bitrate:':
+ self.video_codec[1] = output_split[i+1].strip(',')+' kb/s'
+
+ if i >= 2 and (output_split[i] == 'yuv420p,'):
+ self.video_codec[1] = output_split[i+1].strip(',')
+ elif i >= 2 and (output_split[i] == 'rgb24,'):
+ self.video_codec[1] = output_split[i+1].strip(',')
+ elif i >= 2 and (output_split[i] == 'yuv444p,'):
+ self.video_codec[1] = output_split[i+1].strip(',')
+ elif i >= 2 and (output_split[i] == 'yuv420p(tv),'):
+ self.video_codec[1] = output_split[i+1].strip(',')
+
+ if i >= 2 and (output_split[i] == 'kb/s,'):
+ self.video_codec[2] = output_split[i-1]+' kb/s'
+
+ if i >= 2 and (output_split[i] == 'fps,'):
+ self.video_codec[3] = output_split[i-1]+' fps'
# Find frames pr. second in the file
- if i>=2 and (output_split[i]=='tb(r)\n' or output_split[i]=='tb(r)\nMust' or output_split[i]=='tbr,'):
@ -572,9 +759,18 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
- output_split[i+3].strip(','),
- output_split[i+4].strip(','),
- output_split[i+5]]
- #flag = 0
+ if output_split[i] == 'Audio:':
+ self.audio_codec = [output_split[i+1].strip(',')]
#flag = 0
+ self.audio_codec[0] = output_split[i+1].strip(',')
+
+ if i >= 2 and (output_split[i] == 'Hz,'):
+ self.audio_codec[1] = output_split[i-1]+' Hz'
+
+ if i >= 2 and (output_split[i] == 'fltp,'):
+ self.audio_codec[2] = output_split[i+1]+' kb/s'
+ elif i >= 2 and (output_split[i] == 's16p,'):
+ self.audio_codec[2] = output_split[i+1]+' kb/s'
+
# Stop if we reach the end of ffmpeg's output
- if counter >= 1000 or output_spilt[i]=='file\n':
@ -582,18 +778,16 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
flag = 0
counter = counter+1
except:
pass
self.logfile.writelines('Audio codec: '+str(self.audio_codec)+'\n')
@@ -723,7 +878,7 @@
self.logfile.writelines('Video codec: '+str(self.video_codec)+'\n')
- self.logfile.writelines('Number of frames: '+str(self.file_frames)+'\n')
+ self.logfile.writelines('Number of frames: '+str(self.file_frames)+'\n') #self.logfile.writelines(''+str(file_fps)+'\n')
self.logfile.writelines('Number of frames: '+str(self.file_frames)+'\n')
- def aboutdialog(self,widget):
+ def aboutdialog(self, widget):
####################
# Description
# ===========
@@ -746,9 +743,9 @@
@@ -746,9 +901,9 @@
\nConvert button in the main window.\
\n\nPlease visit http://www.sinthgunt.org\
\nfor more info."
@ -605,7 +799,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -761,11 +758,11 @@
@@ -761,11 +916,11 @@
# ===============
#
####################
@ -620,7 +814,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -778,13 +775,13 @@
@@ -778,13 +933,13 @@
# ===============
#
####################
@ -628,9 +822,10 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
+ dialogtext = " You have selected a preset which is (probably) not supported by your version of ffmpeg. \
To upgrade ffmpeg, please check your distribution documentation. \
-\n If you want, you may disregard this warning and check the log file (sinthgunt.log) \
+\n If you want, you may disregard this warning and check the log file (~/.sinthgunt.log) \
after pressing the convert button"
-after pressing the convert button"
- self.ErrorDialog(widget,dialogtext)
+\n If you want, you may disregard this warning and check the log file (~/.sinthgunt.log) \
+after pressing the convert button."
+ self.ErrorDialog(widget, dialogtext)
- def ErrorDialog(self,widget,dialogtext):
@ -638,7 +833,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -802,10 +799,10 @@
@@ -802,10 +957,10 @@
gtk.BUTTONS_NONE, dialogtext)
message.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
resp = message.run()
@ -651,7 +846,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -821,13 +818,13 @@
@@ -821,13 +976,13 @@
message = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, dialogtext)
message.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
resp = message.run()
@ -667,7 +862,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -840,16 +837,16 @@
@@ -840,18 +995,22 @@
#
####################
self.operation_radiobutton = ''
@ -677,17 +872,25 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
for item in presetmenu1header:
if item.get_active() == True:
self.operation_radiobutton = self.presetlist[counter][1]
self.labelOperation.set_text('Output to '+self.presetlist[counter][1])
- self.labelOperation.set_text('Output to '+self.presetlist[counter][1])
+ self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' ')
# if preset is not supported, display unsupported_codec_dialog
- if self.preset_enabled[counter]==False:
+ if self.preset_enabled[counter] == False:
+ if self.preset_enabled[counter] == False and self.already_executed == False:
self.unsupported_codec_dialog(widget)
- self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+'\n(Preset not supported by ffmpeg)')
+ self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+'\n(Preset not supported)')
+ self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' (preset not supported) ')
+ #item.set_active(True)
+ self.already_executed = True
+ elif self.preset_enabled[counter] == False and self.already_executed == True:
+ self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' (preset not supported) ')
#item.set_active(True)
counter = counter + 1
- counter = counter + 1
+ counter = counter+1
@@ -877,48 +874,48 @@
def parseXML(self):
@@ -877,48 +1036,48 @@
xml_file = os.path.dirname(xml_file) # load xml file
xml_file = os.path.join(xml_file, self.DATA_DIR+"presets.xml")
optionsXML = etree.parse(xml_file)
@ -755,7 +958,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -936,16 +933,16 @@
@@ -936,16 +1095,16 @@
#
####################
self.ffmpeg_getcodecs()
@ -777,7 +980,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
def ffmpeg_getcodecs(self):
####################
@@ -960,224 +957,73 @@
@@ -960,224 +1119,73 @@
# ===============
#
####################
@ -1032,7 +1235,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -1190,12 +1036,12 @@
@@ -1190,12 +1198,12 @@
#
####################
return False
@ -1047,7 +1250,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -1209,17 +1055,17 @@
@@ -1209,17 +1217,17 @@
#
####################
if self.mplayer_check:
@ -1070,7 +1273,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
####################
# Description
# ===========
@@ -1233,13 +1079,13 @@
@@ -1233,13 +1241,13 @@
#
####################
if self.mplayer_check:
@ -1088,7 +1291,7 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
else:
print 'Mplayer must be installed and found in /usr/bin for this function to work'
@@ -1286,13 +1132,11 @@
@@ -1286,13 +1294,11 @@
"MainWindow_destroy" : self.quit_program,
"on_menuquit_activate" : self.quit_program,
"on_menuopen_activate" : self.menuopenfile,
@ -1104,9 +1307,9 @@ diff -u3r a/Sinthgunt/app.py b/Sinthgunt/app.py
+ "on_menuPlayOutput_activate" : self.mplayer_play_output_file}
#Do the magic connecting to the widgets
self.wTree.signal_autoconnect(self.dic)
diff -u3r a/setup.py b/setup.py
diff -3ur a/setup.py b/setup.py
--- a/setup.py 2013-02-15 18:23:20.000000000 +0400
+++ b/setup.py 2017-02-12 16:47:52.390000000 +0300
+++ b/setup.py 2017-02-20 16:38:40.000000000 +0300
@@ -17,7 +17,7 @@
license = 'GPLv3',
packages = ['Sinthgunt'],
@ -1116,9 +1319,9 @@ diff -u3r a/setup.py b/setup.py
data_files=[
('/usr/share/sinthgunt',['share/sinthgunt.glade','share/presets.xml','share/logo.png','share/icon.png','README.txt','LICENSE.txt','sinthgunt.html']),
('/usr/share/applications',['share/sinthgunt.desktop']),
diff -u3r a/share/presets.xml b/share/presets.xml
diff -3ur a/share/presets.xml b/share/presets.xml
--- a/share/presets.xml 2010-11-14 15:02:41.000000000 +0300
+++ b/share/presets.xml 2017-02-17 20:52:45.437000000 +0300
+++ b/share/presets.xml 2017-03-03 23:52:17.000000000 +0300
@@ -9,199 +9,199 @@
</CDWavStereo>
<GigabeatFS>
@ -1358,7 +1561,7 @@ diff -u3r a/share/presets.xml b/share/presets.xml
<XviDAVIWS>
<label>XviD Widescreen</label>
- <params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -vf scale=704:384,aspect=16:9 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+ <params>-f avi -vcodec libxvid -vtag xvid -s 704x384 -aspect 16:9 -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+ <params>-f avi -vcodec libxvid -vtag xvid -s 704x396 -aspect 16:9 -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
<extension>avi</extension>
<category>AVI</category>
- <codecs>libxvid,libmp3lame</codecs>
@ -1558,7 +1761,7 @@ diff -u3r a/share/presets.xml b/share/presets.xml
<x264HQFS>
<label>MP4 Fullscreen</label>
- <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 640x480 -b 1000k -aspect 4:3 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+ <params>-f mp4 -vcodec libx264 -s 640x480 -b:v 1000k -aspect 4:3 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+ <params>-f mp4 -vcodec libx264 -s 640x480 -b:v 1000k -aspect 4:3 -acodec libfaac -ab 112k -ar 44100 -ac 2</params>
<extension>mp4</extension>
<category>MPEG4</category>
- <codecs>libx264,libfaac</codecs>
@ -1576,7 +1779,7 @@ diff -u3r a/share/presets.xml b/share/presets.xml
<x264HQWS>
<label>MP4 Widescreen</label>
- <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 704x384 -b 1000k -aspect 16:9 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+ <params>-f mp4 -vcodec libx264 -s 704x384 -b:v 1000k -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+ <params>-f mp4 -vcodec libx264 -s 704x396 -b:v 1000k -aspect 16:9 -acodec libfaac -ab 112k -ar 44100 -ac 2</params>
<extension>mp4</extension>
<category>MPEG4</category>
- <codecs>libx264,libfaac</codecs>
@ -1820,7 +2023,7 @@ diff -u3r a/share/presets.xml b/share/presets.xml
</ps3720pfs>
<image1sec>
<label>Extract JPEG images, one every 1 second</label>
@@ -674,36 +674,42 @@
@@ -674,36 +674,49 @@
<params>-s 480x320 -vcodec mpeg4 -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2</params>
<extension>mp4</extension>
<category>Mobile Phones</category>
@ -1849,11 +2052,18 @@ diff -u3r a/share/presets.xml b/share/presets.xml
</iphone1>
+ <nphone1>
+ <label>Asha</label>
+ <params>-f 3gp -vf crop=4/3*in_h:in_h -s 320x240 -aspect 4:3 -acodec libfaac -vcodec mpeg4 -q:v 7</params>
+ <params>-f 3gp -vf crop=4/3*in_h:in_h -s 320x240 -aspect 4:3 -acodec libfaac -ar 44100 -vcodec mpeg4 -q:v 7</params>
+ <extension>3gp</extension>
+ <category>Mobile Phones</category>
+ <codecs>mpeg4,aac</codecs>
+ </nphone1>
+ <nphone2>
+ <label>Asha 2Pass</label>
+ <params>-f 3gp -vf crop=4/3*in_h:in_h -s 320x240 -aspect 4:3 -acodec libfaac -ab 64k -ar 44100 -vcodec mpeg4 -b:v 400k</params>
+ <extension>3gp</extension>
+ <category>Mobile Phones</category>
+ <codecs>mpeg4,aac</codecs>
+ </nphone2>
<CowoniAudio7AVIbeta1>
<label>Cowon iAudio 7 AVI beta 1</label>
- <params>-f avi -g 1 -b 256k -r 12 -async 2 -vf scale=160:120 -vtag XVID -vcodec libxvid -ab 128k -ar 44100 -ac 2 -acodec libmp3lame </params>
@ -1874,9 +2084,9 @@ diff -u3r a/share/presets.xml b/share/presets.xml
</CowoniAudio7AVIbeta2>
diff -u3r a/share/sinthgunt.glade b/share/sinthgunt.glade
diff -3ur a/share/sinthgunt.glade b/share/sinthgunt.glade
--- a/share/sinthgunt.glade 2013-02-14 23:15:54.000000000 +0400
+++ b/share/sinthgunt.glade 2017-02-12 16:52:41.873000000 +0300
+++ b/share/sinthgunt.glade 2017-02-20 16:38:40.000000000 +0300
@@ -45,20 +45,6 @@
</child>
</widget>
@ -1916,9 +2126,9 @@ diff -u3r a/share/sinthgunt.glade b/share/sinthgunt.glade
</packing>
</child>
<child>
diff -u3r a/sinthgunt b/sinthgunt
diff -3ur a/sinthgunt b/sinthgunt
--- a/sinthgunt 2010-11-14 15:02:41.000000000 +0300
+++ b/sinthgunt 2017-02-17 19:32:15.888000000 +0300
+++ b/sinthgunt 2017-02-20 16:38:40.000000000 +0300
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-