SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
335 stars 105 forks source link

ffmpeg - no output file #33

Closed akhfaern closed 1 year ago

akhfaern commented 2 years ago

I've tried to run ffmpeg example but getting this error.

node:events:368 throw er; // Unhandled 'error' event ^

Error: write EOF at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16) Emitted 'error' event on Socket instance at: at Socket.onerror (node:internal/streams/readable:773:14) at Socket.emit (node:events:390:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -4095, code: 'EOF', syscall: 'write' }

SamuelScheit commented 2 years ago

Do you have ffmpeg installed globally?

akhfaern commented 2 years ago

yeah it was but i think t got messed up after uninstall and reinstall it just worked but although it didnt give an error, it didnt create an output file either. am i missing something?

SamuelScheit commented 2 years ago

Are you sure it didn't create one? from what directory are you executing the program?

akhfaern commented 2 years ago

here is the console output D:\nodejs\puppeteer-stream-test>node ffmpeg.js recording

[main 2022-01-27T18:59:18.760Z] update#setState idle [main 2022-01-27T18:59:18.979Z] ExtensionHostStarterWorker created [main 2022-01-27T18:59:20.322Z] Starting extension host with pid 2680 (fork() took 40 ms). finished [main 2022-01-27T18:59:48.776Z] update#setState checking for updates [main 2022-01-27T18:59:48.841Z] update#setState idle

D:\nodejs\puppeteer-stream-test>node --version v16.13.2

Jackgreiner91 commented 2 years ago

I'm seeing the same issue

codeAshu commented 2 years ago

Use this to end the stream instaead of stream.destroy

await stream.unpipe(ffmpeg);
ffmpeg.kill();

I also removed

ffmpeg.stderr.on("data", (chunk) => {
        console.log(chunk.toString());
    });
SamuelScheit commented 2 years ago

@codeAshu great, I'll update the example script 👍