intel qsv统一

This commit is contained in:
Jerry Yan 2022-07-02 16:42:15 +08:00
parent aca066aad1
commit 5535ef9828

View File

@ -1,5 +1,4 @@
import os
import platform
import subprocess
from datetime import datetime, timedelta
from typing import IO
@ -53,21 +52,9 @@ def get_encode_process_use_nvenc(orig_filename: str, subtitles: list[str], new_f
def get_encode_process_use_intel(orig_filename: str, subtitles: list[str], new_filename: str):
print("[+]Use Intel QSV Acceleration")
if platform.system().lower() == "windows":
encode_process = subprocess.Popen([
FFMPEG_EXEC, *_common_ffmpeg_setting(),
"-hwaccel", "qsv", "-i", orig_filename, "-vf",
",".join("subtitles=%s" % i for i in subtitles),
"-c:v", "h264_qsv", "-rc:v", "vbr",
*_common_ffmpeg_params(),
# "-t", "10",
new_filename
], stdout=subprocess.PIPE)
return encode_process
encode_process = subprocess.Popen([
FFMPEG_EXEC, *_common_ffmpeg_setting(),
"-init_hw_device", "qsv=hw", "-filter_hw_device", "hw",
"-i", orig_filename, "-vf",
"-hwaccel", "qsv", "-i", orig_filename, "-vf",
",".join("subtitles=%s" % i for i in subtitles),
"-c:v", "h264_qsv",
*_common_ffmpeg_params(),
@ -161,5 +148,5 @@ def _common_ffmpeg_params():
"-f", "mp4", "-b:v", VIDEO_BITRATE, "-c:a", "copy",
"-preset:v", "fast", "-profile:v", "main", "-avoid_negative_ts", "1",
"-qmin", "18", "-qmax", "38", "-crf", str(VIDEO_CRF), "-g:v", "240",
"-fflags", "+genpts", "-shortest", "-movflags", "faststart"
"-fflags", "+genpts", "-shortest"
)