Skip to main content

支持的媒体

来自 @remotion/media 的新 <Audio><Video> 标签基于 Mediabunny 和 WebCodecs。

🌐 The new <Audio> and <Video> tags from @remotion/media are based on Mediabunny and WebCodecs.

跨域资源共享

🌐 CORS

任何资源必须要么启用 CORS,要么使用 staticFile() 从打包包提供。

🌐 Any assets must be either CORS-enabled or served from the bundle using staticFile().

支持的格式和编解码器

🌐 Supported formats and codecs

支持的格式和编解码器定义在这里:Mediabunny - 支持的格式和编解码器

🌐 The supported formats and codecs are defined here: Mediabunny - Supported formats and codecs.

Matroska 限制

🌐 Matroska limitation

支持基于 Matroska 的文件(.mkv.webm),但要提取音频,必须提取到提取点为止的整个音频,因为 Matroska 容器只在容器中存储毫秒级精确时间戳,但正确拼接音频片段需要更高的精度。

🌐 Matroska-based files (.mkv, .webm) are supported, but for the audio to be extracted, the entire audio up to the point of extraction must be extracted as well because Matroska containers only store millisecond-precise timestamps in the container, but more precision is needed correctly concatenate audio parts.

例如:如果你想渲染一段10分钟音频的第三分钟,那么前2分钟的音频也必须被解码,因为只有这样音频的精确时间戳才会显示出来。

🌐 For example: If you want to render the third minute of a 10 minute audio, the first 2 minutes of the audio must be decoded as well because only then the precise timestamps of the audio will be unveiled.

如果可能,在进行分布式渲染(例如在 Lambda 上)时,优先使用非 Matroska 格式的文件(.mp4.mov.m4a)。

🌐 Prefer non-Matroska-based files (.mp4, .mov, .m4a) when you are doing distributed rendering (e.g. on Lambda) if possible.

回退到 <OffthreadVideo>

🌐 Fallback to <OffthreadVideo>

如果媒体文件无法解码,无论是因为不支持的编解码器,还是因为它不支持 CORS,或者它具有 alpha 通道而浏览器不支持解码 alpha 通道所需的 WebGL,那么 @remotion/media 会自动回退到 <OffthreadVideo><Html5Audio>,来自 remotion 包。

🌐 If a media file cannot be decoded, be it because of an unsupported codec or because it does not support CORS, or it has an alpha channel and the browser does not support WebGL which is required to decode the alpha channel, then @remotion/media automatically falls back to <OffthreadVideo> or <Html5Audio> from the remotion package.

参见:@remotion/media 回退到 <OffthreadVideo><Html5Audio>

🌐 See: Fallback from @remotion/media to <OffthreadVideo> or <Html5Audio>