playwright-video icon indicating copy to clipboard operation
playwright-video copied to clipboard

Pass ffmpeg’s stdout and stderr to ffmpegerror event

Open dtinth opened this issue 3 years ago • 0 comments

https://github.com/qawolf/playwright-video/blob/58037692bfbd30c9e1a1a2b011488e1149400499/src/VideoWriter.ts#L48-L61

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.

dtinth avatar Mar 22 '21 09:03 dtinth