Remove resample filter from audio decoders, add filters to summary

This commit is contained in:
Ingo Oppermann 2022-07-14 19:04:03 +02:00
parent 85f6d36f0a
commit f422b0b45e
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
16 changed files with 89 additions and 282 deletions

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,18 +14,7 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
const local = ['-codec:a', 'aac', '-b:a', `${settings.bitrate}k`, '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'aac', '-b:a', `${settings.bitrate}k`, '-shortest'];
if (stream.codec === 'aac') {
local.push('-bsf:a', 'aac_adtstoasc');
@ -64,23 +50,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -94,12 +63,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -117,7 +80,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,18 +14,7 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
const local = ['-codec:a', 'aac_at', '-b:a', `${settings.bitrate}k`, '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'aac_at', '-b:a', `${settings.bitrate}k`, '-shortest'];
if (stream.codec === 'aac') {
local.push('-bsf:a', 'aac_adtstoasc');
@ -64,23 +50,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -94,12 +63,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowCustom allowInherit />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -117,7 +80,7 @@ const type = 'audio';
const hwaccel = true;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,18 +14,7 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
const local = ['-codec:a', 'libopus', '-b:a', `${settings.bitrate}k`, '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'libopus', '-b:a', `${settings.bitrate}k`, '-shortest'];
const mapping = {
global: [],
@ -60,23 +46,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -90,12 +59,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -113,7 +76,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,18 +14,7 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
const local = ['-codec:a', 'libvorbis', '-b:a', `${settings.bitrate}k`, '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'libvorbis', '-b:a', `${settings.bitrate}k`, '-shortest'];
const mapping = {
global: [],
@ -60,23 +46,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -90,12 +59,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -113,7 +76,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,19 +14,8 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
// '-qscale:a', '6'
const local = ['-codec:a', 'libmp3lame', '-b:a', `${settings.bitrate}k`, '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'libmp3lame', '-b:a', `${settings.bitrate}k`, '-shortest'];
const mapping = {
global: [],
@ -61,23 +47,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -91,12 +60,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -114,7 +77,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -13,9 +13,6 @@ function init(initialState) {
const state = {
bitrate: '64',
delay: 'auto',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -34,7 +31,7 @@ function createMapping(settings, stream) {
layout = stream.layout;
}
const local = ['-codec:a', 'opus', '-b:a', `${settings.bitrate}k`, '-vbr', 'on', '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'opus', '-b:a', `${settings.bitrate}k`, '-vbr', 'on', '-shortest'];
if (settings.delay !== 'auto') {
local.push('opus_delay', settings.delay);
@ -113,23 +110,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -146,12 +126,6 @@ function Coder(props) {
<Grid item xs={12}>
<Delay value={settings.delay} onChange={update('delay')} allowAuto allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -169,7 +143,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -7,9 +7,6 @@ import Audio from '../../settings/Audio';
function init(initialState) {
const state = {
bitrate: '64',
channels: '2',
layout: 'stereo',
sampling: '44100',
...initialState,
};
@ -17,18 +14,7 @@ function init(initialState) {
}
function createMapping(settings, stream) {
let sampling = settings.sampling;
let layout = settings.layout;
if (sampling === 'inherit') {
sampling = stream.sampling_hz;
}
if (layout === 'inherit') {
layout = stream.layout;
}
const local = ['-codec:a', 'vorbis', '-b:a', `${settings.bitrate}k`, '-qscale:a', '3', '-shortest', '-filter:a', `aresample=osr=${sampling}:ocl=${layout}`];
const local = ['-codec:a', 'vorbis', '-b:a', `${settings.bitrate}k`, '-qscale:a', '3', '-shortest'];
const mapping = {
global: [],
@ -60,23 +46,6 @@ function Coder(props) {
[what]: value,
};
if (what === 'layout') {
let channels = stream.channels;
switch (value) {
case 'mono':
channels = 1;
break;
case 'stereo':
channels = 2;
break;
default:
break;
}
newSettings.channels = channels;
}
handleChange(newSettings);
};
@ -90,12 +59,6 @@ function Coder(props) {
<Grid item xs={12}>
<Audio.Bitrate value={settings.bitrate} onChange={update('bitrate')} allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Sampling value={settings.sampling} onChange={update('sampling')} allowInherit allowCustom />
</Grid>
<Grid item xs={12}>
<Audio.Layout value={settings.layout} onChange={update('layout')} allowInherit />
</Grid>
</Grid>
);
}
@ -113,7 +76,7 @@ const type = 'audio';
const hwaccel = false;
function summarize(settings) {
return `${name}, ${settings.bitrate} kbit/s, ${settings.layout}, ${settings.sampling}Hz`;
return `${name}, ${settings.bitrate} kbit/s`;
}
function defaults(stream) {

View File

@ -69,7 +69,7 @@ function Filter(props) {
Filter.defaultProps = {
settings: {},
onChange: function (settings, mapping) {},
onChange: function (settings, graph, automatic) {},
};
const filter = 'loudnorm';

View File

@ -200,7 +200,7 @@ function Filter(props) {
Filter.defaultProps = {
settings: {},
onChange: function (settings, mapping) {},
onChange: function (settings, graph, automatic) {},
};
const filter = 'aresample';

View File

@ -126,7 +126,7 @@ function Filter(props) {
Filter.defaultProps = {
settings: {},
onChange: function (settings, mapping) {},
onChange: function (settings, graph, automatic) {},
};
const filter = 'volume';

View File

@ -67,7 +67,7 @@ function Filter(props) {
Filter.defaultProps = {
settings: {},
onChange: function (settings, mapping) {},
onChange: function (settings, graph, automatic) {},
};
const filter = 'hflip';

View File

@ -95,7 +95,7 @@ Filter.defaultProps = {
};
const filter = 'transpose';
const name = 'Filter (transpose)';
const name = 'Transpose';
const type = 'video';
const hwaccel = false;

View File

@ -67,7 +67,7 @@ function Filter(props) {
Filter.defaultProps = {
settings: {},
onChange: function (settings, mapping) {},
onChange: function (settings, graph, automatic) {},
};
const filter = 'vflip';

View File

@ -3,7 +3,7 @@
Ingest Metadata Layout:
data = {
version: 1,
version: "1.2.0",
meta: {
name: 'Livestream 1',
description: 'Live from earth. Powered by datarhei/restreamer.',
@ -99,12 +99,24 @@ data = {
'-codec:a', 'aac',
'-b:a', '64k',
'-bsf:a', 'aac_adtstoasc',
'-shortest',
'-af', 'aresample=osr=44100:ocl=2'
'-shortest'
]
}
},
decoder: null,
filter: {
graph: 'aresample=osr=44100:ocl=stereo',
settings: {
aresample: {
graph: 'aresample=osr=44100:ocl=stereo',
settings: {
channels: 2,
layout: 'stereo',
sampling: 44100
}
}
}
},
},
video: {
source: 0,
@ -124,6 +136,7 @@ data = {
}
},
decoder: null,
filter: null,
},
"or": {},
"video": {
@ -210,7 +223,7 @@ data = {
Egress Metadata Layout:
data = {
version: 1,
version: "1.2.0",
name: "foobar",
control: {
process: {
@ -232,14 +245,15 @@ data = {
*/
import * as Coders from '../misc/coders/Encoders';
import * as version from '../version';
const defaultMetadata = {
version: 1,
version: version.Version,
playersite: {},
};
const defaultIngestMetadata = {
version: 1,
version: version.Version,
sources: [],
profiles: [{}],
streams: [],
@ -282,7 +296,7 @@ const defaultIngestMetadata = {
};
const defaultEgressMetadata = {
version: 1,
version: version.Version,
name: '',
control: {
process: {

View File

@ -3,5 +3,6 @@ import { name, version, bundle } from '../package.json';
const Core = '^16.9.0';
const FFmpeg = '^4.1.0 || ^5.0.0';
const UI = bundle ? bundle : name + ' v' + version;
const Version = version;
export { Core, FFmpeg, UI };
export { Core, FFmpeg, UI, Version };

View File

@ -6,6 +6,7 @@ import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
import * as Coders from '../../misc/coders/Encoders';
import * as Filters from '../../misc/filters';
import BoxText from '../../misc/BoxText';
import Sources from './Sources';
@ -28,6 +29,7 @@ export default function Summary(props) {
let name = i18n._(t`No source selected`);
let address = '';
let encodingSummary = i18n._(t`None`);
let filterSummary = [];
let showEncoding = false;
@ -51,6 +53,30 @@ export default function Summary(props) {
if (coder !== null) {
encodingSummary = coder.summarize(profile.encoder.settings);
}
if (profile.filter.graph.length !== 0) {
let filters = null;
if (props.type === 'video') {
filters = Filters.Video;
} else if (props.type === 'audio') {
filters = Filters.Audio;
}
for (let filter of filters.List()) {
const name = filter.filter;
if (!(name in profile.filter.settings)) {
continue;
}
if (profile.filter.settings[name].graph.length === 0) {
continue;
}
filterSummary.push(filter.summarize(profile.filter.settings[name].settings));
}
}
}
return (
@ -61,12 +87,26 @@ export default function Summary(props) {
<Typography variant="body1">{address}</Typography>
</Grid>
{showEncoding === true && (
<Grid item xs={12}>
<Typography variant="subtitle2">
<Trans>Encoding</Trans>
</Typography>
<Typography variant="body1">{encodingSummary}</Typography>
</Grid>
<React.Fragment>
<Grid item xs={12}>
<Typography variant="subtitle2">
<Trans>Encoding</Trans>
</Typography>
<Typography variant="body1">{encodingSummary}</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle2">
<Trans>Filter</Trans>
</Typography>
{filterSummary.length ? (
<Typography variant="body1">{filterSummary.join(', ')}</Typography>
) : (
<Typography variant="body1">
<Trans>None</Trans>
</Typography>
)}
</Grid>
</React.Fragment>
)}
</Grid>
</BoxText>