Skip to content

The swiss army knife of lossless video/audio editing

Increase size of paused canvas image #421

Mikael Finstad333e80d005a7
diff --git a/src/CanvasPlayer.js b/src/CanvasPlayer.js
index 470ba574..24e9aeed 100644
--- a/src/CanvasPlayer.js
+++ b/src/CanvasPlayer.js
@@ -55,7 +55,7 @@ export default ({ path, width: inWidth, height: inHeight, streamIndex }) => {
}
} else {
try {
- const { process: processIn, width, height } = getOneRawFrame({ path, inWidth, inHeight, streamIndex, seekTo: commandedTime });
+ const { process: processIn, width, height } = getOneRawFrame({ path, inWidth, inHeight, streamIndex, seekTo: commandedTime, outSize: 1000 });
process = processIn;
const { stdout: rgbaImage } = await process;
diff --git a/src/ffmpeg.js b/src/ffmpeg.js
index c42c2d0d..11416170 100644
--- a/src/ffmpeg.js
+++ b/src/ffmpeg.js
@@ -901,7 +901,7 @@ export function getStreamFps(stream) {
return undefined;
}
-function createRawFfmpeg({ fps = 25, path, inWidth, inHeight, seekTo, oneFrameOnly, execaOpts, streamIndex }) {
+function createRawFfmpeg({ fps = 25, path, inWidth, inHeight, seekTo, oneFrameOnly, execaOpts, streamIndex, outSize = 320 }) {
// const fps = 25; // TODO
const aspectRatio = inWidth / inHeight;
@@ -909,10 +909,10 @@ function createRawFfmpeg({ fps = 25, path, inWidth, inHeight, seekTo, oneFrameOn
let newWidth;
let newHeight;
if (inWidth > inHeight) {
- newWidth = 320;
+ newWidth = outSize;
newHeight = Math.floor(newWidth / aspectRatio);
} else {
- newHeight = 320;
+ newHeight = outSize;
newWidth = Math.floor(newHeight * aspectRatio);
}
@@ -948,8 +948,8 @@ function createRawFfmpeg({ fps = 25, path, inWidth, inHeight, seekTo, oneFrameOn
};
}
-export function getOneRawFrame({ path, inWidth, inHeight, seekTo, streamIndex }) {
- const { process, width, height, channels } = createRawFfmpeg({ path, inWidth, inHeight, seekTo, streamIndex, oneFrameOnly: true, execaOpts: { encoding: null } });
+export function getOneRawFrame({ path, inWidth, inHeight, seekTo, streamIndex, outSize }) {
+ const { process, width, height, channels } = createRawFfmpeg({ path, inWidth, inHeight, seekTo, streamIndex, oneFrameOnly: true, execaOpts: { encoding: null }, outSize });
return { process, width, height, channels };
}