You've already forked my-video-workflow
添加prod判断
This commit is contained in:
@ -4,7 +4,7 @@ import subprocess
|
||||
from datetime import datetime, timedelta
|
||||
from typing import IO
|
||||
|
||||
from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC
|
||||
from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC, PROD_ENV
|
||||
|
||||
|
||||
def get_video_real_duration(filename):
|
||||
@ -33,6 +33,7 @@ def encode_video_with_subtitles(orig_filename: str, subtitles: list[str], new_fi
|
||||
new_filename
|
||||
], stdout=subprocess.PIPE)
|
||||
handle_ffmpeg_output(encode_process.stdout)
|
||||
return encode_process.wait()
|
||||
|
||||
|
||||
def handle_ffmpeg_output(stderr: IO[bytes]) -> None:
|
||||
@ -40,6 +41,9 @@ def handle_ffmpeg_output(stderr: IO[bytes]) -> None:
|
||||
line = stderr.readline()
|
||||
if line == b"":
|
||||
break
|
||||
if PROD_ENV:
|
||||
# 正式环境不要输出一大堆的东西了
|
||||
continue
|
||||
if line.startswith(b"out_time="):
|
||||
cur_time = line.replace(b"out_time=", b"").decode()
|
||||
print("CurTime", cur_time.strip())
|
||||
|
Reference in New Issue
Block a user