dturing / node-gstreamer-superficial

Superficial gstreamer binding
MIT License
130 stars 45 forks source link

Doest not work on raspberry pi and amazon kinesis #33

Closed josebenitezg closed 4 years ago

josebenitezg commented 4 years ago

I try to run gstreamer superficial on rpi and kinesis video and show this. But same code works fine on macbook pro. ### This is my code

const gstreamer = require('gstreamer-superficial');

const pipeline = new gstreamer.Pipeline(`videotestsrc is-live=true ! \

video/x-raw,framerate=25/1 ! \

videoconvert ! \

x264enc bframes=0 key-int-max=30 bitrate=300 tune=stillimage  ! \

h264parse ! \

video/x-h264,stream-format=avc,alignment=au,profile=baseline ! \

kvssink stream-name=stream1_in storage-size=128 \

access-key="-----------" secret-key="---------"`

);

pipeline.play();
pipeline.pollBus(msg => {
       console.log('pipeline.pollBus', msg);

});

THE ERROR:

INFO - createKinesisVideoClient(): Creating Kinesis Video Client 2020-01-12 17:37:09 [1995569920] INFO - heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001 2020-01-12 17:37:09 [1995569920] INFO - heapInitialize(): Creating AIV heap. 2020-01-12 17:37:09 [1995569920] INFO - heapInitialize(): Heap is initialized OK 2020-01-12 17:37:09 [1995569920] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002 2020-01-12 17:37:09 [1995569920] DEBUG - getSecurityTokenHandler invoked 2020-01-12 17:37:09 [1995569920] DEBUG - Refreshing credentials. Force refreshing: 0 Now time is: 1578861429428906712 Expiration: 0 2020-01-12 17:37:09 [1995569920] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000010 2020-01-12 17:37:09 [1995569920] INFO - createDeviceResultEvent(): Create device result event. 2020-01-12 17:37:09 [1995569920] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040 2020-01-12 17:37:09 [1995569920] DEBUG - clientReadyHandler invoked 2020-01-12 17:37:09 [1995569920] INFO - try creating stream 2020-01-12 17:37:09 [1995569920] INFO - Creating Kinesis Video Stream stream2_in 2020-01-12 17:37:09 [1995569920] INFO - createKinesisVideoStream(): Creating Kinesis Video Stream. 2020-01-12 17:37:09 [1995569920] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002 2020-01-12 17:37:09 [1995569920] Violación de segmento

Do you know about this issue? or what can I do

dturing commented 4 years ago

Can you run the same pipeline with gst-launch without a segfault?

josebenitezg commented 4 years ago

Yes and works perfect in rpi with gst-launch the same pipeline

josebenitezg commented 4 years ago

This is the pipeline: gst-launch-1.0 -v v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,format=I420,width=640,height=480,framerate=30/1 ! x264enc bframes=0 key-int-max=45 bitrate=500 tune=zerolatency ! video/x-h264,stream-format=avc,alignment=au ! kvssink stream-name=YourStreamName storage-size=128 access-key=“------" secret-key=“------"

dturing commented 4 years ago

Hey @josebenitezg , sorry for not being very responsive on this. Can you try to pinpoint this to a specific gstreamer element? Like, does the pipeline work if you stream to fakesink, or from videotestsrc?

I'm reluctant to sign up for Amazon Kinesis just to help debugging...

nparziale commented 4 years ago

Hi @dturing , thanks a lot for your work with this library. I work with @josebenitezg, this pipeline is not related so far to kinesis but also crashes with a segmentation fault error after a few minutes (we are testing it with a raspberry pi):

let pipeline = new gstreamer.Pipeline( v4l2src do-timestamp=true device=/dev/video0 ! image/jpeg,width=1280,height=720,framerate=30/1 ! omxmjpegdec ! videorate ! video/x-raw,framerate=30/1 ! omxh264enc control-rate=1 target-bitrate=1000000 inline-header=FALSE periodicty-idr=30 ! h264parse ! video/x-h264,stream-format=avc,alignment=au,profile=baseline ! tee name=t ! queue ! splitmuxsink muxer=matroskamux location=videos/video-%05d.mkv max-files=6000 max-size-time=10000000000 )

dturing commented 4 years ago

hey @nparziale, thanks for those details. I've spent some time with this and could reproduce segfaults with your pipeline, if i would monitor the pipeline with pollBus(). I found that increasing the refcount on the wrapper around Pipeline fixes that for me (see 6657fbc).

Since that seems a sensible fix in any case, i've released it as 1.4.1; please check if that remedies your segfaults too.

dturing commented 4 years ago

closing (no response). please reopen or open a new issue if problem persists.