去除CRF,避免码率设置失效
This commit is contained in:
parent
92bc5791ac
commit
c3993965a9
@ -30,8 +30,6 @@ FFMPEG_USE_INTEL_GPU = False
|
||||
FFMPEG_USE_VAAPI = False
|
||||
# bitrate
|
||||
VIDEO_BITRATE = "2.5M"
|
||||
# crf
|
||||
VIDEO_CRF = 28
|
||||
# gop
|
||||
VIDEO_GOP = 60
|
||||
# [video]
|
||||
@ -96,7 +94,7 @@ 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_HEVC, FFMPEG_USE_NVIDIA_GPU, FFMPEG_USE_INTEL_GPU, VIDEO_BITRATE, VIDEO_CRF, \
|
||||
global FFMPEG_EXEC, FFMPEG_USE_HEVC, FFMPEG_USE_NVIDIA_GPU, FFMPEG_USE_INTEL_GPU, VIDEO_BITRATE, \
|
||||
VIDEO_GOP, FFMPEG_USE_VAAPI
|
||||
FFMPEG_EXEC = section.get('exec', FFMPEG_EXEC)
|
||||
FFMPEG_USE_HEVC = section.getboolean('hevc', FFMPEG_USE_HEVC)
|
||||
@ -104,7 +102,6 @@ def load_config():
|
||||
FFMPEG_USE_INTEL_GPU = section.getboolean('intel_gpu', FFMPEG_USE_INTEL_GPU)
|
||||
FFMPEG_USE_VAAPI = section.getboolean('vaapi', FFMPEG_USE_VAAPI)
|
||||
VIDEO_BITRATE = section.get('bitrate', VIDEO_BITRATE)
|
||||
VIDEO_CRF = section.getfloat('crf', VIDEO_CRF)
|
||||
VIDEO_GOP = section.getfloat('gop', VIDEO_GOP)
|
||||
if config.has_section("recorder"):
|
||||
global BILILIVE_RECORDER_DIRECTORY, XIGUALIVE_RECORDER_DIRECTORY, VIDEO_OUTPUT_DIR
|
||||
@ -144,7 +141,6 @@ def get_config():
|
||||
'intel_gpu': FFMPEG_USE_INTEL_GPU,
|
||||
'vaapi': FFMPEG_USE_VAAPI,
|
||||
'bitrate': VIDEO_BITRATE,
|
||||
'crf': VIDEO_CRF,
|
||||
'gop': VIDEO_GOP,
|
||||
},
|
||||
'recorder': {
|
||||
|
@ -104,10 +104,6 @@
|
||||
<td>视频比特率</td>
|
||||
<td>{{ config.ffmpeg.bitrate }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>视频CRF</td>
|
||||
<td>{{ config.ffmpeg.crf }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GOP</td>
|
||||
<td>{{ config.ffmpeg.gop }}</td>
|
||||
@ -328,7 +324,6 @@
|
||||
intel_gpu: false,
|
||||
vaapi: false,
|
||||
bitrate: "",
|
||||
crf: "",
|
||||
gop: "",
|
||||
},
|
||||
recorder: {
|
||||
|
24
test/create_workflow.py
Normal file
24
test/create_workflow.py
Normal file
@ -0,0 +1,24 @@
|
||||
import requests
|
||||
from time import sleep
|
||||
|
||||
|
||||
API_BASE = "https://bilirec.home.jerryyan.top"
|
||||
FILE = "24048885/20221125_201819.flv"
|
||||
|
||||
requests.post(API_BASE+"/api/bilirecorder/", json={
|
||||
"EventType": "SessionStarted"
|
||||
})
|
||||
sleep(1)
|
||||
response = requests.post(API_BASE+"/api/bilirecorder/", json={
|
||||
"EventType": "FileClosed",
|
||||
"EventData": {
|
||||
"RelativePath": FILE
|
||||
}
|
||||
})
|
||||
sleep(1)
|
||||
requests.post(API_BASE+"/api/bilirecorder/", json={
|
||||
"EventType": "SessionEnded",
|
||||
})
|
||||
|
||||
print(response)
|
||||
print(response.json())
|
@ -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"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user