snapshot: use internal prebuffer converter rather than media manager

This commit is contained in:
Koushik Dutta
2023-12-13 09:07:02 -08:00
parent 3f1b45c435
commit 469f693d58
6 changed files with 11 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
{
"scrypted.debugHost": "koushik-windows",
"scrypted.debugHost": "127.0.0.1",
}

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.14",
"version": "0.2.15",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/snapshot",
"version": "0.2.14",
"version": "0.2.15",
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",
"@types/node": "^18.16.18",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.14",
"version": "0.2.15",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",

View File

@@ -1,12 +1,11 @@
import fs from 'fs';
import { addVideoFilterArguments } from '@scrypted/common/src/ffmpeg-helpers';
import { ffmpegLogInitialOutput, safeKillFFmpeg, safePrintFFmpegArguments } from '@scrypted/common/src/media-helpers';
import { timeoutFunction } from '@scrypted/common/src/promise-utils';
import { sleep } from '@scrypted/common/src/sleep';
import child_process, { ChildProcess } from 'child_process';
import { once } from 'events';
import { Writable } from 'stream';
import { Pipe2Jpeg } from './pipe2jpeg';
import { timeoutFunction } from '@scrypted/common/src/promise-utils';
export interface FFmpegImageFilterOptions {
console?: Console,

View File

@@ -176,7 +176,12 @@ class SnapshotMixin extends SettingsMixinDeviceBase<Camera> implements Camera {
request.refresh = false;
takePrebufferPicture = async () => {
// this.console.log('snapshotting active prebuffer');
return mediaManager.convertMediaObjectToBuffer(await realDevice.getVideoStream(request), 'image/jpeg');
const ffmpegInput = await sdk.mediaManager.convertMediaObjectToJSON<FFmpegInput>(await realDevice.getVideoStream(request), ScryptedMimeTypes.FFmpegInput);
return ffmpegFilterImage(ffmpegInput.inputArguments, {
console: this.debugConsole,
ffmpegPath: await mediaManager.getFFmpegPath(),
timeout: 10000,
});
};
return takePrebufferPicture;
}