bartbutenaers / node-red-contrib-multipart-stream-encoder

Node Red node for encoding multipart streams over http
Apache License 2.0
9 stars 1 forks source link

no multipart url #3

Closed TibGva closed 6 years ago

TibGva commented 6 years ago

Hi

I manage to successfuly use the node with the following url http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?resolution=352x288

but the node is failing with a mp4 url with content type http://filmsgieat.viewsurf.com/atmb01/media_1531856998.mp4

I get no multipart url error message, I think the content type is "video/mp4"

Should I try to convert the mp4 in multipart? Is it feasible??

bartbutenaers commented 6 years ago

Hello Thibaut,

I assume your question is about my node-red-contrib-multipart-stream-decoder, not about this node-red-contrib-multipart-stream-encoder?

This decoder can handle infinite streams of data, e.g. from an IP camera. However your second URL points to an mp4 file, so it is just a video file with a finite length. So you get only 1 part instead of 'multi' parts.

Just put the url in the standard httprequest node from Node-Red, and you can download that file:

image

[{"id":"c3217ed6.118f1","type":"http request","z":"279b8956.27dfe6","name":"","method":"GET","ret":"bin","url":"http://filmsgieat.viewsurf.com/atmb01/media_1531856998.mp4","tls":"","x":420,"y":540,"wires":[["b97cfe01.7861f","f86f3cae.f7c2f"]]},{"id":"99b62e1e.c0d5","type":"inject","z":"279b8956.27dfe6","name":"Start download","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":540,"wires":[["c3217ed6.118f1"]]},{"id":"b97cfe01.7861f","type":"debug","z":"279b8956.27dfe6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":620,"y":600,"wires":[]},{"id":"f86f3cae.f7c2f","type":"file","z":"279b8956.27dfe6","name":"","filename":"/var/tmp/media_1531856998.mp4","appendNewline":false,"createDir":false,"overwriteFile":"true","x":720,"y":540,"wires":[]}]

In the output of the debug node you can see that it downloads a single (large) mp4 file: image

Kind regards, Bart

TibGva commented 6 years ago

Actually what I would like to do is to take pictures of the mp4 file every minute per example in order to run aws rekognition on it. But I am afraid I cannot do that on an mp4 file ??

bartbutenaers commented 6 years ago

Thibaut,

Well I have already been experimenting with mp4 to/from images in Node-Red, but due to lack of time I haven't completed that yet ...

There a few mp encoder/decoder libraries available in NPM like this one which is written in pure Javascript. The advantage is that it can be installed without extra steps needed. The disadvantage is the Javascript is slower, and that those libraries cannot handle all kind of mp4 files.

On the other hand you can use FFMPEG under the hood, which is written in C++. The advantage is that it is much faster, and that it support most formats. The disadvantage is that you have to go through a series of installation steps, especially on platforms like Raspberry ... Moreover most Node-Red ffmpeg-based nodes communicate with ffmpeg via temporary files instead of memory (which is bad for performance and for your disc).

If I were you, I would post this question on the Node-Red forum. You probably will get much more response from creative brains ;-)

Bart