pankod/canvas2video

dynamically change canvas size for render?

munge opened this issue ยท 3 comments

munge commented

when trying to pass width and height dynamically, says rendering stops in runtime with conversion failed status:
'error Error: ffmpeg exited with code 1: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!'

here is my code:
.....
const VideoEncoder = async (res, canvasJSON, cWidth, cHeight) => {

try {
    const stream = await renderer({
        silent: false,
        width: cWidth,
        height: cHeight,
        fps: 30,
        makeScene: (fabric, canvas, anim, compose) => {

......

when width and height is number, not variable works fine

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.72. Please mark this comment with ๐Ÿ‘ or ๐Ÿ‘Ž to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I tried to reproduce your issue but I couldn't. Can you please check your code to make sure width and height variables are non-zero numbers? If so, please provide a code or a repository with minimal reproduction.

munge commented

as i understand canvas2video renders canvas size next proportion sizes 1:1, 4:3, 16:9 and etc...