Skip to main content

@remotion/webcodecs

从 v4.0.229 起可用

🌐 available from v4.0.229

此软件包提供在浏览器中转换视频的 API。它利用 @remotion/media-parser 来解析视频和音频数据,然后使用 WebCodecs API 编码视频。

🌐 This package provides APIs for converting videos in the browser.
It leverages @remotion/media-parser to parse the video and audio data, and then uses the WebCodecs API to encode the video.

你可以用这个包做什么?

🌐 What can you do with this package?

在实现了 WebCodecs 的浏览器中,你可以使用此软件包来:

🌐 In browsers that implement WebCodecs, you can use this package to:

它快吗?

🌐 Is it fast?

与利用 WebAssembly 的解决方案不同,WebCodecs 可以完全访问 GPU 加速。你可以期待比在线转换器或基于 WebAssembly 的处理速度快得多的处理速度。

🌐 Unlike solutions which leverage WebAssembly, WebCodecs have full access to GPU acceleration.
You can expect vastly faster processing than with online converters or WebAssembly-based processing.

在这里查看 比较

🌐 See a comparison here.

💼 许可证免责声明

🌐 💼 License Disclaimer

This package is licensed under the Remotion License.
We consider a team of 4 or more people a "company".

For "companies": A Remotion Company license needs to be obtained to use this package.
In a future version of @remotion/webcodecs, this package will also require the purchase of a newly created "WebCodecs Conversion Seat". Get in touch with us if you are planning to use this package.

For individuals and teams up to 3: You can use this package for free.

This is a short, non-binding explanation of our license. See the License itself for more details.

🚧 不稳定的 API 警告

🌐 🚧 Unstable API Warning

This package is experimental.
We might change the API at any time, until we remove this notice.

安装

🌐 Installation

npx remotion add @remotion/webcodecs

指南

🌐 Guide

应用接口

🌐 APIs

以下 API 可用:

🌐 The following APIs are available:

convertMedia()
Converts a video using WebCodecs and Media Parser
getAvailableContainers()
Get a list of containers @remotion/webcodecs supports.
webcodecsController()
Pause, resume and abort the conversion.
canReencodeVideoTrack()
Determine if a video track can be re-encoded
canReencodeAudioTrack()
Determine if a audio track can be re-encoded
canCopyVideoTrack()
Determine if a video track can be copied without re-encoding
canCopyAudioTrack()
Determine if a audio track can be copied without re-encoding
getDefaultAudioCodec()
Gets the default audio codec for a container if no other audio codec is specified.
getDefaultVideoCodec()
Gets the default video codec for a container if no other audio codec is specified.
defaultOnAudioTrackHandler()
The default track transformation function for audio tracks.
defaultOnVideoTrackHandler()
The default track transformation function for video tracks.
getAvailableAudioCodecs()
Get the audio codecs that can fit in a container.
getAvailableVideoCodecs()
Get the video codecs that can fit in a container.
convertAudioData()
Change the format or sample rate of an AudioData object.
createAudioDecoder()
Create an AudioDecoder object.
createVideoDecoder()
Create a VideoDecoder object.
extractFrames()
Extract frames from a video at specific timestamps.
getPartialAudioData()
Extract audio data from a specific time window of a media file.
rotateAndResizeVideoFrame()
Rotate and resize a video frame.
webFsWriter
Writer that saves to browser file system using File System Access API.
bufferWriter
Writer that saves to an in-memory resizable ArrayBuffer.