warn if ffmpeg does not support requested format

This commit is contained in:
j 2015-12-24 21:32:17 +05:30
parent 49aa7e3746
commit 252158a216

View file

@ -16,6 +16,7 @@ class DistributedClient:
def __init__(self, url, name): def __init__(self, url, name):
self.url = url self.url = url
self.name = name self.name = name
self.supported_formats = extract.supported_formats()
def ping(self, oshash): def ping(self, oshash):
try: try:
@ -44,6 +45,12 @@ class DistributedClient:
def encode(self, oshash, cmd, output): def encode(self, oshash, cmd, output):
cmd[0] = extract.command('ffmpeg') cmd[0] = extract.command('ffmpeg')
if 'webm' in cmd and not self.supported_formats['webm']:
print "ffmpeg is compiled without WebM support"
return
elif cmd[-1].endswith('.mp4') and not self.supported_formats['webm']:
print "ffmpeg is compiled without H.264 support"
return
try: try:
p = subprocess.Popen(cmd) p = subprocess.Popen(cmd)
r = None r = None
@ -71,7 +78,7 @@ class DistributedClient:
self.status(oshash, 'failed') self.status(oshash, 'failed')
if os.path.exists(output): if os.path.exists(output):
os.unlink(output) os.unlink(output)
def run(self): def run(self):
new = True new = True
while True: while True: