You've already forked FrameTour-RenderWorker
hevc+重下模板
This commit is contained in:
@@ -6,11 +6,22 @@ from typing import Any
|
||||
|
||||
DEFAULT_ARGS = ("-shortest",)
|
||||
ENCODER_ARGS = ("-c:v", "h264", ) if not os.getenv("ENCODER_ARGS", False) else os.getenv("ENCODER_ARGS", "").split(" ")
|
||||
VIDEO_ARGS = ("-profile:v", "high", "-level:v", "4", )
|
||||
VIDEO_ARGS = ("-profile:v", "high", "-level:v", "4", ) if not os.getenv("VIDEO_ARGS", False) else os.getenv("VIDEO_ARGS", "").split(" ")
|
||||
AUDIO_ARGS = ("-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2", )
|
||||
MUTE_AUDIO_INPUT = ("-f", "lavfi", "-i", "anullsrc=cl=stereo:r=48000", )
|
||||
|
||||
|
||||
def get_mp4toannexb_filter():
|
||||
"""
|
||||
Determine which mp4toannexb filter to use based on ENCODER_ARGS.
|
||||
Returns 'hevc_mp4toannexb' if ENCODER_ARGS contains 'hevc', otherwise 'h264_mp4toannexb'.
|
||||
"""
|
||||
encoder_args_str = os.getenv("ENCODER_ARGS", "").lower()
|
||||
if "hevc" in encoder_args_str:
|
||||
return "hevc_mp4toannexb"
|
||||
return "h264_mp4toannexb"
|
||||
|
||||
|
||||
class FfmpegTask(object):
|
||||
|
||||
effects: list[str]
|
||||
@@ -164,7 +175,7 @@ class FfmpegTask(object):
|
||||
output_args = [*VIDEO_ARGS, *AUDIO_ARGS, *ENCODER_ARGS, *DEFAULT_ARGS]
|
||||
if self.annexb:
|
||||
output_args.append("-bsf:v")
|
||||
output_args.append("h264_mp4toannexb")
|
||||
output_args.append(get_mp4toannexb_filter())
|
||||
output_args.append("-reset_timestamps")
|
||||
output_args.append("1")
|
||||
video_output_str = "[0:v]"
|
||||
@@ -359,7 +370,7 @@ class FfmpegTask(object):
|
||||
output_args += AUDIO_ARGS
|
||||
if self.annexb:
|
||||
output_args.append("-bsf:v")
|
||||
output_args.append("h264_mp4toannexb")
|
||||
output_args.append(get_mp4toannexb_filter())
|
||||
output_args.append("-bsf:a")
|
||||
output_args.append("setts=pts=DTS")
|
||||
output_args.append("-f")
|
||||
|
Reference in New Issue
Block a user