OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.19k stars 232 forks source link

range feature for httpd #1052

Open darkfuncat opened 10 months ago

darkfuncat commented 10 months ago

Hello, I try to download video files from openipc camera, but only some part of file. (range feature for http download) The purpose is to send video file of alarm few seconds before trigger. The feature from HTTP1.1 seems not enabled by default in openipc. Is it possible to activate it ? Exemple, when doing : curl -r -5000 http://user:pwd@IP:85/cgi-bin/dl.cgi?file=/mnt/mmcblk0p1/2023/10/14/XX.mp4 Curl should download only last 5000 bytes from file, but instead it download whole file (which is very long and useless) Or perhaps there is another way to do this ? Thanks

themactep commented 10 months ago

Enable this https://github.com/OpenIPC/firmware/blob/001687b3b736a715303f92621bff01da0d20c389/general/package/busybox/busybox.config#L887, recompile and update fw, check that is works, send a pr.

darkfuncat commented 10 months ago

Thanks for your advice. OK so I have followed instructions to recompile firmware. I changed the file you mentioned with : CONFIG_FEATURE_HTTPD_RANGES=y (I guess this is the good syntax regarding other lines) After compile I resintall rootfs.squashfs.t31 and uImage.t31, reboot and still not able to download range of file with above curl command. Any tip or something I forgot ? (I think that I am reaching my limits in term of development...) Thanks

themactep commented 10 months ago

Did you try to download a piece of a real file to check if the range function works? The dl.cgi is a script that proxies content of the requested file from anyplace in the system to the http client. This might be a problem for determining the range. If direct dowload works with the enabled option, we'll start from there.

darkfuncat commented 10 months ago

Hello @themactep The purpose here is to trigger alarm and send a sample of video few seconds before and after trigger (basic thing from all other camera I own) To be honest, I am facing many difficulties to achieve this with OpenIPC :

This is a lot of work and many problems and it takes time...