Removed GPU code from transcode.py, since it never worked properly.
Also cleaned out irrelevant options from config.ini.example. - Removed the encoder setting for transcodes i config.ini.example since only software is supported now. - Since TranscodeWhisperHandler no longer uses the job pool, removed the jobsize setting in config.ini.example. - Changed default pool and job size to saner values. The entire WorkThread class should probably be dropped.
This commit is contained in:
parent
27598d4401
commit
dd0af2221f
@ -57,7 +57,7 @@ token = A70keN
|
||||
# size and one other job of the next smaller size. Otherwise no jobs will run.
|
||||
#
|
||||
# See also TranscodeHandler.jobsize and SubtitlesHandler.jobsize
|
||||
capacity = 20
|
||||
capacity = 3
|
||||
|
||||
|
||||
[Daisy]
|
||||
@ -79,12 +79,6 @@ whispermodel = large-v2
|
||||
# Where to store model data
|
||||
modeldir = /some/path
|
||||
|
||||
# See also Pool.capacity.
|
||||
# The amount of resources a single whisper job will consume
|
||||
# in the worker pool. This should be set so that the server can handle the
|
||||
# pool getting completely filled with jobs of this type.
|
||||
jobsize = 5
|
||||
|
||||
# What device type to use. Accepts 'cpu' or 'gpu'.
|
||||
device = gpu
|
||||
|
||||
@ -110,16 +104,11 @@ textcolor = white
|
||||
|
||||
|
||||
[TranscodeHandler]
|
||||
# The video encoder pipeline to use to re-encode incoming presentations
|
||||
## Valid choices are software and nvidia
|
||||
## May be omitted, defaults to software.
|
||||
encoder = software
|
||||
|
||||
# See also Pool.capacity.
|
||||
# The amount of resources a single transcode job will consume
|
||||
# in the worker pool. This should be set so that the server can handle the
|
||||
# pool getting completely filled with jobs of this type.
|
||||
jobsize = 2
|
||||
jobsize = 1
|
||||
|
||||
|
||||
[MediasiteProcessor]
|
||||
|
@ -59,7 +59,7 @@ def _scale(insize, maxheight):
|
||||
return (scaled_width, scaled_height, scale_factor)
|
||||
|
||||
|
||||
def _do_transcode(inpath, outpath, maxheight, encoder='software'):
|
||||
def _do_transcode(inpath, outpath, maxheight):
|
||||
"""
|
||||
Transcode a video file.
|
||||
|
||||
@ -87,36 +87,6 @@ def _do_transcode(inpath, outpath, maxheight, encoder='software'):
|
||||
# any scalings where the width would have become odd.
|
||||
videosettings_out['vf'] = f'scale=-2:{height}'
|
||||
|
||||
# Apple prores is incompatible with nvidia hardware,
|
||||
# so ignore request for hardware acceleration in that case
|
||||
if encoder == 'nvidia' and codec != 'prores':
|
||||
# Ensure work stays on gpu as much as possible
|
||||
videosettings_in = {'hwaccel': 'cuda',
|
||||
'hwaccel_output_format': 'cuda'}
|
||||
|
||||
# Pick the GPU to run on.
|
||||
# This does not match documentation, which suggests the -gpu flag.
|
||||
# That flag seems to do nothing, however.
|
||||
videosettings_in['hwaccel_device'] = 1
|
||||
|
||||
videosettings_out = {'c:v': 'h264_nvenc',
|
||||
# Variable bitrate settings
|
||||
'rc:v': 'vbr',
|
||||
'b:v': 0,
|
||||
'cq:v': 19,
|
||||
'tune:v': 'hq',
|
||||
'preset:v': 'p4',
|
||||
'profile:v': 'high',
|
||||
# Dynamic B-frames
|
||||
#'rc-lookahead:v': 32,
|
||||
# Ensure correct container format
|
||||
'f': 'mp4'}
|
||||
|
||||
# Scale the output if necessary
|
||||
if scale < 1:
|
||||
s = f'scale_npp={width}:{height}:interp_algo=super'
|
||||
videosettings_out['vf'] = s
|
||||
|
||||
logger = logging.getLogger('play-daemon.TranscodeHandler._do_transcode')
|
||||
logger.info('Starting ffmpeg transcode job for %s', inpath)
|
||||
try:
|
||||
@ -201,8 +171,7 @@ class TranscodeHandler(Handler):
|
||||
outpath = path.join(tempdir, outfile)
|
||||
args = (inpath,
|
||||
outpath,
|
||||
int(maxheight),
|
||||
self.config.get('encoder', 'software'))
|
||||
int(maxheight))
|
||||
transcode = self.asyncjob(int(self.config['jobsize']),
|
||||
_do_transcode,
|
||||
args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user