This commit is contained in:
sansen
2026-07-29 10:46:19 +08:00
parent 2c4dd55f11
commit 83f5bb8b30
14 changed files with 593 additions and 167 deletions
+35 -24
View File
@@ -28,35 +28,16 @@
<div class="field">
<label class="field-label">硬件加速</label>
<select v-model="hwAccel">
<option value="">CPU 软件编码</option>
<option value="cuda">NVIDIA CUDA</option>
<option value="d3d11va">Direct3D 11 (DXVA)</option>
<option value="dxva2">DirectX VA2</option>
<option value="qsv">Intel Quick Sync</option>
<option v-for="o in hwAccelOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
</select>
</div>
<div class="field">
<label class="field-label">视频编码器</label>
<select v-model="encodeSettings.videoCodec">
<optgroup label="软件编码">
<option value="libx264">H.264 / AVC (libx264)</option>
<option value="libx265">H.265 / HEVC (libx265)</option>
<option value="libsvtav1">AV1 (libsvtav1)</option>
</optgroup>
<optgroup label="NVIDIA NVENC">
<option value="h264_nvenc">H.264 NVENC</option>
<option value="hevc_nvenc">HEVC NVENC</option>
<option value="av1_nvenc">AV1 NVENC</option>
</optgroup>
<optgroup label="Intel QSV">
<option value="h264_qsv">H.264 QSV</option>
<option value="hevc_qsv">HEVC QSV</option>
<option value="av1_qsv">AV1 QSV</option>
</optgroup>
<optgroup label="AMD AMF">
<option value="h264_amf">H.264 AMF</option>
<option value="hevc_amf">HEVC AMF</option>
<option value="av1_amf">AV1 AMF</option>
<optgroup v-for="grp in hwEncoders" :key="grp.label" :label="grp.label">
<option v-for="o in grp.options" :key="o.value" :value="o.value" :disabled="!o.avail">
{{ o.label }}{{ o.avail ? '' : ' (不可用)' }}
</option>
</optgroup>
</select>
</div>
@@ -182,8 +163,38 @@ import { ref, computed } from 'vue'
import { api } from '../api/wails'
import type { MediaInfo, StreamInfo, EncodeSettings } from '../types'
const props = defineProps<{ gpuInfo: any[] }>()
const emit = defineEmits<{ taskAdded: [] }>()
// Filtered dropdown options based on detected hardware
const hwEncoders = computed(() => {
const result: { label: string; options: { value: string; label: string; avail: boolean }[] }[] = []
for (const g of props.gpuInfo || []) {
if (!g.encoders?.length) continue
result.push({
label: g.vendor === 'cpu' ? '软件编码' : g.name,
options: g.encoders.map((e: any) => ({ value: e.name, label: e.label, avail: e.available }))
})
}
return result
})
const hwAccelOptions = computed(() => {
const opts: { value: string; label: string }[] = [{ value: '', label: 'CPU 软件编码' }]
for (const g of props.gpuInfo || []) {
if (g.vendor === 'cpu' || !g.encoders?.some((e: any) => e.available)) continue
switch (g.vendor) {
case 'nvidia': opts.push({ value: 'cuda', label: g.name + ' (CUDA)' }); break
case 'intel': opts.push({ value: 'qsv', label: g.name + ' (QSV)' }); break
case 'amd': opts.push({ value: 'd3d11va', label: g.name + ' (DXVA)' }); break
}
}
if (opts.length === 1) {
opts.push({ value: 'd3d11va', label: 'Direct3D 11 (DXVA)' }, { value: 'dxva2', label: 'DirectX VA2' })
}
return opts
})
const inputFile = ref('')
const outputFile = ref('')
const mediaInfo = ref<MediaInfo | null>(null)