Skip to content

Commit

Permalink
fixed DEB dependencies to allow for installation on both Ubuntu and D…
Browse files Browse the repository at this point in the history
…ebian via PPA. Video backend service now checks for avconv if ffmpeg is not found in Linux. FFmpeg is preinstalled on Windows and macOS releases so this is Linux specific
  • Loading branch information
ozmartian committed Jan 15, 2017
1 parent c821597 commit fa60971
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion _build/pyinstaller/vidcutter.osx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ a = Analysis(['../../vidcutter.py'],
'../..'
],
binaries=[],
datas=[('../../__init__.py', '.')],
datas=[
('../../__init__.py', '.'),
('../../bin/ffmpeg', 'bin/')
],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
Expand Down
3 changes: 1 addition & 2 deletions _packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Homepage: http://vidcutter.ozmartians.com
Package: vidcutter
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}, python3-pyqt5, python3-pyqt5.qtmultimedia,
libqt5multimedia5-plugins, ffmpeg
Recommends: ubuntu-restricted-extras
libqt5multimedia5-plugins, ffmpeg | libav-tools, gstreamer1.0-plugins-ugly, gstreamer1.0-libav
Description: FFmpeg based video cutter & joiner with a modern PyQt5 GUI
Cross-platform Qt5 based app for quick and easy video trimming/splitting and merging/joining for simple quick edits.
FFmpeg dives the backend with a stylishly hand edited Qt5 UI. FFmpg static binary is pre-installed for Windows builds.
Expand Down
16 changes: 13 additions & 3 deletions videoservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import shlex
import sys
from distutils.spawn import find_executable

from PyQt5.QtCore import QDir, QFileInfo, QObject, QProcess, QProcessEnvironment, QTemporaryFile, pyqtSlot
from PyQt5.QtGui import QPixmap
Expand All @@ -15,11 +16,18 @@ def __init__(self, parent):
super(VideoService, self).__init__(parent)
self.parent = parent
self.consoleOutput = ''
self.backend = 'ffmpeg'
if sys.platform == 'win32':
self.backend = os.path.join(self.getAppPath(), 'bin', 'ffmpeg.exe')
if not os.path.exists(self.backend):
self.backend = 'ffmpeg.exe'
self.backend = find_executable('ffmpeg.exe')
elif sys.platform == 'darwin':
self.backend = os.path.join(self.getAppPath(), 'bin', 'ffmpeg')
else:
for exe in ('ffmpeg', 'avconv'):
exe_path = find_executable(exe)
if exe_path is not None:
self.backend = exe_path
break
self.initProc()

def initProc(self) -> None:
Expand Down Expand Up @@ -54,6 +62,8 @@ def join(self, filelist: list, output: str) -> bool:
return self.cmdExec(self.backend, args)

def cmdExec(self, cmd: str, args: str = None) -> bool:
if os.getenv('DEBUG', False):
print('VideoService CMD: %s %s' % (cmd, args))
if self.proc.state() == QProcess.NotRunning:
self.proc.start(cmd, shlex.split(args))
self.proc.waitForFinished(-1)
Expand All @@ -65,7 +75,7 @@ def cmdExec(self, cmd: str, args: str = None) -> bool:
def cmdError(self, error: QProcess.ProcessError) -> None:
if error != QProcess.Crashed:
QMessageBox.critical(self.parent.parent, '',
'<h4>FFmpeg Error:</h4>' +
'<h4>%s Error:</h4>' % self.backend +
'<p>%s</p>' % self.proc.errorString(), buttons=QMessageBox.Close)
qApp.quit()

Expand Down

0 comments on commit fa60971

Please sign in to comment.