Closed WingDust closed 1 year ago
Video support is fairly new (albeit quite stable since libav.js is just a wrapper around ffmpeg), so I don't have much in the way of examples and demonstration. I'll make a note to get some useful examples in.
tests/test-transcode-video-simple.js does video transcoding, but if you examine the frames
object (on line 85), it's raw video data, so the steps used in test-transcode-video-simple.js can be used as a jumping-off point for what you need. The format of the frame data isn't as simple as one big Uint8Array, because of how ffmpeg buffers lines, and because the format is usually not RGB; the format is detailed in the type specification in libav.types.in.d.ts.
As an aside, I should hope there's a better alternative to libav.js for Node? A direct interface to a natively-compiled ffmpeg will be vastly more performant than a version of ffmpeg compiled to WebAssembly.
Leaving this issue open as a note to self to make a more cohesive example of video decoding.
demo/demo.html is the requested cohesive example of video decoding. It is not in Node, because as stated, this shouldn't be used from Node, but it's complete.
Can you show a example with libav.js read a frame from a video in node? I wish origin frame data turn Uint8Array type in javascript.