use ffmpeg2theora from Firefogg if possible
This commit is contained in:
parent
6821b93478
commit
9cf7c84558
2 changed files with 16 additions and 3 deletions
|
@ -28,6 +28,7 @@ from twisted.web.resource import Resource, IResource
|
|||
from twisted.web.static import File
|
||||
from zope.interface import implements
|
||||
|
||||
FFMPEG2THEORA = 'ffmpeg2theora'
|
||||
|
||||
STATUS_NEW=0
|
||||
STATUS_EXTRACTING=1
|
||||
|
@ -41,6 +42,7 @@ VIDEO_PROFILES = [
|
|||
'96p',
|
||||
]
|
||||
|
||||
|
||||
class AspectRatio(fractions.Fraction):
|
||||
def __new__(cls, numerator, denominator=None):
|
||||
if not denominator:
|
||||
|
@ -63,7 +65,7 @@ class AspectRatio(fractions.Fraction):
|
|||
|
||||
def avinfo(filename):
|
||||
if os.path.getsize(filename):
|
||||
p = subprocess.Popen(['ffmpeg2theora', '--info', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen([FFMPEG2THEORA, '--info', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
info, error = p.communicate()
|
||||
#remove metadata, can be broken
|
||||
reg = re.compile('"metadata": {.*?},', re.DOTALL)
|
||||
|
@ -720,7 +722,8 @@ if __name__ == '__main__':
|
|||
db = 'dev.sqlite'
|
||||
|
||||
db = sys.argv[1]
|
||||
|
||||
if os.path.exists(sys.argv[2]):
|
||||
FFMPEG2THEORA = sys.argv[2]
|
||||
port = 2620
|
||||
interface = '127.0.0.1'
|
||||
interface = '10.26.20.10'
|
||||
|
|
|
@ -46,6 +46,16 @@ function OxFF() {
|
|||
}
|
||||
this.username = ox.get('username');
|
||||
this.password = ox.get('password');
|
||||
|
||||
AddonManager.getAddonByID('firefogg@firefogg.org', function(addon) {
|
||||
if (addon.hasResource('bin')) {
|
||||
var resource = addon.getResourceURI('bin');
|
||||
var file = resource.QueryInterface(Ci.nsIFileURL).file.QueryInterface(Ci.nsILocalFile);
|
||||
file.append('ffmpeg2theora');
|
||||
_this._ffmpeg2theora = file.path;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
OxFF.prototype = {
|
||||
|
@ -311,7 +321,7 @@ OxFF.prototype = {
|
|||
} catch (e) {}
|
||||
_this._daemon = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
|
||||
_this._daemon.init(file);
|
||||
var args = [ox.getDBFile().path];
|
||||
var args = [ox.getDBFile().path, _this._ffmpeg2theora];
|
||||
_this._daemon.runw(false, args, args.length);
|
||||
}
|
||||
AddonManager.getAddonByID(this.extensionID, function(addon) {
|
||||
|
|
Loading…
Reference in a new issue