e1ioan / rokuphp

32 stars 9 forks source link

Camera Setup Web Issue #4

Closed walker3733 closed 5 years ago

walker3733 commented 6 years ago

I have installed everything and followed every step of the instructions. When I go to the pi web address and attempt to setup the camera I get the following result instead of the web page.

image

The full result copied and pasted:

<?php require_once("rpcl/rpcl.inc.php"); require_once("dm.php"); require_once("dmauth.php"); //Includes use_unit("jquerymobile/forms.inc.php"); use_unit("extctrls.inc.php"); use_unit("stdctrls.inc.php"); use_unit("jquerymobile/jmobile.inc.php");

//Class definition class PageLogin extends MPage { public $EditLoginUser = null; public $ButtonLogin = null; public $EditLoginPassword = null; public $LabelLLogin = null; public $LabelLPassword = null; public $MsgCreate = null; public $LabelCPasswor = null; public $LabelCRPassword = null; public $LabelCLogin = null; public $EditRePassword = null; public $EditPassword = null; public $EditLogin = null; public $ButtonCreateUser = null; public $LabelCTitle = null; function ShowHideCreateUser($val) { $this->MsgCreate->Visible = $val; $this->LabelCTitle->Visible = $val; $this->LabelCLogin->Visible = $val; $this->EditLogin->Visible = $val; $this->LabelCPasswor->Visible = $val; $this->EditPassword->Visible = $val; $this->LabelCRPassword->Visible = $val; $this->EditRePassword->Visible = $val; $this->ButtonCreateUser->Visible = $val; } function ShowHideLogin($val) { $this->LabelLLogin->Visible = $val; $this->EditLoginUser->Visible = $val; $this->LabelLPassword->Visible = $val; $this->EditLoginPassword->Visible = $val; $this->ButtonLogin->Visible = $val; } function ButtonCreateUserClick($sender, $params) { global $dm; $path = $dm->GetDataPath(); if($this->EditLogin->Text == "") { $this->MsgCreate->Caption = "Login is required"; return; } if($this->EditPassword->Text == "") { $this->MsgCreate->Caption = "Password is required"; return; } if($this->EditPassword->Text != $this->EditRePassword->Text) { $this->MsgCreate->Caption = "Password does not match."; return; } $hash = md5($this->EditLogin->Text . ":rokuphp:" . $this->EditPassword->Text); if($fh = fopen($path . "validuser.txt", 'w')) { $stringData = $this->EditLogin->Text . ":rokuphp:" . $hash; fwrite($fh, $stringData, 1024); fclose($fh); } global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } function PageLoginShow($sender, $params) { global $dm; $path = $dm->GetDataPath(); $val = file_exists($path . "validuser.txt"); $this->ShowHideCreateUser(!$val); $this->ShowHideLogin($val); } function ButtonLoginClick($sender, $params) { global $dmauth; $dmauth->ZAuth->UserName = $this->EditLoginUser->Text; $dmauth->ZAuth->UserPassword = $this->EditLoginPassword->Text; mobileRedirect("menu.php"); } }

global $application;

global $PageLogin;

//Creates the form $PageLogin = new PageLogin($application);

//Read from resource file $PageLogin->loadResource(FILE);

//Shows the form $PageLogin->show();

?>

walker3733 commented 6 years ago

Please disregard my original message. I retried using the php7 and the web interface worked. I setup everything per your instruction and I am now getting the message"Can not play this live stream...". Any ideas?

Thanks,

walker3733 commented 6 years ago

Also here is a copy of the error.log @file and I am trying to view a Reolink RLC-410s.

error.log

e1ioan commented 6 years ago

My guess is that ffmpeg is not installed on your Raspberry Pi. Try running ffmpeg in the console and see if you get any errors:

$ ffmpeg -version

walker3733 commented 6 years ago

Here are the results:

ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100

e1ioan commented 6 years ago

Can you please try running this command (replace first ___RTSP___ with your camera's rtsp address) and see if you get any errors:

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i ___RTSP___ -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8

The rtsp address should look something like this: rtsp://login:password@192.168.1.59:554/axis-media/media.amp

Note, the address above is for an Axis camera, for your camera the last part of the URL may look different.

walker3733 commented 6 years ago

I think I put it in the right spot:

Command: ffmpeg -thread_queue_size 512 -rtsp_transport 192.168.1.40:554 -rtsp_flags prefer_tcp -i RTSP -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8

Results: ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 RTSP: No such file or directory

e1ioan commented 6 years ago

It should be something like this:

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rtsp://login:password@192.168.1.59:554/axis-media/media.amp -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8

... but remember, you have to replace everything that is in bold with your own values.

walker3733 commented 6 years ago

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rtsp://​admin:​TravisJames3733​@​192.168.1.40:554//h264Preview01​main -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8 ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [tcp @ 0x1fc9420] Failed to resolve hostname ​192.168.1.40: Name or service not known rtsp://​admin:​TravisJames3733​@​192.168.1.40:554//h264Preview01​main: Input/output error

e1ioan commented 6 years ago

It seems that your raspberry pi cannot see the camera. Are the pi and the camera on the same network? Try pinging the camera:

ping 192.168.1.40

walker3733 commented 6 years ago

Yes, they are both on the same network. I can ping it.

$ping -c 10 192.168.1.40 PING 192.168.1.40 (192.168.1.40) 56(84) bytes of data. 64 bytes from 192.168.1.40: icmp_seq=1 ttl=64 time=0.166 ms 64 bytes from 192.168.1.40: icmp_seq=2 ttl=64 time=0.135 ms 64 bytes from 192.168.1.40: icmp_seq=3 ttl=64 time=0.099 ms 64 bytes from 192.168.1.40: icmp_seq=4 ttl=64 time=0.141 ms 64 bytes from 192.168.1.40: icmp_seq=5 ttl=64 time=0.142 ms 64 bytes from 192.168.1.40: icmp_seq=6 ttl=64 time=0.121 ms 64 bytes from 192.168.1.40: icmp_seq=7 ttl=64 time=0.118 ms 64 bytes from 192.168.1.40: icmp_seq=8 ttl=64 time=0.143 ms 64 bytes from 192.168.1.40: icmp_seq=9 ttl=64 time=0.101 ms 64 bytes from 192.168.1.40: icmp_seq=10 ttl=64 time=0.129 ms

--- 192.168.1.40 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 9398ms rtt min/avg/max/mdev = 0.099/0.129/0.166/0.022 ms

e1ioan commented 6 years ago

After you installed the software on your pi, did you add the camera as ONVIF or you entered the rtsp address manually?

If you added as ONVIF, can you please post the content of the following file: cat /var/www/html/data/cameras.xml

If you added the rtsp address manually, did you try playing this rtsp address in VLC media player and see if it works? Open VLC, in the menu select Media->Open Network Stream and then paste:

rtsp://​admin:​TravisJames3733​@​192.168.1.40:554//h264Preview01​main

It seems that there is a problem with this rtsp address, but I don't have a Reolink camera and it's hard to me to guess what it is.

walker3733 commented 6 years ago

Ok, my apologies I'm an idiot that was the IP for my Pi. I have rerun the command and it seems to be running without errors.

walker3733 commented 6 years ago
<?xml version="1.0"?>
<xml><camera><name>Front Porch</name><url>rtsp%3A%2F%2Fadmin%3ATravisJames3733%2A%40192.168.1.114%3A554%2Fh264Preview_01_sub</url><snapshoturl>http%3A%2F%2Fadmin%3ATravisJames3733%2A%40192.168.1.114%3A5001%2Fonvifsnapshot%2Fsnapshot_channel01.jpg</snapshoturl><sound>0</sound><profileToken>001</profileToken><login>admin</login><password>UE8Y8RPAC2uqAv2e5gTMgxBEFvsfc1Pj84FK2YgkRbc%3D</password><mediaurl>http%3A%2F%2F192.168.1.114%3A8000%2Fonvif%2Fdevice_service</mediaurl></camera></xml>
e1ioan commented 6 years ago

It seems that when you added the camera, you selected the substream, try running this and see if you get any errors with the sub stream:

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8

You also can try adding the camera again and select the main stream, see if that works.

walker3733 commented 6 years ago

$ ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rrtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8 ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 rrtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub: Protocol not found Did you mean file:rrtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub?

e1ioan commented 6 years ago

there is an extra "r" there, erase it:

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8

walker3733 commented 6 years ago

ffmpeg -thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i rtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub -vcodec copy -codec:a aac -f hls -hls_flags delete_segments /dev/shm/test.m3u8 ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [rtsp @ 0x16bf630] method DESCRIBE failed: 401 Unauthorized rtsp://admin:TravisJames3733@192.168.1.114:554/h264Preview_01_sub: Server returned 401 Unauthorized (authorization failed)

e1ioan commented 6 years ago

I'm guessing that your login and password are right? admin TravisJames3733, right? Try deleting the camera in the application, add it again and select the main stream in the "H.264 Profiles Available". If it's authorization problem, I really can't help you with that... maybe you just typed a letter wrong somewhere? Like I said, try everything from the beginning (erase the cameras you already added) and see if that helps.

I have to take off right now, but I'll check your messages here later on.

walker3733 commented 6 years ago

Ok, so I made some progress. I now can select the camera that is setup and I see the progress bar stating "Retrieving". Once the progress bar reaches the end nothing happens and the progress bar goes away. I am wondering if it has to do with a resolution setting? I have tried all3 h.264 profiles (Baseline, Main and High) with no change. I did revert back to the "Main" profile as previously requested. I also tried changing the resolution from 2560x1440 to 720 and still nothing comes on the screen. I have also attached a screenshot of the encode settings in the Reolink client. Also thank you very much for the time and patience you have given me so far. I am really excited about getting this up and running.

Thanks,

JW

screen shot 2018-06-04 at 11 41 26 pm

e1ioan commented 6 years ago

Please try changing the frame rate to something like 25 or 30

walker3733 commented 6 years ago

So I tried the 2 options below 30 for the frame rate, which was 20 and 22, with no luck. Any other ideas?

e1ioan commented 6 years ago

I'm not sure what could it be, the application on the raspberry pi, if it's installed the right way, should work from first try with h264 encoded streams.

walker3733 commented 5 years ago

Just an update, I have gotten my cameras up and running. For some reason though I am only able to see them when I use the substream. Thanks for your help on this.