Scale
Posts: 2
Joined: Wed Mar 08, 2017 12:09 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 08, 2017 12:11 pm

Any change that we get a version that supports the Pi Zero W built-in wifi?

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 08, 2017 6:20 pm

I rebuilt the project on my own and recognised a problem with the RTSP server in the current version. The binary seems to be renamed from h264_v4l2_rtspserver to v4l2rtspserver.

That change can be processed as follows:

Code: Select all

# Rename the binary in the system service file
sudo sed -i "s/\/usr\/local\/bin\/h264_v4l2_rtspserver/\/usr\/local\/bin\/v4l2rtspserver/g" /home/pi/RaspberryIPCamera/DefaultConfigFiles/RTSP-Server.service

# Put system service file for RTSP server into place
sudo cp /home/pi/RaspberryIPCamera/DefaultConfigFiles/RTSP-Server.service /etc/systemd/system/RTSP-Server.service
The second command is from Ronny's original installation.sh and should help you to know where to insert it. After that change everything worked fine again.

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 08, 2017 6:25 pm

Scale wrote:Any change that we get a version that supports the Pi Zero W built-in wifi?
I am using this project on a Raspberry Zero with a WiFi dongle. What could be different with a Zero W with a built-in WiFi?

Scale
Posts: 2
Joined: Wed Mar 08, 2017 12:09 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 08, 2017 7:05 pm

ithieme wrote:
Scale wrote:Any change that we get a version that supports the Pi Zero W built-in wifi?
I am using this project on a Raspberry Zero with a WiFi dongle. What could be different with a Zero W with a built-in WiFi?
Just to be sure i did a clean install, it looks like it doesn't even boot.
No clue why

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Sun Mar 12, 2017 4:06 pm

Scale wrote:Any change that we get a version that supports the Pi Zero W built-in wifi?
Now I can confirm that it is also working with the Raspberry PI Zero W. I used the SD card from my regular Zero (with WiFi dongle) and put it into the new Zero W and it worked without any changes.

RafalPi
Posts: 5
Joined: Tue Mar 14, 2017 10:07 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Tue Mar 14, 2017 10:23 pm

ithieme wrote:I rebuilt the project on my own and recognised a problem with the RTSP server in the current version. The binary seems to be renamed from h264_v4l2_rtspserver to v4l2rtspserver.

That change can be processed as follows:

Code: Select all

# Rename the binary in the system service file
sudo sed -i "s/\/usr\/local\/bin\/h264_v4l2_rtspserver/\/usr\/local\/bin\/v4l2rtspserver/g" /home/pi/RaspberryIPCamera/DefaultConfigFiles/RTSP-Server.service

# Put system service file for RTSP server into place
sudo cp /home/pi/RaspberryIPCamera/DefaultConfigFiles/RTSP-Server.service /etc/systemd/system/RTSP-Server.service
The second command is from Ronny's original installation.sh and should help you to know where to insert it. After that change everything worked fine again.
At the end after going through all lines (including your correction above) of the installation.sh I keep getting this as part of the boot process:

Code: Select all

Failed to start/load random seed.
[...]
Failed to start the PHP Fast CGI Process Manager (See 'systemctl status php5-fpm.service for details)
[...]
Failed to start A high performance web server and a reverse proxy server. (See 'systemctl status nginx.service' for details)
And nothing works.

I am a beginner and likely in too deep water at the moment. Any advice on what went wrong?

I use a SanDisk 16GB, RaspberryPiZeroW and the original camera module.
I have also tried the same procedure on Pi3 with the same result.

What am I doing wrong? Is there anyone who could try and follow the installation.sh as it is and let me know what is wrong?
I have been trying various things for a week now without success :(

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 10:45 am

RafalPi wrote:I am a beginner and likely in too deep water at the moment. Any advice on what went wrong?

I use a SanDisk 16GB, RaspberryPiZeroW and the original camera module.
I have also tried the same procedure on Pi3 with the same result.

What am I doing wrong? Is there anyone who could try and follow the installation.sh as it is and let me know what is wrong?
I have been trying various things for a week now without success :(
The biggest difference between your installation an mine is that I stopped at line 128 of Ronny's installation script. Because that is the point where everything should work. The rest is just optimisation.

In a former post you wrote the following:
RafalPi wrote:

Code: Select all

[email protected]:~ $ systemctl status php5-fpm.service
● php5-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
   Active: failed (Result: exit-code) since Thu 1970-01-01 00:00:26 UTC; 47 years 1 months ago
  Process: 604 ExecStartPre=/bin/chgrp www-data /tmp/phpsessions (code=exited, status=1/FAILURE)
The last line let me guess that is has something to do with the changes that have been made by lines 161 to 165 of Ronny's installation script. I haven't done these things as I explained before. Maybe I should continue to find out what the reason of your problem is. ;)

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 12:23 pm

ithieme wrote:Maybe I should continue to find out what the reason of your problem is. ;)
Got it! The change which has been made by line 163 of Ronny's script doesn't work. If you already ran that command then do the following. It will replace the wrongly inserted line 8 in /lib/systemd/system/php5-fpm.service.

Code: Select all

sudo mount -o remount rw /
sudo sed -i "8c\ExecStartPre=/bin/bash -c 'if [ ! -d \"/tmp/phpsessions\" ]; then /bin/mkdir /tmp/phpsessions; fi'" /lib/systemd/system/php5-fpm.service
For all who didn't do the change but want to, please replace the line 163 of Ronny's installation script with:

Code: Select all

sudo sed -i "8i\ExecStartPre=/bin/bash -c 'if [ ! -d \"/tmp/phpsessions\" ]; then /bin/mkdir /tmp/phpsessions; fi'" /lib/systemd/system/php5-fpm.service
Be aware that the first sed replaces an existing line and the second one inserts a new line.

I hope it works now :)

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 2:32 pm

Btw, line 161 has to be changed the same way. If you already ran that command then ...

Code: Select all

sudo mount -o remount rw /
sudo sed -i "20c\ExecStartPre=/bin/bash -c 'if [ ! -d \"/var/log/nginx\" ]; then /bin/mkdir /var/log/nginx; fi'" /lib/systemd/system/nginx.service
... otherwise ...

Code: Select all

sudo sed -i "20i\ExecStartPre=/bin/bash -c 'if [ ! -d \"/var/log/nginx\" ]; then /bin/mkdir /var/log/nginx; fi'" /lib/systemd/system/nginx.service

philletourneau
Posts: 10
Joined: Thu May 28, 2015 5:13 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 3:34 pm

Does someone want to fork this file on GitHub and make the necessary corrections?

RafalPi
Posts: 5
Joined: Tue Mar 14, 2017 10:07 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 9:07 pm

Thank you ithieme!

I have followed your advice on 161 and 163 but forgot to do the following adjustment:
# Rename the binary in the system service file
sudo sed -i "s/\/usr\/local\/bin\/h264_v4l2_rtspserver/\/usr\/local\/bin\/v4l2rtspserver/g" /home/pi/RaspberryIPCamera/DefaultConfigFiles/RTSP-Server.service
I ended up with everything working apart from the RTSP stream getting out. I will have to repeat this tomorrow I'm afraid.

But this is already much better than it was before. I will post here when I succeed fully. Thanks!

[EDIT]: I have done it again including the final correction of RTSP. It is better now. However...

RTSP works fine on VLC but when I try adding the camera on Surveillance Station on my Synology there is a problem.
I fill in all the details as Ronny suggests in his post https://random-notes-of-a-sysadmin.blog ... ra-on.html and the test connection is successful with a green tick. When I click next, a popup message says "Failed to load camera capabilities values."
screen.46.png
Surveillance station failed adding camera
screen.46.png (63.64 KiB) Viewed 4952 times
This is a problem for tomorrow.
Last edited by RafalPi on Wed Mar 15, 2017 10:26 pm, edited 1 time in total.

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 9:32 pm

RafalPi wrote:I will have to repeat this tomorrow I'm afraid.
Why? You just need to run this command and reboot. It will change the wrong value on your raspberry. It doesn't matter at which position of the procedure that happens. But don't forget to remount the image rw before you do it. ;)

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 9:41 pm

ithieme wrote:
RafalPi wrote:I will have to repeat this tomorrow I'm afraid.
Why? You just need to run this command and reboot. It will change the wrong value on your raspberry. It doesn't matter at which position of the procedure that happens. But don't forget to remount the image rw before you do it. ;)
I was wrong. To change the value directly on your raspberry you have to do this

Code: Select all

sudo mount -o remount rw /
sudo sed -i "s/\/usr\/local\/bin\/h264_v4l2_rtspserver/\/usr\/local\/bin\/v4l2rtspserver/g" /etc/systemd/system/RTSP-Server.service

TheWaterbug
Posts: 76
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 10:16 pm

I'm so glad that knowledgable people are working on this again! I'm going to try building from scratch again, with the changes as noted.

If I skip all the optimization steps, should I then be able to get and install ffmpeg? I want to push the RTSP to my YouTube channel directly from the Pi instead of sending through an intermediate computer. Even better would be if I could do it directly from the RTSP server without using ffmpeg (my ffmpeg command uses -copy for both a and v, so it's just re-transmitting), but I don't know how to do that ;)

RafalPi
Posts: 5
Joined: Tue Mar 14, 2017 10:07 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Wed Mar 15, 2017 10:37 pm

ithieme wrote: I was wrong. To change the value directly on your raspberry you have to do this

Code: Select all

sudo mount -o remount rw /
sudo sed -i "s/\/usr\/local\/bin\/h264_v4l2_rtspserver/\/usr\/local\/bin\/v4l2rtspserver/g" /etc/systemd/system/RTSP-Server.service
Thanks Ithieme,
Everything works now. Regardless of the error I posted above where Surveillance Station does not know how to pull camera settings. The Camera setup goes further in the end and everything seems to be working well. :D

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Thu Mar 16, 2017 3:28 pm

TheWaterbug wrote:If I skip all the optimization steps, should I then be able to get and install ffmpeg?
You should be able to get it also with the optimisation part. Unfortunately there is no easy way to install ffmpeg because there is no package for it. I have no experiences in that but as i read on a few pages you can compile it yourself on your raspberry.
TheWaterbug wrote:I want to push the RTSP to my YouTube channel directly from the Pi instead of sending through an intermediate computer.
Sounds like an interesting project. You have to try whether the raspberry is performant enough to do both.
TheWaterbug wrote:Even better would be if I could do it directly from the RTSP server without using ffmpeg (my ffmpeg command uses -copy for both a and v, so it's just re-transmitting), but I don't know how to do that ;)
Can you explain it a bit more detailed? Shall it be a live stream or do you just want to record videos from the RTSP stream and send them automatically to youtube?

ithieme
Posts: 14
Joined: Fri Dec 30, 2016 12:06 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Thu Mar 16, 2017 3:32 pm

RafalPi wrote:Everything works now. Regardless of the error I posted above where Surveillance Station does not know how to pull camera settings. The Camera setup goes further in the end and everything seems to be working well. :D
Nice to hear that. Tomorrow I will check whether I have the same problem with my surveillance station or not. I tried it only once with the ready made image on a raspberry 2.

TheWaterbug
Posts: 76
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: PHP/Bootstrap Web Interface for the Pi Camera

Mon Mar 20, 2017 8:51 pm

ithieme wrote:
TheWaterbug wrote:If I skip all the optimization steps, should I then be able to get and install ffmpeg?
You should be able to get it also with the optimisation part. Unfortunately there is no easy way to install ffmpeg because there is no package for it. I have no experiences in that but as i read on a few pages you can compile it yourself on your raspberry.
Ok. I'll have to try this, probably using this guide.
TheWaterbug wrote:I want to push the RTSP to my YouTube channel directly from the Pi instead of sending through an intermediate computer.
Sounds like an interesting project. You have to try whether the raspberry is performant enough to do both.
TheWaterbug wrote:Even better would be if I could do it directly from the RTSP server without using ffmpeg (my ffmpeg command uses -copy for both a and v, so it's just re-transmitting), but I don't know how to do that ;)
Can you explain it a bit more detailed? Shall it be a live stream or do you just want to record videos from the RTSP stream and send them automatically to youtube?
The project is a live BeeCam*. I don't need any recording capabilities, at least not in the camera. If there's any recording to be done, I'm happy to let YouTube handle it.

Right now my Pi is serving up h.264 video on RSTP:8554, and I can view it from VLC. I wanted to serve it via YouTube, but YT requires that it be pushed to YT, not just available on some port.

So I installed ffmpeg on an old iMac inside my LAN and fiddled with the setting to pull the video from the camera and push it to YT. The first time I got this working I was just copying someone else's script, and although it was functional, the CPU usage on my aging Core2Duo was 50 - 60%, which didn't leave the iMac very usable for anyone else.

So I removed all the transcoding arguments from the script and just left it as:

ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://ip.address.of.beecam:8554" -i some-music.mp3 -vcodec copy -acodec copy -t 01:08:16 -f flv "rtmp://my-youtube-streaming-key"

So it doesn't do any transcoding; it just takes the stream in one side and spits it back out the other side. I'm not even sure if the "-f fly" is necessary. The CPU usage dropped down to ~2-3%, and now YouTube's servers are doing all the heavy lifting.

So I'm thinking that the Pi should be able to handle the same task.

But that did get me thinking that, if ffmpeg is just pushing packets to YT, can v4l2rtspserver be configured to do it instead of ffmpeg?

* the BeeCam isn't always up, because the voltage regulator overheats and shuts down in warm weather. Or the iMac locks up and requires rebooting, and I haven't figured out how to configure my script to launch at startup.

TheWaterbug
Posts: 76
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: PHP/Bootstrap Web Interface for the Pi Camera

Thu Mar 23, 2017 12:26 am

RafalPi wrote:Everything works now. Regardless of the error I posted above where Surveillance Station does not know how to pull camera settings. The Camera setup goes further in the end and everything seems to be working well. :D
What version do your PiCam report? I saw this in the diff report:

Code: Select all

 -SoftwareVersion = "v1.6 Beta"
+SoftwareVersion = "v1.8 Beta"
Does this mean v1.7 got yanked soon after it was published?

Do you have the bandwidth control slider in your installed version?

RafalPi
Posts: 5
Joined: Tue Mar 14, 2017 10:07 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Thu Mar 23, 2017 10:09 pm

I built mine from version 1.7 but it still reported as: SoftwareVersion v1.6.
I've not seen version v1.8 yet at that point. I need to check it out.

TheWaterbug
Posts: 76
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: PHP/Bootstrap Web Interface for the Pi Camera

Fri Mar 24, 2017 7:03 pm

RafalPi wrote:I built mine from version 1.7 but it still reported as: SoftwareVersion v1.6.
I've not seen version v1.8 yet at that point. I need to check it out.
Do you have the bandwidth slider? That was one of the main (and the most visible) features that he said he added in 1.7.

RafalPi
Posts: 5
Joined: Tue Mar 14, 2017 10:07 pm

Re: PHP/Bootstrap Web Interface for the Pi Camera

Sat Mar 25, 2017 9:34 am

Do you have the bandwidth slider? That was one of the main (and the most visible) features that he said he added in 1.7.
Cannot see a bandwidth slider anywhere.

Where have you noticed version 1.8?

I can only see v1.7 here http://ronnyvdbr.github.io/RaspberryIPCamera/
and there is not any more recent updates on github https://github.com/ronnyvdbr/RaspberryIPCamera
And installation.sh still points to version 1.7:

Code: Select all

wget -O /home/pi/RaspberryIPCamera.zip https://github.com/ronnyvdbr/RaspberryIPCamera/archive/v1.7-beta.zip

calleblyh
Posts: 60
Joined: Thu Feb 12, 2015 6:14 pm
Location: Southwest Finland

Re: PHP/Bootstrap Web Interface for the Pi Camera

Mon Mar 27, 2017 12:42 pm

Thank you very much. Over last weeks I have tried streaming video without success sofar. Today I downloaded your image ver 1.6 Beta and it worked right outofthe box. In a RPi3B and also RPiZ, but not on RPiZW (what I can understand). I would prefer using the RPiZWifi , but what kind of update/upgrade process does it require ? I will soon start to place the gear in my birdbox and wait for some bird(s) to do the nestling performance over coming weeks/months.

I really Appreciate your work
Carl Helsinki
Finland

PS. I couldnot access raspi-config to set my international keyboard to Finnish and so on

TheWaterbug
Posts: 76
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: PHP/Bootstrap Web Interface for the Pi Camera

Tue Mar 28, 2017 4:19 am

RafalPi wrote:
Do you have the bandwidth slider? That was one of the main (and the most visible) features that he said he added in 1.7.
Cannot see a bandwidth slider anywhere.

Where have you noticed version 1.8?

I can only see v1.7 here http://ronnyvdbr.github.io/RaspberryIPCamera/
and there is not any more recent updates on github https://github.com/ronnyvdbr/RaspberryIPCamera
And installation.sh still points to version 1.7:

Code: Select all

wget -O /home/pi/RaspberryIPCamera.zip https://github.com/ronnyvdbr/RaspberryIPCamera/archive/v1.7-beta.zip
I see the same files as you, but I noticed this in one of the change logs (though I can't remember which one!):

Code: Select all

 -SoftwareVersion = "v1.6 Beta"
+SoftwareVersion = "v1.8 Beta"
But I also just noticed that Ronny is alive! He's been committing changes, recently. These were after my latest attempts to build it from scratch, so maybe it's time to try again.

He's probably lurking until he has a stable release.

calleblyh
Posts: 60
Joined: Thu Feb 12, 2015 6:14 pm
Location: Southwest Finland

Re: PHP/Bootstrap Web Interface for the Pi Camera

Tue Mar 28, 2017 7:19 am

Scale wrote:Any change that we get a version that supports the Pi Zero W built-in wifi?
Yesterday I downloaded version 1.6 Beta. Tested sucessfully on Pi3 and PiZ thru ethernet. Could not establish thru Wifi. Moved SD-card to PiZW which didn't boot at all ? I have scanned thru all postings on this topic and for a nonprogrammer like me, I honestly dont have knowledge enough to dare dig into the code...
Is there already version 1.7 available to download somewhere where Wifi and PiZW problems are fixed ?
Thanx to the author for making this application, great stuff.

BR
Calleblyh

Return to “Camera board”