Skip to main content

Pexels 视频的超时

在包含来自 Pexels 的视频时,尤其是在 Remotion Lambda 上渲染时,你可能会遇到以下错误:

🌐 When including videos from Pexels, especially when rendering on Remotion Lambda, you may encounter the following error:

A delayRender() 'Loading <Html5Video> duration with src="https://videos.pexels.com/video-files/5182920/5182920-hd_720_1280_25fps.mp4"' was called but not cleared after 28000ms.

or

A delayRender() "Loading <Img> with src=http://localhost:3000/proxy?src=https://videos.pexels.com/video-files/5182920/5182920-hd_720_1280_25fps.mp4" was called but not cleared after 28000ms. See https://remotion.dev/docs/timeout for help

问题

🌐 Problem

当视频被频繁请求时,Pexels 会限制(人为降低网络速度)视频。
由于生成的众多 Lambda 函数每个都会加载视频,这会导致在很短的时间内产生大量请求。

🌐 Pexels throttles (artificially slows down network speed) videos when they are requested often.
Since each of the many Lambda functions spawned loads the video, it leads to a lot of requests in a short amount of time.

这些超时不是 Remotion 方面的问题。

🌐 These timeouts are not a problem from Remotion's side.

解决方案

🌐 Solution

不要使用像 Pexels 这样的服务的直接链接,而是将视频下载并重新托管在你自己的服务器上,或者在 S3 存储桶中托管。

🌐 Instead of using direct links from services like Pexels, download and re-host the videos on your own servers, or in a S3 bucket.