|
|
|
@ -32,6 +32,7 @@ from ffx.filter.preset_filter import PresetFilter
|
|
|
|
|
|
|
|
|
|
|
|
from ffx.filter.crop_filter import CropFilter
|
|
|
|
from ffx.filter.crop_filter import CropFilter
|
|
|
|
from ffx.filter.nlmeans_filter import NlmeansFilter
|
|
|
|
from ffx.filter.nlmeans_filter import NlmeansFilter
|
|
|
|
|
|
|
|
from ffx.filter.deinterlace_filter import DeinterlaceFilter
|
|
|
|
|
|
|
|
|
|
|
|
from ffx.constants import VERSION
|
|
|
|
from ffx.constants import VERSION
|
|
|
|
|
|
|
|
|
|
|
|
@ -335,6 +336,8 @@ def checkUniqueDispositions(context, mediaDescriptor: MediaDescriptor):
|
|
|
|
|
|
|
|
|
|
|
|
@click.option("--output-directory", type=str, default='')
|
|
|
|
@click.option("--output-directory", type=str, default='')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.option("--deinterlace", is_flag=False, flag_value="default", default="none")
|
|
|
|
|
|
|
|
|
|
|
|
@click.option("--denoise", is_flag=False, flag_value="default", default="none")
|
|
|
|
@click.option("--denoise", is_flag=False, flag_value="default", default="none")
|
|
|
|
@click.option("--denoise-use-hw", is_flag=True, default=False)
|
|
|
|
@click.option("--denoise-use-hw", is_flag=True, default=False)
|
|
|
|
@click.option('--denoise-strength', type=str, default='', help='Denoising strength, more blurring vs more details.')
|
|
|
|
@click.option('--denoise-strength', type=str, default='', help='Denoising strength, more blurring vs more details.')
|
|
|
|
@ -391,6 +394,8 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
output_directory,
|
|
|
|
output_directory,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deinterlace,
|
|
|
|
|
|
|
|
|
|
|
|
denoise,
|
|
|
|
denoise,
|
|
|
|
denoise_use_hw,
|
|
|
|
denoise_use_hw,
|
|
|
|
denoise_strength,
|
|
|
|
denoise_strength,
|
|
|
|
@ -517,14 +522,6 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
ctx.obj['logger'].debug(f"\nVideo encoder: {video_encoder}")
|
|
|
|
ctx.obj['logger'].debug(f"\nVideo encoder: {video_encoder}")
|
|
|
|
|
|
|
|
|
|
|
|
qualityTokens = quality.split(',')
|
|
|
|
|
|
|
|
q_list = [q for q in qualityTokens if q.isnumeric()]
|
|
|
|
|
|
|
|
ctx.obj['logger'].debug(f"Qualities: {q_list}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
presetTokens = preset.split(',')
|
|
|
|
|
|
|
|
p_list = [p for p in presetTokens if p.isnumeric()]
|
|
|
|
|
|
|
|
ctx.obj['logger'].debug(f"Presets: {p_list}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context['bitrates'] = {}
|
|
|
|
context['bitrates'] = {}
|
|
|
|
context['bitrates']['stereo'] = str(stereo_bitrate) if str(stereo_bitrate).endswith('k') else f"{stereo_bitrate}k"
|
|
|
|
context['bitrates']['stereo'] = str(stereo_bitrate) if str(stereo_bitrate).endswith('k') else f"{stereo_bitrate}k"
|
|
|
|
@ -548,9 +545,12 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
tc = TmdbController() if context['use_tmdb'] else None
|
|
|
|
tc = TmdbController() if context['use_tmdb'] else None
|
|
|
|
|
|
|
|
|
|
|
|
qualityKwargs = {QualityFilter.QUALITY_KEY: str(QualityFilter.DEFAULT_H264_QUALITY if (context['video_encoder'] == VideoEncoder.H264 and not quality) else quality)}
|
|
|
|
|
|
|
|
|
|
|
|
qualityKwargs = {QualityFilter.QUALITY_KEY: str(quality)}
|
|
|
|
qf = QualityFilter(**qualityKwargs)
|
|
|
|
qf = QualityFilter(**qualityKwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if context['video_encoder'] == VideoEncoder.AV1 and preset:
|
|
|
|
if context['video_encoder'] == VideoEncoder.AV1 and preset:
|
|
|
|
presetKwargs = {PresetFilter.PRESET_KEY: preset}
|
|
|
|
presetKwargs = {PresetFilter.PRESET_KEY: preset}
|
|
|
|
PresetFilter(**presetKwargs)
|
|
|
|
PresetFilter(**presetKwargs)
|
|
|
|
@ -575,6 +575,9 @@ def convert(ctx,
|
|
|
|
if denoise != 'none' or denoiseKwargs:
|
|
|
|
if denoise != 'none' or denoiseKwargs:
|
|
|
|
NlmeansFilter(**denoiseKwargs)
|
|
|
|
NlmeansFilter(**denoiseKwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if deinterlace != 'none':
|
|
|
|
|
|
|
|
DeinterlaceFilter()
|
|
|
|
|
|
|
|
|
|
|
|
chainYield = list(qf.getChainYield())
|
|
|
|
chainYield = list(qf.getChainYield())
|
|
|
|
|
|
|
|
|
|
|
|
ctx.obj['logger'].info(f"\nRunning {len(existingSourcePaths) * len(chainYield)} jobs")
|
|
|
|
ctx.obj['logger'].info(f"\nRunning {len(existingSourcePaths) * len(chainYield)} jobs")
|
|
|
|
@ -791,15 +794,18 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
ctx.obj['logger'].info(f"Creating file {targetFilename}")
|
|
|
|
ctx.obj['logger'].info(f"Creating file {targetFilename}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if rename_only:
|
|
|
|
if rename_only:
|
|
|
|
shutil.copyfile(sourcePath, targetPath)
|
|
|
|
shutil.copyfile(sourcePath, targetPath)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
fc.runJob(sourcePath,
|
|
|
|
fc.runJob(sourcePath,
|
|
|
|
targetPath,
|
|
|
|
targetPath,
|
|
|
|
targetFormat,
|
|
|
|
targetFormat,
|
|
|
|
context['video_encoder'],
|
|
|
|
|
|
|
|
chainIteration,
|
|
|
|
chainIteration,
|
|
|
|
cropArguments)
|
|
|
|
cropArguments,
|
|
|
|
|
|
|
|
currentPattern)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endTime = time.perf_counter()
|
|
|
|
endTime = time.perf_counter()
|
|
|
|
ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")
|
|
|
|
ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")
|
|
|
|
|