|
|
|
@ -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,
|
|
|
|
@ -51,10 +39,10 @@ class CropFilter(Filter):
|
|
|
|
|
'suffices': [],
|
|
|
|
|
'variant': f"C{self.__outputWidth}-{self.__outputHeight}-{self.__offsetX}-{self.__offsetY}",
|
|
|
|
|
'tokens': ['crop='
|
|
|
|
|
+ f"{self.__outputWidth}"
|
|
|
|
|
+ f":{self.__outputHeight}"
|
|
|
|
|
+ f":{self.__offsetX}"
|
|
|
|
|
+ f":{self.__offsetY}"]}
|
|
|
|
|
+ f"{self.__outputWidth}"
|
|
|
|
|
+ f":{self.__outputHeight}"
|
|
|
|
|
+ f":{self.__offsetX}"
|
|
|
|
|
+ f":{self.__offsetY}"]}
|
|
|
|
|
|
|
|
|
|
return payload
|
|
|
|
|
|
|
|
|
|