添加了NEON编码器选项,并为不同编码器设置了适当的FFmpeg选项,以优化编码质量和性能。
This commit is contained in:
@@ -94,7 +94,7 @@ const broadcastWs = (key, payload) => {
|
||||
const createFfmpegOptions = (encoderName) => {
|
||||
const options = ['-preset fast'];
|
||||
if (encoderName === 'libx264' || encoderName === 'libx265') {
|
||||
options.push('-crf', '23');
|
||||
options.push('-crf', '23', '-threads', '0');
|
||||
} else if (/_nvenc$/.test(encoderName)) {
|
||||
options.push('-rc:v', 'vbr_hq', '-cq', '19');
|
||||
} else if (/_qsv$/.test(encoderName)) {
|
||||
@@ -252,9 +252,10 @@ app.post('/api/transcode', async (req, res) => {
|
||||
}
|
||||
|
||||
const safeCodec = codec === 'h265' ? 'h265' : 'h264';
|
||||
const safeEncoder = ['nvidia', 'intel', 'vaapi'].includes(encoder) ? encoder : 'software';
|
||||
const safeEncoder = ['nvidia', 'intel', 'vaapi', 'neon'].includes(encoder) ? encoder : 'software';
|
||||
const codecMap = {
|
||||
software: { h264: 'libx264', h265: 'libx265' },
|
||||
neon: { h264: 'libx264', h265: 'libx265' },
|
||||
nvidia: { h264: 'h264_nvenc', h265: 'hevc_nvenc' },
|
||||
intel: { h264: 'h264_qsv', h265: 'hevc_qsv' },
|
||||
vaapi: { h264: 'h264_vaapi', h265: 'hevc_vaapi' }
|
||||
|
||||
Reference in New Issue
Block a user