From 38cfae0b4e30fdc19612f5873aec09ea69e74486 Mon Sep 17 00:00:00 2001 From: Martin Kaistra Date: Thu, 5 Mar 2015 15:58:45 +0100 Subject: add setup.py, automatic discovery for avconv/ffmpeg, add installation help to readme --- core.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'core.py') diff --git a/core.py b/core.py index ac957e7..996bd52 100644 --- a/core.py +++ b/core.py @@ -1,4 +1,4 @@ -import sys, io +import sys, io, os from PyQt4 import QtCore, QtGui, uic from PyQt4.QtGui import QPainter, QColor from os.path import expanduser @@ -13,10 +13,18 @@ class Core(): self.lastBackgroundImage = "" self._image = None + self.FFMPEG_BIN = self.findFfmpeg() + + def findFfmpeg(self): if sys.platform == "win32": - self.FFMPEG_BIN = "ffmpeg.exe" + return "ffmpeg.exe" else: - self.FFMPEG_BIN = "ffmpeg" # on Linux and Mac OS + try: + with open(os.devnull, "w") as f: + sp.check_call(['ffmpeg', '-version'], stdout=f, stderr=f) + return "ffmpeg" + except: + return "avconv" def drawBaseImage(self, backgroundImage, titleText, titleFont): -- cgit v1.2.3