提取帧的慢方法
warning
从 v4.0 起,这个警告不再出现,视频帧提取应该始终很快。本文档中的信息仅适用于旧版本的 Remotion,并为仍在使用这些版本的人保留。
使用 <OffthreadVideo> 组件时,可能会出现以下警告信息:
🌐 When using the <OffthreadVideo> component, the following warning message may appear:
Using a slow method to extract the frame at 1000ms of [video].虽然它本身不是错误,但它警告渲染必须执行一个昂贵的操作才能渲染视频,其中必须读取整个视频以提取其中的单个帧。该警告目前出现在两种情况下:
🌐 While it is not an error itself, it warns that the render must do an expensive operation in order to render the video, in which the whole video must be read in order to extract a single frame in it. This warning currently appears in two occasions:
- 如果 MP4 容器中的 H.264 视频的时间戳损坏,以至于无法准确定位到 Remotion 想要提取的帧。
- 建议:先使用 FFMPEG 重新编码视频可能会更快以修复跳转问题:
npx remotion ffmpeg -i inputvideo.mp4 outputvideo.mp4
- 建议:先使用 FFMPEG 重新编码视频可能会更快以修复跳转问题:
- 如果这是一个放在 WebM 容器中的 VP8 视频,并且选定的图片格式是 PNG,我们无法使用 FFMPEG 精确提取帧,只能采用较慢的方法。
- 建议:更推荐使用 VP9 编解码器,或者将图片格式改为 JPEG(但这样会失去透明度)
检查视频是否存在此问题
🌐 Checking whether a video has this issue
你可以使用 getCanExtractFramesFast()
🌐 You can use the getCanExtractFramesFast()
另请参阅
🌐 See also