Skip to content

Commit

Permalink
Merge pull request #46 from patcarter883/dev
Browse files Browse the repository at this point in the history
Update UI to support AV1 CUDA decoding.
  • Loading branch information
ioppermann authored Mar 27, 2024
2 parents 82796c3 + 3e4662b commit b8c453b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/misc/FilterSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export default function FilterSelect(props) {
}
}

filter.graph = graphs.join(',');

// graphs.push('hwdownload')

filter.graph = `${graphs.join(',')}`;

props.onChange(filter, automatic);
};
Expand Down
2 changes: 2 additions & 0 deletions src/misc/coders/Decoders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as VideoDefault from './video/Default';
import * as VideoToolbox from './video/VideoToolbox';
import * as VP8CUVID from './video/VP8CUVID';
import * as VP9CUVID from './video/VP9CUVID';
import * as AV1NVDEC from './video/AV1NVDEC';

class Registry {
constructor(type) {
Expand Down Expand Up @@ -112,6 +113,7 @@ const videoRegistry = new Registry('video');

videoRegistry.Register(VideoDefault);
videoRegistry.Register(VideoToolbox);
videoRegistry.Register(AV1NVDEC);
videoRegistry.Register(NVDEC);
videoRegistry.Register(H264MMAL);
videoRegistry.Register(H264CUVID);
Expand Down
73 changes: 73 additions & 0 deletions src/misc/coders/Decoders/video/AV1NVDEC.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from 'react';

import Helper from '../../helper';

function init(initialState) {
const state = {
...initialState,
};

return state;
}

function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);

const mapping = {
global: [],
local: ['-hwaccel', 'cuda', '-c:v', 'av1_cuvid'],
// local: ['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda', '-c:v', 'av1_cuvid'],
};

return mapping;
}

function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);

const handleChange = (newSettings) => {
let automatic = false;
if (!newSettings) {
newSettings = settings;
automatic = true;
}

props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};

React.useEffect(() => {
handleChange(null);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return null;
}

Coder.defaultProps = {
stream: {},
settings: {},
skills: {},
onChange: function (settings, mapping) {},
};

// -hwaccel nvdec

const coder = 'av1';
const name = 'AV1 NVDEC (CUDA)';
const codecs = ['av1'];
const type = 'video';
const hwaccel = true;

function defaults(stream, skills) {
const settings = init({});

return {
settings: settings,
mapping: createMapping(settings, stream, skills),
};
}

export { coder, name, codecs, type, hwaccel, defaults, Coder as component };
1 change: 1 addition & 0 deletions src/misc/filters/video/Scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function createGraph(settings) {
} else if (settings.mode === 'width') {
mapping.push(`scale=${settings.width}:-1`);
} else if (settings.mode === 'fix') {
// mapping.push(`scale_cuda=${settings.fix.split('x').join(':')}:format=yuv420p`);
mapping.push(`scale=${settings.fix}`);
}

Expand Down
1 change: 1 addition & 0 deletions src/views/Publication/Services/Youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const requires = {
codecs: {
audio: ['aac', 'mp3'],
video: ['h264'],
// video: ['h264', 'h265', 'vp9' , 'av1'],
},
};

Expand Down

0 comments on commit b8c453b

Please sign in to comment.