Add GPU selector for nvenc encoders

This commit is contained in:
Ingo Oppermann 2024-11-26 12:28:45 +01:00
parent c9d1c206c5
commit 75633bf964
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
5 changed files with 47 additions and 1 deletions

View File

@ -18,6 +18,8 @@ export default function Component({
rows = 1,
env = false,
type = 'text',
min = null,
max = null,
helperText = null,
onChange = function (value) {},
}) {
@ -32,10 +34,30 @@ export default function Component({
);
}
let inputProps = {};
if (min !== null) {
inputProps.min = min;
}
if (max !== null) {
inputProps.max = max;
}
return (
<FormControl variant="outlined" disabled={disabled} fullWidth>
<InputLabel htmlFor={id}>{label}</InputLabel>
<OutlinedInput id={id} value={value} onChange={onChange} endAdornment={adornment} label={label} multiline={multiline} rows={rows} type={type} />
<OutlinedInput
id={id}
value={value}
onChange={onChange}
endAdornment={adornment}
label={label}
multiline={multiline}
rows={rows}
type={type}
inputProps={inputProps}
/>
{helperText && <FormHelperText>{helperText}</FormHelperText>}
</FormControl>
);

View File

@ -11,6 +11,7 @@ import Helper from '../../helper';
function init(initialState) {
const state = {
gpu: '0',
bitrate: '4096',
fps: '25',
gop: '2',
@ -31,6 +32,8 @@ function createMapping(settings, stream, skills) {
const local = [
'-codec:v',
'av1_nvenc',
'-gpu',
`${settings.gpu}`,
'-preset:v',
`${settings.preset}`,
'-tune:v',
@ -196,6 +199,9 @@ function Coder({ stream = {}, settings = {}, skills = {}, onChange = function (s
<Grid item xs={6}>
<RateControl value={settings.rc} onChange={update('rc')} />
</Grid>
<Grid item xs={6}>
<Video.GPU value={settings.gpu} onChange={update('gpu')} />
</Grid>
</Grid>
);
}

View File

@ -11,6 +11,7 @@ import Helper from '../../helper';
function init(initialState) {
const state = {
gpu: '0',
bitrate: '4096',
fps: '25',
gop: '2',
@ -32,6 +33,8 @@ function createMapping(settings, stream, skills) {
const local = [
'-codec:v',
'h264_nvenc',
'-gpu',
`${settings.gpu}`,
'-preset:v',
`${settings.preset}`,
'-tune:v',
@ -206,6 +209,9 @@ function Coder({ stream = {}, settings = {}, skills = {}, onChange = function (s
<Grid item xs={6}>
<RateControl value={settings.rc} onChange={update('rc')} />
</Grid>
<Grid item xs={6}>
<Video.GPU value={settings.gpu} onChange={update('gpu')} />
</Grid>
</Grid>
);
}

View File

@ -11,6 +11,7 @@ import Helper from '../../helper';
function init(initialState) {
const state = {
gpu: '0',
bitrate: '4096',
fps: '25',
gop: '2',
@ -32,6 +33,8 @@ function createMapping(settings, stream, skills) {
const local = [
'-codec:v',
'hevc_nvenc',
'-gpu',
`${settings.gpu}`,
'-preset:v',
`${settings.preset}`,
'-tune:v',
@ -203,6 +206,9 @@ function Coder({ stream = {}, settings = {}, skills = {}, onChange = function (s
<Grid item xs={6}>
<RateControl value={settings.rc} onChange={update('rc')} />
</Grid>
<Grid item xs={6}>
<Video.GPU value={settings.gpu} onChange={update('gpu')} />
</Grid>
</Grid>
);
}

View File

@ -6,6 +6,7 @@ import MenuItem from '@mui/material/MenuItem';
import Select from '../../../misc/Select';
import SelectCustom from '../../../misc/SelectCustom';
import TextField from '../../../misc/TextField';
function Bitrate({
value = '',
@ -322,6 +323,10 @@ function FpsMode({ value = '', onChange = function (event) {} }) {
);
}
function GPU({ value = '', onChange = function (event) {} }) {
return <TextField label={<Trans>GPU</Trans>} value={value} onChange={onChange} type="number" min={0}></TextField>;
}
export default {
Bitrate,
GOP,
@ -333,4 +338,5 @@ export default {
Format,
PixFormat,
FpsMode,
GPU,
};