Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
397 stars 76 forks source link

Using streamDemuxer for rawvideo streams #28

Closed alexandrucancescu closed 4 years ago

alexandrucancescu commented 4 years ago

I am trying to pipe a rawvideo stream that I get from avfoundation screencapture into a streamDemuxer:

const demuxerStream=beamcoder.demuxerStream({highwaterMark:65536});

rawVideoStream.pipe(demuxerStream);

let demuxer=await demuxerStream.demuxer({
     iformat:beamcoder.demuxers()["rawvideo"]
});

And i get this error:

[IMGUTILS @ 0x70000864f968] Picture size 0x0 is invalid
(node:3083) UnhandledPromiseRejectionWarning: Error: In file ../src/demux.cc on line 76, found error: Problem opening input format: Invalid argument
(node:3083) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3083) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is my ffprobe result from running ffprobe -f avfoundation -i "1:":

Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2560x1600, 1000k tbr, 1000k tbn, 1000k tbc

This is the rawvideo stream that I am piping to the demuxer

What other options should I pass to the .demuxer() function? Also, how can I calculate what highwaterMark to use for my specific stream

alexandrucancescu commented 4 years ago

Fixed it. Changed to:

let demuxer=await demuxerStream.demuxer({
    iformat:beamcoder.demuxers()["rawvideo"],
    options:{
        video_size: '2560x1600',
        pixel_format: 'uyvy422'
    }
});