You've already forked FrameTour-RenderWorker
单独渲染模板
This commit is contained in:
@@ -4,5 +4,6 @@ SUPPORT_FEATURE = (
|
|||||||
'hevc_encode',
|
'hevc_encode',
|
||||||
'rapid_download',
|
'rapid_download',
|
||||||
'rclone_upload',
|
'rclone_upload',
|
||||||
|
'custom_re_encode',
|
||||||
)
|
)
|
||||||
SOFTWARE_VERSION = '0.0.3'
|
SOFTWARE_VERSION = '0.0.4'
|
||||||
|
@@ -20,13 +20,23 @@ def re_encode_and_annexb(file):
|
|||||||
return file
|
return file
|
||||||
logger.info("ReEncodeAndAnnexb: %s", file)
|
logger.info("ReEncodeAndAnnexb: %s", file)
|
||||||
has_audio = not not probe_video_audio(file)
|
has_audio = not not probe_video_audio(file)
|
||||||
|
# 优先使用RE_ENCODE_VIDEO_ARGS环境变量,其次使用默认的VIDEO_ARGS
|
||||||
|
if os.getenv("RE_ENCODE_VIDEO_ARGS", False):
|
||||||
|
_video_args = tuple(os.getenv("RE_ENCODE_VIDEO_ARGS", "").split(" "))
|
||||||
|
else:
|
||||||
|
_video_args = VIDEO_ARGS
|
||||||
|
# 优先使用RE_ENCODE_ENCODER_ARGS环境变量,其次使用默认的ENCODER_ARGS
|
||||||
|
if os.getenv("RE_ENCODE_ENCODER_ARGS", False):
|
||||||
|
_encoder_args = tuple(os.getenv("RE_ENCODE_ENCODER_ARGS", "").split(" "))
|
||||||
|
else:
|
||||||
|
_encoder_args = ENCODER_ARGS
|
||||||
ffmpeg_process = subprocess.run(["ffmpeg", "-y", "-hide_banner", "-i", file,
|
ffmpeg_process = subprocess.run(["ffmpeg", "-y", "-hide_banner", "-i", file,
|
||||||
*(set() if has_audio else MUTE_AUDIO_INPUT),
|
*(set() if has_audio else MUTE_AUDIO_INPUT),
|
||||||
"-fps_mode", "cfr",
|
"-fps_mode", "cfr",
|
||||||
"-map", "0:v", "-map", "0:a" if has_audio else "1:a",
|
"-map", "0:v", "-map", "0:a" if has_audio else "1:a",
|
||||||
*VIDEO_ARGS, "-bsf:v", get_mp4toannexb_filter(),
|
*_video_args, "-bsf:v", get_mp4toannexb_filter(),
|
||||||
*AUDIO_ARGS, "-bsf:a", "setts=pts=DTS",
|
*AUDIO_ARGS, "-bsf:a", "setts=pts=DTS",
|
||||||
*ENCODER_ARGS, "-shortest", "-fflags", "+genpts",
|
*_encoder_args, "-shortest", "-fflags", "+genpts",
|
||||||
"-f", "mpegts", file + ".ts"])
|
"-f", "mpegts", file + ".ts"])
|
||||||
logger.info(" ".join(ffmpeg_process.args))
|
logger.info(" ".join(ffmpeg_process.args))
|
||||||
span.set_attribute("ffmpeg.args", json.dumps(ffmpeg_process.args))
|
span.set_attribute("ffmpeg.args", json.dumps(ffmpeg_process.args))
|
||||||
|
Reference in New Issue
Block a user