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

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

Open
dtinth opened this issue Mar 22, 2021 · 0 comments
Open

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

dtinth opened this issue Mar 22, 2021 · 0 comments

Comments

@dtinth
Copy link

dtinth commented Mar 22, 2021

.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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant