VIDEO_CRF

This commit is contained in:
Jerry Yan 2022-06-01 09:15:15 +08:00
parent e057d888ca
commit bdc82f986c
2 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,8 @@ FFMPEG_USE_NVIDIA_GPU = True
FFMPEG_USE_INTEL_GPU = True
# bitrate
VIDEO_BITRATE = "2.5M"
# crf
VIDEO_CRF = 26
# [video]
# title
VIDEO_TITLE = "【永恒de草薙直播录播】直播于 {}"
@ -61,11 +63,12 @@ def load_config():
VIDEO_CLIP_OVERFLOW_SEC = section.getfloat('overflow_sec', VIDEO_CLIP_OVERFLOW_SEC)
if config.has_section("ffmpeg"):
section = config['ffmpeg']
global FFMPEG_EXEC, FFMPEG_USE_NVIDIA_GPU, FFMPEG_USE_INTEL_GPU, VIDEO_BITRATE
global FFMPEG_EXEC, FFMPEG_USE_NVIDIA_GPU, FFMPEG_USE_INTEL_GPU, VIDEO_BITRATE, VIDEO_CRF
FFMPEG_EXEC = section.get('exec', FFMPEG_EXEC)
FFMPEG_USE_NVIDIA_GPU = section.getboolean('nvidia_gpu', FFMPEG_USE_NVIDIA_GPU)
FFMPEG_USE_INTEL_GPU = section.getboolean('intel_gpu', FFMPEG_USE_INTEL_GPU)
VIDEO_BITRATE = section.get('bitrate', VIDEO_BITRATE)
VIDEO_CRF = section.getfloat('crf', VIDEO_CRF)
if config.has_section("recorder"):
global BILILIVE_RECORDER_DIRECTORY, XIGUALIVE_RECORDER_DIRECTORY, VIDEO_OUTPUT_DIR
section = config['recorder']
@ -92,6 +95,7 @@ def get_config():
'nvidia_gpu': FFMPEG_USE_NVIDIA_GPU,
'intel_gpu': FFMPEG_USE_INTEL_GPU,
'bitrate': VIDEO_BITRATE,
'crf': VIDEO_CRF,
},
'recorder': {
'bili_dir': BILILIVE_RECORDER_DIRECTORY,

View File

@ -16,7 +16,7 @@ from PyQt5.QtWidgets import QWidget, QLabel, QApplication, QFrame, QVBoxLayout,
from danmaku_xml_helper import get_file_start, diff_danmaku_files, NoDanmakuException
from config import load_config, FFMPEG_EXEC, DANMAKU_FACTORY_EXEC, FFMPEG_USE_INTEL_GPU, FFMPEG_USE_NVIDIA_GPU, \
VIDEO_BITRATE, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC, VIDEO_RESOLUTION, DANMAKU_SPEED, DEFAULT_FONT_NAME, \
VIDEO_OUTPUT_DIR
VIDEO_OUTPUT_DIR, VIDEO_CRF
class Job:
@ -563,7 +563,7 @@ def _common_ffmpeg_params():
return (
"-f", "mp4", "-b:v", VIDEO_BITRATE, "-c:a", "copy",
"-preset:v", "fast", "-profile:v", "main", "-avoid_negative_ts", "1",
"-qmin", "12", "-qmax", "34", "-crf", "26", "-g:v", "60",
"-qmin", "18", "-qmax", "38", "-crf", str(VIDEO_CRF), "-g:v", "240",
"-fflags", "+genpts", "-shortest", "-movflags", "faststart"
)