Post #9
50
البته دردسر سرورش هست چون سرور با cpu خاصی میخواد
import type { EncodingProfile } from "@/ff/mpeg/newoptions.js";
const qsvHwaccel = [
["-init_hw_device", "vaapi=intel:/dev/dri/renderD128"],
["-init_hw_device", "qsv=hw@intel"],
["-filter_hw_device", "hw"],
["-hwaccel", "qsv"],
["-hwaccel_output_format", "qsv"],
];
const rateControlOpt = [
["-extbrc", "1"],
["-look_ahead_depth", "60"],
["-rdo", "1"],
["-mbbrc", "1"],
["-adaptive_i", "1"],
["-adaptive_b", "1"],
];
const baseOpus = [
["-c:a", "libopus"],
["-vbr", "on"],
["-ac", "1"],
];
const qsvHevc = [
["-c:v", "hevc_qsv"],
["-preset", "veryslow"],
["-profile:v", "main"],
];
export const defaultProfiles: EncodingProfile[] = [
{
id: "static",
name: {
en: "Educational / Static",
fa: "",
},
description: {
en: "Perfect for coding tutorials, screen recordings, or slideshows with minimal movement. Drops the frame rate to 1 FPS to drastically slash file size, keeping audio clear enough to follow along.",
fa: "",
},
tier: 1,
outputType: "video",
builder: ({ inputPath, outputPath }) => [
qsvHwaccel,
["-i", inputPath],
qsvHevc,
["-global_quality:v", "35"],
rateControlOpt,
["-r", "1"],
baseOpus,
["-application", "voip"],
["-b:a", "32k"],
["-f", "mp4"],
outputPath,
],
},
{
id: "extreme",
name: {
en: "Extreme Survival",
fa: "",
},
description: {
en: "Maximum compression for critical network conditions. Drops video and audio quality to the absolute bare minimum functional level. Use only when the internet is heavily restricted and nothing else loads.",
fa: "",
},
tier: 1,
outputType: "video",
builder: ({ inputPath, outputPath }) => [
qsvHwaccel,
["-i", inputPath],
qsvHevc,
["-global_quality:v", "48"],
rateControlOpt,
["-r", "1"],
baseOpus,
["-application", "voip"],
["-b:a", "12k"],
["-f", "mp4"],
outputPath,
],
},
];
export function isDefaultProfile(profileId: string): boolean {
return defaultProfiles.some((p) => p.id === profileId);
}