mjpeg_streamer with raspberry cam

The SARPi project forum. For anything and everything relating to Slackware ARM on a Raspberry Pi 1, 2, and 3. This forum is NOT a replacement or substitute for the Slackware (ARM) forums on Linux Questions website! Please try to seek help there first about any issues you may be experiencing, or question you might have, before posting on here.
User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

mjpeg_streamer with raspberry cam

Postby linicks » Fri Apr 17 2015 - 19:01:33

I got this working great:

http://fishpi.linicks.net/

The raw stream works in firefox, but in some other browsers (I mention no OS ;) ) it doesn't, so then use the javascript stream (which is a tad slower).

Also feedback would be good, as based in England here it would be nice to see the performance over the net from remote places. Also remember the fish tank light is on from about 08:15 to 20:00 BST, and I have set the raspberry cam to switch from exposure 'day' mode to 'night' mode at these times... but at night when in bed (and all lights are off), the image is totally black - this is not an error :)

So, if anybody needs any help to set this up, please ask here.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
justwantin
Registered user
Registered user
Posts: 4
Joined: Sat Apr 25 2015 - 07:29:42

Re: mjpeg_streamer with raspberry cam

Postby justwantin » Sat Apr 25 2015 - 08:31:16

what did you need other than mjpg-streamer.?

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: mjpeg_streamer with raspberry cam

Postby linicks » Sat Apr 25 2015 - 12:16:44

Well, I mean you need to run raspistill command to produce streaming images, and also set up a tempfs file system so you don't hammer the sdcard, plus run the mjpeg_streamer as normal user etc. etc.

And also the code has logging removed as it churns out a lot of logs - I hacked it a bit to produce minimal logs.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
justwantin
Registered user
Registered user
Posts: 4
Joined: Sat Apr 25 2015 - 07:29:42

Re: mjpeg_streamer with raspberry cam

Postby justwantin » Sun Apr 26 2015 - 01:27:23

Thanks for that!!

I've tried to follow a couple threads on Rpi forum but in the end it seemed to me a bit overcomplicated. I've have a Rpi cam but I think I'll ebay it. Been using 2 Logitech C300's up until recently and they just work. However it seems that with the latest kernels/modules or something else from hexxxeh, mjpg-streamer won't output anything but yuyv. I'm thinking of moving over to a banana pi and running straight slackware arm without any need for things developed with only raspbian in mind

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: mjpeg_streamer with raspberry cam

Postby linicks » Sun Apr 26 2015 - 13:01:59

Well, if you need any help, just ask.

I have been looking at the logging issue again (you really need logging so you can keep an eye on the server). The 'raw stream' is OK, as once a client connects, a client thread gets started and detached, so it only hits the logging code once - which is good.

But the issue is with the javascript stream - it seems to create a new different client thread each image update, so the logging code gets hit about 3 or 4 times a second - and you can guess the rest.

What I have done is check if it is the same client, if it is, don't log it again - also I added a incremental var that slows the logging down to about one log every 20 seconds if more than one client is on the server (as the client list will ping-pong between the different IP's).

A bit of a hack, but it seems to work (so far).


File plugins/output_http/httpd.c

Code: Select all

char bname[NI_MAXHOST]; // Nick - try to slow down logging - 26/04/2015
int flag=0; // Nick - try to slow down logging - 26/04/2015
...

// Nick - try to reduce hammering syslog - 26/04/2015

                if(getnameinfo((struct sockaddr *)&client_addr, addr_len, name, sizeof(name), NULL, 0, NI_NUMERICHOST) == 0) {
                        if ((strcmp(name, bname) !=0) && flag == 0) {
                            syslog(LOG_INFO, "serving client: %s\n", name);
                        strcpy(bname, name);
                        }
                } else {
                flag = 0;
                }
        flag++;
        if (flag > 50) {
            flag = 0;
        }


Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

Return to “SARPi Project - Slackware ARM on a Raspberry Pi”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 5 guests