ff
This commit is contained in:
@@ -598,16 +598,16 @@ def convert(ctx,
|
||||
mediaFileProperties = FileProperties(context, sourcePath)
|
||||
|
||||
|
||||
if not cf is None:
|
||||
|
||||
cropArguments = mediaFileProperties.findCropArguments()
|
||||
|
||||
ctx.obj['logger'].info(f"\nSetting crop arguments: ouput width: {cropArguments[CropFilter.OUTPUT_WIDTH_KEY]} "
|
||||
+ f"height: {cropArguments[CropFilter.OUTPUT_HEIGHT_KEY]} "
|
||||
+ f"offset x: {cropArguments[CropFilter.OFFSET_X_KEY]} "
|
||||
+ f"y: {cropArguments[CropFilter.OFFSET_Y_KEY]}")
|
||||
|
||||
cf.setArguments(**cropArguments)
|
||||
# if not cf is None:
|
||||
#
|
||||
cropArguments = {} if cf is None else mediaFileProperties.findCropArguments()
|
||||
#
|
||||
# ctx.obj['logger'].info(f"\nSetting crop arguments: ouput width: {cropArguments[CropFilter.OUTPUT_WIDTH_KEY]} "
|
||||
# + f"height: {cropArguments[CropFilter.OUTPUT_HEIGHT_KEY]} "
|
||||
# + f"offset x: {cropArguments[CropFilter.OFFSET_X_KEY]} "
|
||||
# + f"y: {cropArguments[CropFilter.OFFSET_Y_KEY]}")
|
||||
#
|
||||
# cf.setArguments(**cropArguments)
|
||||
|
||||
|
||||
ssc = ShiftedSeasonController(context)
|
||||
@@ -798,7 +798,8 @@ def convert(ctx,
|
||||
targetPath,
|
||||
targetFormat,
|
||||
context['video_encoder'],
|
||||
chainIteration)
|
||||
chainIteration,
|
||||
cropArguments)
|
||||
|
||||
endTime = time.perf_counter()
|
||||
ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")
|
||||
|
||||
@@ -13,6 +13,7 @@ from ffx.constants import DEFAULT_cut_start, DEFAULT_cut_length
|
||||
|
||||
from ffx.filter.quality_filter import QualityFilter
|
||||
from ffx.filter.preset_filter import PresetFilter
|
||||
from ffx.filter.crop_filter import CropFilter
|
||||
|
||||
|
||||
class FfxController():
|
||||
@@ -176,7 +177,8 @@ class FfxController():
|
||||
targetPath,
|
||||
targetFormat: str = '',
|
||||
videoEncoder: VideoEncoder = VideoEncoder.VP9,
|
||||
chainIteration: list = []):
|
||||
chainIteration: list = [],
|
||||
cropArguments: dict = {}):
|
||||
# quality: int = DEFAULT_QUALITY,
|
||||
# preset: int = DEFAULT_AV1_PRESET):
|
||||
|
||||
@@ -191,7 +193,17 @@ class FfxController():
|
||||
|
||||
|
||||
filterParamTokens = []
|
||||
filterParamTokens.extend(cropFilters[0]['tokens'] if cropFilters else [])
|
||||
|
||||
if cropArguments:
|
||||
|
||||
cropParams = (f"crop="
|
||||
+ f"{CropFilter.OUTPUT_WIDTH_KEY}"
|
||||
+ f":{CropFilter.OUTPUT_HEIGHT_KEY}"
|
||||
+ f":{CropFilter.OFFSET_X_KEY}"
|
||||
+ f":{CropFilter.OFFSET_Y_KEY}")
|
||||
|
||||
filterParamTokens.extend(cropParams)
|
||||
|
||||
filterParamTokens.extend(denoiseFilters[0]['tokens'] if denoiseFilters else [])
|
||||
|
||||
filterTokens = ['-vf', ', '.join(filterParamTokens)]
|
||||
|
||||
@@ -12,16 +12,6 @@ class CropFilter(Filter):
|
||||
OFFSET_X_KEY = 'x_offset'
|
||||
OFFSET_Y_KEY = 'y_offset'
|
||||
|
||||
# ffmpeg -i in.mp4 -vf "crop=out_w:out_h:x:y" out.mp4
|
||||
#
|
||||
# Where the options are as follows:
|
||||
#
|
||||
# use "-vf" or -"filter:v" - depending on your version of ffmpeg/avconv
|
||||
# out_w is the width of the output rectangle
|
||||
# out_h is the height of the output rectangle
|
||||
# x and y specify the top left corner of the output rectangle (coordinates start at (0,0) in the top left corner of the input)
|
||||
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
self.__outputWidth = int(kwargs.get(CropFilter.OUTPUT_WIDTH_KEY, 0))
|
||||
@@ -39,8 +29,6 @@ class CropFilter(Filter):
|
||||
|
||||
def getPayload(self):
|
||||
|
||||
suffices = []
|
||||
|
||||
payload = {'identifier': CropFilter.IDENTIFIER,
|
||||
'parameters': {
|
||||
CropFilter.OUTPUT_WIDTH_KEY: self.__outputWidth,
|
||||
|
||||
Reference in New Issue
Block a user