Dynamic video duration with nextJS and lambda #992
-
Hi! I'm using remotion in a nextJS application with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @Wtiben! Sorry for the slow response, I admit it slipped through the cracks! The answer is that yes, there is a performance penalty since this code is executed in every chunk. Usually it is bearable but if the render needs to be highly optimized, you need to determine the duration of the video by other means. I usually recommend to use the FFMPEG library to do so using This can then be passed into the Remotion render using input props https://www.remotion.dev/docs/parametrized-rendering#input-props to avoid having to fetch the asset in every chunk. |
Beta Was this translation helpful? Give feedback.
Hi @Wtiben! Sorry for the slow response, I admit it slipped through the cracks!
The answer is that yes, there is a performance penalty since this code is executed in every chunk. Usually it is bearable but if the render needs to be highly optimized, you need to determine the duration of the video by other means. I usually recommend to use the FFMPEG library to do so using
ffmpeg -i [video-file]
.This can then be passed into the Remotion render using input props https://www.remotion.dev/docs/parametrized-rendering#input-props to avoid having to fetch the asset in every chunk.