qsv、对接

This commit is contained in:
2024-12-07 18:00:57 +08:00
parent fb51d144c0
commit 8d6159d302
3 changed files with 21 additions and 12 deletions

View File

@ -1,3 +1,5 @@
import uuid
class FfmpegTask(object):
@ -123,7 +125,7 @@ class FfmpegTask(object):
if self.task_type == 'encode':
input_args = []
filter_args = []
output_args = []
output_args = ["-shortest", "-c:v h264_qsv"]
video_output_str = "[0:v]"
audio_output_str = "[0:v]"
video_input_count = 0
@ -170,8 +172,8 @@ class FfmpegTask(object):
output_args.append(audio_output_str)
return args + input_args + ["-filter_complex", ";".join(filter_args)] + output_args + [self.get_output_file()]
elif self.task_type == 'concat':
input_args = ["-hwaccel qsv"]
output_args = []
input_args = []
output_args = ["-shortest", "-c:v", "h264_qsv", "-r", "25"]
filter_args = []
video_output_str = "[0:v]"
audio_output_str = "[0:v]"
@ -215,7 +217,6 @@ class FfmpegTask(object):
def set_output_file(self, file=None):
if file is None:
if self.output_file == '':
# TODO: Random Filename
self.output_file = "rand.mp4"
self.output_file = "rand_" + str(uuid.uuid4()) + ".mp4"
else:
self.output_file = file