fix: отключать av1 при отсутствии hw и отражать в выводе

This commit is contained in:
2026-01-20 01:31:47 +03:00
parent 7ed159ccb0
commit b852171e69
3 changed files with 64 additions and 50 deletions

View File

@@ -152,6 +152,7 @@ console.log('🔍 Checking system...\n');
const hasFFmpeg = await checkFFmpeg();
const hasMP4Box = await checkMP4Box();
const hwEncoders = await detectHardwareEncoders();
const hasAv1Hardware = hwEncoders.some(item => item.av1Encoder);
const accelPriority: Record<string, number> = {
nvenc: 100,
@@ -188,12 +189,15 @@ if (!hasMP4Box) {
}
// Validate codec selection
const hasAv1Hardware = hwEncoders.some(item => item.av1Encoder);
if ((codecType === 'av1' || codecType === 'dual') && !hasAv1Hardware) {
console.error(`⚠️ Warning: AV1 encoding requested but no hardware AV1 encoder found.`);
console.error(` CPU-based AV1 encoding (libsvtav1) will be VERY slow.`);
console.error(` Consider using --codec h264 for faster encoding.\n`);
if (codecType === 'av1') {
console.error(`⚠️ Warning: AV1 encoding requested but no hardware AV1 encoder found.`);
console.error(` CPU-based AV1 encoding (libsvtav1) will be VERY slow.`);
console.error(` Consider using --codec h264 for faster encoding.\n`);
} else if (codecType === 'dual') {
console.warn(`⚠️ AV1 hardware encoder not detected. Using H.264 only (disable AV1).`);
codecType = 'h264';
}
}
// Validate HLS requires H.264
@@ -262,11 +266,13 @@ const manifestDesc =
const thumbnailsPlanned = true;
const posterPlanned = posterTimecode || '00:00:00';
const codecDisplay = codecType === 'dual' ? 'dual (AV1 + H.264)' : codecType;
const codecNote = codecType === 'h264' && accelRest && accelRest.length >= 0 && !hasAv1Hardware ? ' (AV1 disabled: no HW)' : '';
console.log('\n📦 Parameters:');
console.log(` Input: ${input}`);
console.log(` Output: ${outputDir}`);
console.log(` Codec: ${codecType}${codecType === 'dual' ? ' (AV1 + H.264)' : ''}`);
console.log(` Codec: ${codecDisplay}${codecNote}`);
console.log(` Profiles: ${displayProfiles.join(', ')}`);
console.log(` Manifests: ${manifestDesc}`);
console.log(` Poster: ${posterPlanned} (will be generated)`);