fix: import path
This commit is contained in:
+6
-3
@@ -5,8 +5,7 @@ import time
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parent))
|
||||
from transcode_core import BaseTranscoder
|
||||
from core import BaseTranscoder
|
||||
|
||||
VIDEO_DEFAULTS = {
|
||||
"libx265": ["-preset", "slow", "-pix_fmt", "yuv420p10le", "-x265-params", "aq-mode=3:aq-strength=0.8:psy-rd=1.0"],
|
||||
@@ -19,6 +18,7 @@ AUDIO_DEFAULTS = {
|
||||
"opus": ["-c:a", "libopus", "-b:a", "128k", "-vbr", "on"],
|
||||
}
|
||||
|
||||
|
||||
class MediaTranscoder2Pass(BaseTranscoder):
|
||||
def __init__(self, args):
|
||||
super().__init__(args, VIDEO_DEFAULTS, AUDIO_DEFAULTS)
|
||||
@@ -59,7 +59,8 @@ class MediaTranscoder2Pass(BaseTranscoder):
|
||||
with open(self.log_path, "a", encoding="utf-8") as f:
|
||||
f.write(log_content)
|
||||
|
||||
self._send_notification(encode_time=encode_time, new_info=new_info, vmaf=vmaf_score, full_text=log_content, extra_title="2-Pass转码")
|
||||
self._send_notification(encode_time=encode_time, new_info=new_info, vmaf=vmaf_score,
|
||||
full_text=log_content, extra_title="2-Pass转码")
|
||||
|
||||
print(f"\n转码完成!耗时: {encode_time:.2f} 秒")
|
||||
print(f"输出文件: {self.output_path}")
|
||||
@@ -111,6 +112,7 @@ class MediaTranscoder2Pass(BaseTranscoder):
|
||||
except Exception as e:
|
||||
print(f"[Cleanup Warning] 无法删除临时日志 {log_file.name}: {e}")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="2-Pass 可配置视频转码脚本")
|
||||
parser.add_argument("-i", "--input", required=True, help="输入视频文件")
|
||||
@@ -131,5 +133,6 @@ def main():
|
||||
except Exception as e:
|
||||
sys.exit(f"发生错误: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user