Add support for rotated videos

This commit is contained in:
Sergio Costas 2022-03-02 15:03:12 +00:00
parent 568271ee80
commit 949684b55d
7 changed files with 89 additions and 57 deletions

View file

@ -178,6 +178,20 @@ class ffmpeg(devedeng.executor.executor):
vflip = False
hflip = False
if (file_project.prerotation == 90):
if (cmd_line != ""):
cmd_line += ",fifo,"
cmd_line += "transpose=1"
elif (file_project.prerotation == -90) or (file_project.prerotation == 270):
if (cmd_line != ""):
cmd_line += ",fifo,"
cmd_line += "transpose=2"
elif (file_project.prerotation == 180):
if (cmd_line != ""):
cmd_line += ",fifo,"
vflip = not vflip
hflip = not hflip
if (file_project.rotation == "rotation_90"):
if (cmd_line != ""):
cmd_line += ",fifo,"
@ -187,8 +201,8 @@ class ffmpeg(devedeng.executor.executor):
cmd_line += ",fifo,"
cmd_line += "transpose=2"
elif (file_project.rotation == "rotation_180"):
vflip = True
hflip = True
vflip = not vflip
hflip = not hflip
if (file_project.mirror_vertical):
vflip = not vflip
@ -207,16 +221,12 @@ class ffmpeg(devedeng.executor.executor):
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
if (cmd_line != ""):
cmd_line += ",fifo,"
x = int((file_project.width_midle -
file_project.original_width) / 2)
y = int((file_project.height_midle -
file_project.original_height) / 2)
x = int((file_project.width_midle - file_project.original_width) / 2)
y = int((file_project.height_midle - file_project.original_height) / 2)
if (x > 0) or (y > 0):
cmd_line += "pad=" + str(file_project.width_midle) + ":" + str(
file_project.height_midle) + ":" + str(x) + ":" + str(y) + ":0x000000"
cmd_line += "pad=" + str(file_project.width_midle) + ":" + str(file_project.height_midle) + ":" + str(x) + ":" + str(y) + ":0x000000"
else:
cmd_line += "crop=" + str(file_project.width_midle) + ":" + str(
file_project.height_midle) + ":" + str(x) + ":" + str(y)
cmd_line += "crop=" + str(file_project.width_midle) + ":" + str(file_project.height_midle) + ":" + str(x) + ":" + str(y)
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
if (cmd_line != ""):
@ -493,6 +503,7 @@ class ffmpeg(devedeng.executor.executor):
self.command_var.append("1")
self.command_var.append(output_file)
print(self.command_var)
def _adjust_audio_bitrate(self, bitrate):
br = [32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384]