Fixes Issue #2 #4
@ -65,16 +65,20 @@ class Transcoder:
|
||||
workbase))
|
||||
transcodes['poster'] = thumbjob
|
||||
|
||||
pending.append({'jobs': transcodes,
|
||||
'data': stream})
|
||||
|
||||
obj = {'jobs': transcodes,
|
||||
'data': stream}
|
||||
if 'slides' in package:
|
||||
slides_job = pool.apply_async(_Worker.make_slides_video,
|
||||
slides = {}
|
||||
for maxheight in self.variants:
|
||||
crf, preset = self.variants[maxheight]
|
||||
slides[maxheight] = pool.apply_async(_Worker.make_slides_video,
|
||||
(self.worker,
|
||||
package['demux_file'],
|
||||
workbase,
|
||||
maxheight, preset, crf))
|
||||
|
||||
obj['slides'] = slides
|
||||
pending.append(obj)
|
||||
|
||||
pool.close()
|
||||
pool.join()
|
||||
@ -84,10 +88,16 @@ class Transcoder:
|
||||
for item in pending:
|
||||
stream = item['data']
|
||||
jobs = item['jobs']
|
||||
slide_jobs = item.get('slides')
|
||||
streams = {}
|
||||
slides = {}
|
||||
for maxheight in self.variants:
|
||||
streams[maxheight] = jobs[maxheight].get()
|
||||
if slide_jobs is not None:
|
||||
slides[maxheight] = slide_jobs[maxheight].get()
|
||||
stream['video'] = streams
|
||||
if slide_jobs is not None:
|
||||
stream['slides'] = slides
|
||||
if 'poster' in jobs:
|
||||
stream['poster'] = jobs['poster'].get()
|
||||
if not package['thumb'] and stream['playAudio']:
|
||||
@ -174,7 +184,7 @@ class _Worker:
|
||||
(ffmpeg
|
||||
.input(demux_file, framerate=25)
|
||||
.filter('scale', height='min(in_h, {}').format(maxheight, width=-2)
|
||||
.output(outpath, crf=crf, preset=preset, movflags='faststart', pix_fmt='yuv420p')
|
||||
.output(outpath, crf=crf, preset=preset, vsync='vfr', movflags='faststart', pix_fmt='yuv420p')
|
||||
.run(quiet=quiet))
|
||||
|
||||
runtime = time.time() - start
|
||||
|
Loading…
x
Reference in New Issue
Block a user