Add Bob Weaver Deinterlacing Filter (datarhei/restreamer#465)
This commit is contained in:
parent
410a91d3c7
commit
686e386f41
@ -1,8 +1,12 @@
|
||||
# Restreamer-UI
|
||||
|
||||
## v1.5.1 > v1.6.0
|
||||
|
||||
- Add Bob Weaver Deinterlacing Filter ([#465](https://github.com/datarhei/restreamer/issues/465))
|
||||
|
||||
## v1.5.0 > v1.5.1
|
||||
|
||||
- Fix FFmpeg version check for RTSP sources (datarhei/restreamer#455)
|
||||
- Fix FFmpeg version check for RTSP sources ([#455](https://github.com/datarhei/restreamer/issues/455))
|
||||
- Fix requires Core >= v16.11.0 and FFmpeg >= 5.1.0
|
||||
|
||||
## v1.4.0 > v1.5.0
|
||||
|
||||
@ -9,6 +9,7 @@ import * as Scale from './video/Scale';
|
||||
import * as Transpose from './video/Transpose';
|
||||
import * as HFlip from './video/HFlip';
|
||||
import * as VFlip from './video/VFlip';
|
||||
import * as Bwdif from './video/Bwdif';
|
||||
|
||||
// Register filters type: audio/video
|
||||
class Registry {
|
||||
@ -56,6 +57,7 @@ videoRegistry.Register(Scale);
|
||||
videoRegistry.Register(Transpose);
|
||||
videoRegistry.Register(HFlip);
|
||||
videoRegistry.Register(VFlip);
|
||||
videoRegistry.Register(Bwdif);
|
||||
|
||||
// Export registrys for ../SelectFilters.js
|
||||
export { audioRegistry as Audio, videoRegistry as Video };
|
||||
|
||||
172
src/misc/filters/video/Bwdif.js
Normal file
172
src/misc/filters/video/Bwdif.js
Normal file
@ -0,0 +1,172 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Trans } from '@lingui/macro';
|
||||
import Grid from '@mui/material/Grid';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
|
||||
import Checkbox from '../../Checkbox';
|
||||
import Select from '../../Select';
|
||||
|
||||
// Deinterlace the input video ("bwdif" stands for "Bob Weaver Deinterlacing Filter").
|
||||
// http://ffmpeg.org/ffmpeg-all.html#bwdif
|
||||
|
||||
function init(initialState) {
|
||||
const state = {
|
||||
enabled: false,
|
||||
mode: '1',
|
||||
parity: '-1',
|
||||
deint: '0',
|
||||
...initialState,
|
||||
};
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
function createGraph(settings) {
|
||||
settings = init(settings);
|
||||
|
||||
const mapping = [];
|
||||
|
||||
if (settings.enabled) {
|
||||
mapping.push(`bwdif=mode=${settings.mode}:parity=${settings.parity}:deint=${settings.deint}`);
|
||||
}
|
||||
|
||||
return mapping.join(',');
|
||||
}
|
||||
|
||||
function Mode(props) {
|
||||
return (
|
||||
<Select label={<Trans>Deinterlace mode</Trans>} value={props.value} onChange={props.onChange}>
|
||||
<MenuItem value="0">
|
||||
<Trans>Each frames</Trans>
|
||||
</MenuItem>
|
||||
<MenuItem value="1">
|
||||
<Trans>Each field</Trans>
|
||||
</MenuItem>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
|
||||
Mode.defaultProps = {
|
||||
value: '',
|
||||
onChange: function (event) {},
|
||||
};
|
||||
|
||||
function Parity(props) {
|
||||
return (
|
||||
<Select label={<Trans>Deinterlace parity</Trans>} value={props.value} onChange={props.onChange}>
|
||||
<MenuItem value="0">
|
||||
<Trans>Top field</Trans>
|
||||
</MenuItem>
|
||||
<MenuItem value="1">
|
||||
<Trans>Bottom field</Trans>
|
||||
</MenuItem>
|
||||
<MenuItem value="-1">
|
||||
<Trans>Auto</Trans>
|
||||
</MenuItem>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
|
||||
Parity.defaultProps = {
|
||||
value: '',
|
||||
onChange: function (event) {},
|
||||
};
|
||||
|
||||
function Deint(props) {
|
||||
return (
|
||||
<Select label={<Trans>Deinterlace deint</Trans>} value={props.value} onChange={props.onChange}>
|
||||
<MenuItem value="0">
|
||||
<Trans>All frames</Trans>
|
||||
</MenuItem>
|
||||
<MenuItem value="1">
|
||||
<Trans>Marked frames</Trans>
|
||||
</MenuItem>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
|
||||
Deint.defaultProps = {
|
||||
value: '',
|
||||
onChange: function (event) {},
|
||||
};
|
||||
|
||||
function Filter(props) {
|
||||
const settings = init(props.settings);
|
||||
|
||||
const handleChange = (newSettings) => {
|
||||
let automatic = false;
|
||||
if (!newSettings) {
|
||||
newSettings = settings;
|
||||
automatic = true;
|
||||
}
|
||||
|
||||
props.onChange(newSettings, createGraph(newSettings), automatic);
|
||||
};
|
||||
|
||||
const update = (what) => (event) => {
|
||||
const newSettings = {
|
||||
...settings,
|
||||
};
|
||||
if (['enabled'].includes(what)) {
|
||||
newSettings[what] = !settings.enabled;
|
||||
} else {
|
||||
newSettings[what] = event.target.value;
|
||||
}
|
||||
|
||||
handleChange(newSettings);
|
||||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
handleChange(null);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Grid item>
|
||||
<Checkbox label={<Trans>Deinterlace (bwdif)</Trans>} checked={settings.enabled} onChange={update('enabled')} />
|
||||
</Grid>
|
||||
{settings.enabled && (
|
||||
<React.Fragment>
|
||||
<Grid item xs={12}>
|
||||
<Mode label={<Trans>Deinterlace mode</Trans>} value={settings.mode} onChange={update('mode')}></Mode>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Parity label={<Trans>Deinterlace parity</Trans>} value={settings.parity} onChange={update('parity')}></Parity>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Deint label={<Trans>Deinterlace deint</Trans>} value={settings.deint} onChange={update('deint')}></Deint>
|
||||
</Grid>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
Filter.defaultProps = {
|
||||
settings: {},
|
||||
onChange: function (settings, mapping) {},
|
||||
};
|
||||
|
||||
const filter = 'bwdif';
|
||||
const name = 'Deinterlacing Filter';
|
||||
const type = 'video';
|
||||
const hwaccel = false;
|
||||
|
||||
function summarize(settings) {
|
||||
if (settings.mode !== 'none') {
|
||||
return `${name}`;
|
||||
}
|
||||
}
|
||||
|
||||
function defaults() {
|
||||
const settings = init({});
|
||||
|
||||
return {
|
||||
settings: settings,
|
||||
graph: createGraph(settings),
|
||||
};
|
||||
}
|
||||
|
||||
export { name, filter, type, hwaccel, summarize, defaults, createGraph, Filter as component };
|
||||
Loading…
x
Reference in New Issue
Block a user