bufferWriter
💼 重要许可免责声明
This package is licensed under the Remotion License.
We consider a team of 4 or more people a "company".
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
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.
warning
不稳定的 API:写入器接口是实验性的。API 将来可能会发生变化。
@remotion/webcodecs 的一个写入器,写入到可调整大小的内存 ArrayBuffer。
🌐 A writer for @remotion/webcodecs that writes to an in-memory resizable ArrayBuffer.
可用于convertMedia()将转换后的输出写入内存作为缓冲区。
🌐 Can be used for convertMedia() to write the converted output to memory as a buffer.
示例
🌐 Example
Using bufferWriterimport {convertMedia } from '@remotion/webcodecs'; import {bufferWriter } from '@remotion/webcodecs/buffer'; constresult = awaitconvertMedia ({src : 'https://remotion.media/BigBuckBunny.mp4',container : 'webm',writer :bufferWriter , }); constblob = awaitresult .save ();
内存限制
🌐 Memory limitations
bufferWriter 使用一个可调整大小的 ArrayBuffer,最大尺寸为 2GB。如果你的输出文件超过此限制,转换将失败。
🌐 The bufferWriter uses a resizable ArrayBuffer with a maximum size of 2GB. If your output file would exceed this limit, the conversion will fail.
Error handling for large filesimport {convertMedia } from '@remotion/webcodecs'; import {bufferWriter } from '@remotion/webcodecs/buffer'; try { constresult = awaitconvertMedia ({src : 'very-large-video.mp4',container : 'webm',writer :bufferWriter , }); } catch (error ) { if ((error asError ).message .includes ('Could not create buffer writer')) { // Handle case where ArrayBuffer cannot be resized furtherconsole .log ('File too large for buffer writer, consider using webFsWriter'); } }
另请参阅
🌐 See also
- 此函数的源代码
webFsWriter- 替代文件系统写入器convertMedia()