Fix args passed to videotool. Fixed video.
Encodes at 4Mbps with multiple cores.
This commit is contained in:
parent
3bdcd1cc66
commit
a169bafdd8
@ -403,7 +403,7 @@ class Photo(object):
|
|||||||
transcode_path = os.path.join(transcode_path, video_cache(self._path))
|
transcode_path = os.path.join(transcode_path, video_cache(self._path))
|
||||||
# get number of cores on the system, and use all minus one
|
# get number of cores on the system, and use all minus one
|
||||||
num_of_cores = os.sysconf('SC_NPROCESSORS_ONLN') - 1
|
num_of_cores = os.sysconf('SC_NPROCESSORS_ONLN') - 1
|
||||||
transcode_cmd = ['-i', original_path, '-c:v', 'libvpx', '-crf', '10', '-b:v', '800k', '-c:a', 'libvorbis', '-f', 'webm', '-threads', num_of_cores, '-loglevel', '0', '-y']
|
transcode_cmd = ['-i', original_path, '-c:v', 'libvpx', '-crf', '10', '-b:v', '4M', '-c:a', 'libvorbis', '-f', 'webm', '-threads', str(num_of_cores), '-loglevel', '0', '-y']
|
||||||
filters = []
|
filters = []
|
||||||
info_string = "%s -> webm" % (os.path.basename(original_path))
|
info_string = "%s -> webm" % (os.path.basename(original_path))
|
||||||
message("transcoding", info_string)
|
message("transcoding", info_string)
|
||||||
@ -411,7 +411,7 @@ class Photo(object):
|
|||||||
self._video_metadata(transcode_path, False)
|
self._video_metadata(transcode_path, False)
|
||||||
return
|
return
|
||||||
if "originalSize" in self._attributes and self._attributes["originalSize"][1] > 720:
|
if "originalSize" in self._attributes and self._attributes["originalSize"][1] > 720:
|
||||||
filters.append("scale=trunc(oh*a/2)*2:min(720\,iw)")
|
filters.append("scale='trunc(oh*a/2)*2:min(720\,iw)'")
|
||||||
if "rotate" in self._attributes:
|
if "rotate" in self._attributes:
|
||||||
if self._attributes["rotate"] == "90":
|
if self._attributes["rotate"] == "90":
|
||||||
filters.append('transpose=1')
|
filters.append('transpose=1')
|
||||||
|
@ -7,7 +7,14 @@ class VideoToolWrapper(object):
|
|||||||
path = args[-1]
|
path = args[-1]
|
||||||
for tool in self.wrappers:
|
for tool in self.wrappers:
|
||||||
try:
|
try:
|
||||||
|
if self.check_output:
|
||||||
p = subprocess.check_output((tool,) + args)
|
p = subprocess.check_output((tool,) + args)
|
||||||
|
else:
|
||||||
|
p = subprocess.call((tool,) + args)
|
||||||
|
if p > 0:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return "SUCCESS"
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if self.cleanup:
|
if self.cleanup:
|
||||||
self.remove(path)
|
self.remove(path)
|
||||||
@ -30,9 +37,11 @@ class VideoToolWrapper(object):
|
|||||||
class VideoTranscodeWrapper(VideoToolWrapper):
|
class VideoTranscodeWrapper(VideoToolWrapper):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.wrappers = ['avconv', 'ffmpeg']
|
self.wrappers = ['avconv', 'ffmpeg']
|
||||||
|
self.check_output = False
|
||||||
self.cleanup = True
|
self.cleanup = True
|
||||||
|
|
||||||
class VideoProbeWrapper(VideoToolWrapper):
|
class VideoProbeWrapper(VideoToolWrapper):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.wrappers = ['avprobe', 'ffprobe']
|
self.wrappers = ['avprobe', 'ffprobe']
|
||||||
|
self.check_output = True
|
||||||
self.cleanup = False
|
self.cleanup = False
|
||||||
|
Loading…
Reference in New Issue
Block a user