Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Pass ffmpeg’s stdout and stderr to ffmpegerror event #141

@dtinth

Description

@dtinth

.on('error', (e) => {
this.emit('ffmpegerror', e.message);
// do not reject as a result of not having frames
if (
!this._receivedFrame &&
e.message.includes('pipe:0: End of file')
) {
resolve();
return;
}
reject(`pw-video: error capturing video: ${e.message}`);
})

fluent-ffmpeg sends the stdout and stderr, so our error handler can accept this:

-        .on('error', (e) => {
+        .on('error', (e, stdout, stderr) => {

This helps with some obscure edge cases like this:

[libx264 @ 0x648b540] width not divisible by 2 (1045x730)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

The first line which shows the culprit isn’t present in any output generated by playwright-video and DEBUG='pw-video:*'. I had to dig in and make it print the stderr so I can see the real reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions