jean343 / Node-OpenMAX

Node wrapper for the OpenMAX library
https://www.npmjs.com/package/openmax
MIT License
16 stars 5 forks source link

Contributing #7

Closed sledesm closed 6 years ago

sledesm commented 6 years ago

How could I contribute to this project? I have made a simple example which allows to stream the camera frames into pngs very quickly. there are other applications online, but they are either bulky or very slow.

jean343 commented 6 years ago

Thanks so much for the feedback! I always like examples, and I would like to add it. Either make a fork and send me a pull request, or write the code somewhere and I will add it. Did you use the Camera and ImageWriter?

JP

sledesm commented 6 years ago

I used Camera and ImageEncoder. I do not know about ImageWriter.

jean343 commented 6 years ago

I saw your request, getting my PI from my pile and I will try!

sledesm commented 6 years ago

I just added another commit, to solve the problem of the buffer length on the stream. Here is a code snippet from the sample application that I am building

    var ws = require('stream').Writable();
    var recBuffer = null;
    ws._write = function (chunk, enc, next) {
        var nextPart = chunk;
        if (chunk.onBufferDone) {
            if (chunk.usedLength !== undefined && chunk.usedLength < chunk.length) {
                // console.log("Getting buffer to smaller size")
                nextPart = chunk.slice(0, chunk.usedLength);
            }
            if (!recBuffer) {
                recBuffer = nextPart;
            } else {
                recBuffer = concat([recBuffer, nextPart]);
            }
            riseCore.emit("omx-camera-frame", recBuffer);
            recBuffer = null;
            chunk.onBufferDone();
        } else {
            if (recBuffer) {
                recBuffer = Buffer.concat([recBuffer, chunk]);
            } else
                recBuffer = Buffer.from(chunk);
        }
        next();
    };
jean343 commented 6 years ago

I merged it, however it does not work for me, _write isn't called.

sledesm commented 6 years ago

Hi,

I am using the code of npm 1.6.0

I went to the node_modules/openmax/dist/perf, and copied there the CameraEncode.js example and run it there. It works for me. I run it after running CameraPipe

Regards,

Santi.

On Tue, Sep 12, 2017 at 7:14 PM, Jean-Philippe Bergeron < notifications@github.com> wrote:

I merged it, however it does not work for me, _write isn't called.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jean343/Node-OpenMAX/issues/7#issuecomment-329036826, or mute the thread https://github.com/notifications/unsubscribe-auth/AGf-VhLaU-yAeRxZ_AcBe_8xsSkavm7lks5shzpvgaJpZM4PVVZJ .

sledesm commented 6 years ago

Hi

Could you make it work?

I post you a screenshot of what I'm doing right now. I am using 4 raspberry pis and websockets. I get around 25 fps sending jpg frames and around 6% cpu in the raspberry pi.

Would you be so kind to publish a new version of the module with the latest change? It is needed for the jpg transmission because otherwise the system cannot know if a frame has finished or not when encoding using discrete frames coming out of the Encoding component.

Regards,

Santi.

On Tue, Sep 12, 2017 at 7:20 PM, Santiago Ledesma sledesm@gmail.com wrote:

Hi,

I am using the code of npm 1.6.0

I went to the node_modules/openmax/dist/perf, and copied there the CameraEncode.js example and run it there. It works for me. I run it after running CameraPipe

Regards,

Santi.

On Tue, Sep 12, 2017 at 7:14 PM, Jean-Philippe Bergeron < notifications@github.com> wrote:

I merged it, however it does not work for me, _write isn't called.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jean343/Node-OpenMAX/issues/7#issuecomment-329036826, or mute the thread https://github.com/notifications/unsubscribe-auth/AGf-VhLaU-yAeRxZ_AcBe_8xsSkavm7lks5shzpvgaJpZM4PVVZJ .

jean343 commented 6 years ago

I did not get it to work, I get an invalid parameter exception... It might be a problem with my PI. Your stats are pretty impressive, PIes are cool!

No problem, I just did push 1.6.1

JP

sledesm commented 6 years ago

Txs!

On Thu, Sep 14, 2017 at 4:04 PM, Jean-Philippe Bergeron < notifications@github.com> wrote:

Closed #7 https://github.com/jean343/Node-OpenMAX/issues/7.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jean343/Node-OpenMAX/issues/7#event-1250170102, or mute the thread https://github.com/notifications/unsubscribe-auth/AGf-VsT1QWNPlzFGxvTVSAcOmdYoUC8Sks5sibEYgaJpZM4PVVZJ .