去除CRF,避免码率设置失效

This commit is contained in:
2022-12-08 12:20:14 +08:00
parent 92bc5791ac
commit c3993965a9
4 changed files with 28 additions and 13 deletions

View File

@ -5,7 +5,7 @@ from typing import IO
from config import FFMPEG_EXEC, FFMPEG_USE_HEVC, VIDEO_BITRATE, FFMPEG_USE_NVIDIA_GPU, VIDEO_CLIP_EACH_SEC, \
VIDEO_CLIP_OVERFLOW_SEC, \
FFMPEG_USE_INTEL_GPU, VIDEO_OUTPUT_DIR, VIDEO_CRF, VIDEO_GOP, FFMPEG_USE_VAAPI
FFMPEG_USE_INTEL_GPU, VIDEO_OUTPUT_DIR, VIDEO_GOP, FFMPEG_USE_VAAPI
from . import LOGGER
@ -214,7 +214,7 @@ def quick_split_video(file):
split_process = subprocess.Popen([
FFMPEG_EXEC, *_common_ffmpeg_setting(),
"-ss", str(current_sec),
"-i", file, "-c:v", "copy", "-c:a", "aac", "-f", "mp4",
"-i", file, "-c:v", "copy", "-c:a", "copy", "-f", "mp4",
"-t", str(VIDEO_CLIP_EACH_SEC + VIDEO_CLIP_OVERFLOW_SEC),
"-fflags", "+genpts", "-shortest", "-movflags", "faststart",
os.path.join(VIDEO_OUTPUT_DIR, "{}.mp4".format(current_dt))
@ -239,6 +239,6 @@ def _common_ffmpeg_params():
return (
"-f", "mp4", "-b:v", VIDEO_BITRATE, "-c:a", "aac",
"-preset:v", "fast", "-profile:v", "main", "-avoid_negative_ts", "1",
"-qmin", "18", "-qmax", "38", "-crf", str(VIDEO_CRF), "-g:v", str(VIDEO_GOP),
"-qmin", "18", "-qmax", "38", "-g:v", str(VIDEO_GOP),
"-fflags", "+genpts", "-shortest"
)