Fix bug checking streams

This commit is contained in:
HaveAGitGat 2023-08-31 05:30:27 +01:00
parent 4b9bfa38d2
commit 50a795dc97
4 changed files with 44 additions and 24 deletions

View file

@ -36,11 +36,15 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
let is10Bit = false;
for (let i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) {
const stream = args.variables.ffmpegCommand.streams[i];
if (stream.codec_type === 'video' && stream.bits_per_raw_sample === 10) {
is10Bit = true;
if (Array.isArray(args?.inputFileObj?.ffProbeData?.streams)) {
for (let i = 0; i < args.inputFileObj.ffProbeData.streams.length; i += 1) {
const stream = args.inputFileObj.ffProbeData.streams[i];
if (stream.codec_type === 'video' && stream.bits_per_raw_sample === 10) {
is10Bit = true;
}
}
} else {
throw new Error('File has not stream data');
}
return {

View file

@ -36,16 +36,20 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
let isHdr = false;
for (let i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) {
const stream = args.variables.ffmpegCommand.streams[i];
if (
stream.codec_type === 'video'
&& stream.transfer_characteristics === 'smpte2084'
&& stream.color_primaries === 'bt2020'
&& stream.color_range === 'tv'
) {
isHdr = true;
if (Array.isArray(args?.inputFileObj?.ffProbeData?.streams)) {
for (let i = 0; i < args.inputFileObj.ffProbeData.streams.length; i += 1) {
const stream = args.inputFileObj.ffProbeData.streams[i];
if (
stream.codec_type === 'video'
&& stream.transfer_characteristics === 'smpte2084'
&& stream.color_primaries === 'bt2020'
&& stream.color_range === 'tv'
) {
isHdr = true;
}
}
} else {
throw new Error('File has not stream data');
}
return {