RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Tue Oct 20, 2015 6:56 pm

Zombievirus wrote: WebRTC doesn't really seem to be the thing i am looking for as it establishes a peer to peer connection and an ip address must be typed in. or am i misunderstanding something here?
WebRTC is p2p by nature, yes, but if you want to broadcast live content to multiple clients usually one peer is the server (the other peer being the Rpi itself). This is essentially how the Jitsi Meet Videobridge and similar SFU's work. The HTML source code in the page is supposed to be an example for those who want to build more complex scenarios. I do not exactly know what you are trying to achieve, but for what it matters, UV4L supports both custom and standard XMPP signalling. In particular, the latter is used by UV4L to connect the Rpi to any Jitsi Meet Room (or to any other WebRTC-compliant peer implementing XMPP signalling) to broadcast Video and/or Audio over the Web (audio is optionally two-way). WebRTC is standard and powerful, but requires some expertise.

Zombievirus
Posts: 19
Joined: Sun Sep 20, 2015 5:44 am

Re: Video4Linux2 driver ready!

Thu Oct 22, 2015 9:47 pm

Hi,

I have embedded the .mjpeg stream to the webpage and it works perfectly!

Below the stream i have 2 buttons: Capture Image and Record Video.

I have written 2 mini Scripts.

(Capture Image Button) pic.sh:

Code: Select all

#!/bin/bash

name=$(date +"%d.%m.%Y_%Hh%Mm%Ss")
raspistill -w 1600 -h 900 -t 2000 -o /var/www/x/images/bigpi/$name.jpg
(Record Video Button) vid.sh:

Code: Select all

#!/bin/bash

name=$(date +"%d.%m.%Y_%Hh%Mm%Ss")
raspivid -w 1024 -h 576 -t 10000 -o /var/www/x/images/bigpi/$name.h264
This records 10 seconds in .h264 format.


When i click the respective buttons the scripts are executed and the picture is taken, the video is recorded as expected.

The Problem is that the stream stops to work and resumes again when the script execution is over.

Can i execute the scripts and stream simultaneously?

Thanks

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Thu Oct 22, 2015 10:42 pm

Zombievirus wrote: Can i execute the scripts and stream simultaneously?
No, this is not possible.

Zombievirus
Posts: 19
Joined: Sun Sep 20, 2015 5:44 am

Re: Video4Linux2 driver ready!

Thu Dec 17, 2015 8:52 am

Hi,

I am trying to get Motion Detection to work but i am not having success.

What i did so far:
  • installed uv4l including raspicam-extras as stated here
    installed Motion
    downloaded the motion.conf from here and saved it in /etc/motion/
    Followed the instructions given here
    waved my hand in front of raspicam.
    No motion was detected though.
    Motion HTTP Server was up and running. checked it via port 8081. I could see live images there.
Terminal Output:

Code: Select all

root@pi:/etc/motion# uv4l --driver raspicam --auto-video_nr
<notice> [core] Trying driver 'raspicam' from built-in drivers...
<warning> [core] Driver 'raspicam' not found
<notice> [core] Trying driver 'raspicam' from external plug-in's...
<notice> [driver] Dual Raspicam Video4Linux2 Driver v1.9.32 built Sep 16 2015
<notice> [driver] Selected format: 1920x1080, encoding: mjpeg, JPEG Video Capture
<notice> [driver] Framerate max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<notice> [core] Device detected!
<warning> [core] Cannot create /dev/video0 because file already exists
<notice> [core] Registering device node /dev/video1
root@pi:/etc/motion# LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c ./motion.conf
[24151880] Processing thread 0 - config file ./motion.conf
[24151880] Motion 3.2.12 Started
[24151880] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[0] Thread 1 is from ./motion.conf
[1] Thread 1 started
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] cap.driver: "raspicam"
[1] cap.card: "Camera Board OV5647"
[1] cap.bus_info: "CSI"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette YU12 (1280x720)
[1] Using palette YU12 (1280x720) bytesperlines 1920 sizeimage 1382400 colorspace 00000000
[1] found control 0x00980900, "brightness", range 0,100
[1]     "brightness", default 50, current 50
[1] found control 0x00980901, "contrast", range -100,100
[1]     "contrast", default 0, current 0
[1] found control 0x00980902, "saturation", range -100,100
[1]     "saturation", default 0, current 0
[1] found control 0x0098090e, "red balance", range 0,800
[1]     "red balance", default 100, current 100
[1] found control 0x0098090f, "blue balance", range 0,800
[1]     "blue balance", default 100, current 100
[1] found control 0x08000000, "shutter speed", range 0,65535
[1]     "shutter speed", default 0, current 0
[1] found control 0x08000001, "zoom factor", range 1,8
[1]     "zoom factor", default 0, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=1382400
[1] 1 length=1382400
[1] 2 length=1382400
[1] 3 length=1382400
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] Started stream webcam server in port 8081
[1] Resizing pre_capture buffer to 3 items
^C[1] Thread exiting
[1] Calling vid_close() from motion_cleanup
[1] Closing video device /dev/video0
^C[0] httpd - Finishing
[0] httpd Closing
[0] httpd thread exit
[0] Motion terminating
root@pi:/etc/motion#
The only strange thing to me was that it registered device node /dev/video1 but at termination closes /dev/video0. If this is the error, then i have no clue how to fix it.

Following relevant packages are installed:

Code: Select all

root@pi:~# dpkg -l | grep v4l
ii  uv4l                            1.9.9                                   armhf        User space Video4Linux Framework Core
ii  uv4l-raspicam                   1.9.32                                  armhf        CSI Camera Board driver for Raspberry Pi.
ii  uv4l-raspicam-extras            1.13                                    armhf        Extras for the CSI Camera Board driver for Raspberry Pi.

root@pi:~# dpkg -l | grep motion
ii  motion                          3.2.12-3.4                              armhf        V4L capture program supporting motion detection
root@pi:~#

System Information (RPi 2):

Code: Select all

root@pi:~# cat /etc/*-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

root@pi:~# uname -a
Linux pi 4.1.15-v7+ #830 SMP Tue Dec 15 17:02:45 GMT 2015 armv7l GNU/Linux
Any clues how i can get motion to work?

Regards

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Thu Dec 17, 2015 9:43 am

Zombievirus wrote:installed uv4l including raspicam-extras as stated here
uv4l-raspicam-extras installs a service which loads uv4l at boot.
Zombievirus wrote:

Code: Select all

root@pi:/etc/motion# uv4l --driver raspicam --auto-video_nr
<warning> [core] Cannot create /dev/video0 because file already exists
<notice> [core] Registering device node /dev/video1
Then at this point you probably have two instances of uv4l running, one on /dev/video0 created by the service and one on /dev/video1 from the command above.
Zombievirus wrote: root@pi:/etc/motion# LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c ./motion.conf

The only strange thing to me was that it registered device node /dev/video1 but at termination closes /dev/video0. If this is the error, then i have no clue how to fix it.
motion uses the /dev/videoX entry specified in motion.conf, which is /dev/video0 apparently.

Zombievirus
Posts: 19
Joined: Sun Sep 20, 2015 5:44 am

Re: Video4Linux2 driver ready!

Thu Dec 17, 2015 11:34 am

Hmm..

made sure that only video0 is there and no video1 is created.
edited the uv4l-raspicam.conf file to add extension-presence = 1

Code: Select all

##################################
# uv4l core options
##################################

driver = raspicam
# video_nr = 0
auto-video_nr = yes
# verbosity = 6
# syslog-host = localhost
# syslog-port = 514
# frame-timeout = 5000
frame-buffers = 4
# drop-bad-frames = yes
# relaxed-ownership = yes
extension-presence = 1
restarted the driver

Code: Select all

root@pi:~# service uv4l_raspicam restart
[....] Starting UV4L Raspberry CSI Camera Driver: uv4l
<notice> [core] Trying driver 'raspicam' from built-in drivers...
<warning> [core] Driver 'raspicam' not found
<notice> [core] Trying driver 'raspicam' from external plug-in's...
<notice> [driver] Dual Raspicam Video4Linux2 Driver v1.9.32 built Sep 16 2015
<notice> [driver] Selected format: 1920x1080, encoding: mjpeg, JPEG Video Capture
<notice> [driver] Framerate max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0

started motion, webpreview (port 8081) working but still no motion detected..

Code: Select all

root@pi:~# LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so motion -c /etc/motion/motion.conf
[24823624] Processing thread 0 - config file /etc/motion/motion.conf
[24823624] Motion 3.2.12 Started
[24823624] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[0] Thread 1 is from /etc/motion/motion.conf
[1] Thread 1 started
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] cap.driver: "raspicam"
[1] cap.card: "Camera Board OV5647"
[1] cap.bus_info: "CSI"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette YU12 (1280x720)
[1] Using palette YU12 (1280x720) bytesperlines 1920 sizeimage 1382400 colorspace 00000000
[1] found control 0x00980900, "brightness", range 0,100
[1]     "brightness", default 50, current 50
[1] found control 0x00980901, "contrast", range -100,100
[1]     "contrast", default 0, current 0
[1] found control 0x00980902, "saturation", range -100,100
[1]     "saturation", default 0, current 0
[1] found control 0x0098090e, "red balance", range 0,800
[1]     "red balance", default 100, current 100
[1] found control 0x0098090f, "blue balance", range 0,800
[1]     "blue balance", default 100, current 100
[1] found control 0x08000000, "shutter speed", range 0,65535
[1]     "shutter speed", default 0, current 0
[1] found control 0x08000001, "zoom factor", range 1,8
[1]     "zoom factor", default 0, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=1382400
[1] 1 length=1382400
[1] 2 length=1382400
[1] 3 length=1382400
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] Started stream webcam server in port 8081
[1] Resizing pre_capture buffer to 3 items
environment file looks like this:

Code: Select all

root@pi:/etc# cat environment
LD_PRELOAD=:/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
any suggestions?

Thanks

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Thu Dec 17, 2015 2:03 pm

Zombievirus wrote: started motion, webpreview (port 8081) working but still no motion detected..
I can only assure you that the driver has nothing to do with the motion detection itself.. if there's a problem, then it's not at driver level.

Hassinz
Posts: 4
Joined: Thu Dec 17, 2015 7:14 pm

Re: Video4Linux2 driver ready!

Thu Dec 17, 2015 7:35 pm

@RpiName, so the thing is , i m trying to use webrtc outside the local network , we talked before (on youtube) and i tried to enable the internal stun and adding a turn server ... but still nat blocking it , here s something i found ; now when i tried to use the internal stun ofc i forwarded 3478 and 8080 but the problem i think in these 2 ports shown in the picture ; they keep changing randomly (apparently from the negotiations ....) ergo i cant forward em to get it to work ; so how can we work arround this ?(the more detail the better i m not really an expert when it comes to webrtc)
http://prntscr.com/9fe8vs

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Fri Dec 18, 2015 2:02 pm

Hassinz wrote:when i tried to use the internal stun ofc i forwarded 3478 and 8080 but the problem i think in these 2 ports shown in the picture ; they keep changing randomly (apparently from the negotiations ....) ergo i cant forward em to get it to work ; so how can we work arround this ?(the more detail the better i m not really an expert when it comes to webrtc)
http://prntscr.com/9fe8vs
Please describe your network topology, the kind of NAT's in place (if you know this), and also give the public and private IP's of the hosts involved.

Hassinz
Posts: 4
Joined: Thu Dec 17, 2015 7:14 pm

Re: Video4Linux2 driver ready!

Mon Dec 21, 2015 12:04 pm

i was wondering if anyone tried to build a native android or ios app that works with uv4l webrtc extension (a mobile app that calls the Pi) maybe share some pointers , i d really like to make one and i ve no idea on where to start (i tried to use webview ... but unfortunately it doesnt support webrtc)

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Mon Dec 21, 2015 1:25 pm

Hassinz wrote:i was wondering if anyone tried to build a native android or ios app that works with uv4l webrtc extension (a mobile app that calls the Pi) maybe share some pointers , i d really like to make one and i ve no idea on where to start (i tried to use webview ... but unfortunately it doesnt support webrtc)
Why native? What features would you like to have in such an application?

Hassinz
Posts: 4
Joined: Thu Dec 17, 2015 7:14 pm

Re: Video4Linux2 driver ready!

Tue Dec 22, 2015 1:54 pm

RpiName wrote:
Hassinz wrote:i was wondering if anyone tried to build a native android or ios app that works with uv4l webrtc extension (a mobile app that calls the Pi) maybe share some pointers , i d really like to make one and i ve no idea on where to start (i tried to use webview ... but unfortunately it doesnt support webrtc)
Why native? What features would you like to have in such an application?
well i d like to be able lets say call the pi and also pass IoT commands through the same app as well (if not native u ve any other ideas ?)

RpiName
Posts: 624
Joined: Sat Jul 06, 2013 3:14 am

Re: Video4Linux2 driver ready!

Tue Dec 22, 2015 2:25 pm

Hassinz wrote:well i d like to be able lets say call the pi and also pass IoT commands through the same app as well (if not native u ve any other ideas ?)
If by call you mean something like having p2p two-way audio/video conferences from an android phone, for example, to the raspberry, this is already possible, just open chrome for android, connect to the UV4L server via HTTPS, open the streaming web page and, select "cast local camera" and click on the call button in the page, that's it. If you have an HDMI display connected and speakers to the Rpi2, you should hear and see the other interlocutor on the screen. Was not this possibility already evident (honest question)?

That said, more complex client apps can be developed in a few lines of JavaScript in any case, starting from the above streaming page as an example, e.g. copy the page source code, modify it as you wish and run this modified version on chrome. After all major browsers support the WebRTC Javascript API now (including data channels useful for the IoT). This is why I asked why one would really want to develop an application natively..

Hassinz
Posts: 4
Joined: Thu Dec 17, 2015 7:14 pm

Re: Video4Linux2 driver ready!

Tue Dec 22, 2015 3:06 pm

RpiName wrote:
If by call you mean something like having p2p two-way audio/video conferences from an android phone, for example, to the raspberry, this is already possible, just open chrome for android, connect to the UV4L server via HTTPS, open the streaming web page and, select "cast local camera" and click on the call button in the page, that's it. If you have an HDMI display connected and speakers to the Rpi2, you should hear and see the other interlocutor on the screen. Was not this possibility already evident (honest question)?

That said, more complex client apps can be developed in a few lines of JavaScript in any case, starting from the above streaming page as an example, e.g. copy the page source code, modify it as you wish and run this modified version on chrome. After all major browsers support the WebRTC Javascript API now (including data channels useful for the IoT). This is why I asked why one would really want to develop an application natively..
yes ofc that s obvious , but what i meant was actually integrate the webrtc feature in a native app instead of using chrome or firefox (js) , just to manage lets say user sessions and alot of other stuff that ll be much "beautiful" and sophisticated in an app , u know for example u can actually use skype on android using chrome but it s better using the app (more features ...)
so my idea is maybe to get some pointers on where to start to maybe develop an android SDK for uv4l ... (i ve alot of experience with mobile development but in this case (webrtc and voip in general) i got no idea where to start)

pumpkinpi
Posts: 131
Joined: Fri Apr 18, 2014 7:11 pm

Re: Video4Linux2 driver ready!

Sun Feb 28, 2016 3:43 pm

I just reinstalled this driver and am using motion with it. All the screenshots and video files have a large text overlay that says "software by linux-projects.org". Is there a way to remove this as it blocks key parts of the screen?

Thanks,

PPi

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 24 guests