User avatar
jbeale
Posts: 3367
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Video4Linux2 driver ready!

Wed Sep 11, 2013 11:20 pm

vle wrote:Thanks, that solves part of the problem, but then I can't see the image without the preview. Is there a way that we can set the preview size not to be stretched out, not full screen?
I think this is relevant: from page 5 of the official RaspiCam Documentation at http://www.raspberrypi.org/wp-content/u ... tation.pdf

Common Command line Options - Preview Window
--preview, -p
Preview window settings <'x,y,w,h'>
Allows the user to define the size and location on the screen that the preview window will be placed. Note this will be superimposed over the top of any other windows/graphics.

--fullscreen, -f
Fullscreen preview mode
Forces the preview window to use the whole screen. Note that the aspect ratio of the incoming image will be retained, so there may be bars on some edges.

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

Re: Video4Linux2 driver ready!

Wed Sep 11, 2013 11:28 pm

vle wrote:Thanks, that solves part of the problem, but then I can't see the image without the preview. Is there a way that we can set the preview size not to be stretched out, not full screen?
try to set "--fullscreen=0" via command line

vle
Posts: 3
Joined: Wed Sep 11, 2013 8:47 am

Re: Video4Linux2 driver ready!

Thu Sep 12, 2013 12:27 am

That worked! Thanks.
How can I set the resolution of captured image using uv2l?

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

Re: Video4Linux2 driver ready!

Thu Sep 12, 2013 10:05 am

vle wrote: How can I set the resolution of captured image using uv2l?
You can use v4l2-ctl in v4l-utils to change the frame format/resolution once uv4l has been loaded:

Code: Select all

raspberrypi ~ $ sudo apt-get install v4l-utils
raspberrypi ~ $ v4l2-ctl --help

Maximus5684
Posts: 22
Joined: Sat Dec 15, 2012 8:38 am

Re: Video4Linux2 driver ready!

Fri Sep 13, 2013 5:02 am

Has anyone been able to make this work with yuv420 output into gstreamer-0.10 yet? I keep getting a blank preview and no frames being processed by gstreamer. After a few minutes of running like that, it gives me an error that the format could not be negotiated. Here is an example of the pipeline I'm using:

gst-launch-0.10 -v v4l2src device=/dev/video0 ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! autovideosink

marti
Posts: 2
Joined: Mon Jul 23, 2012 8:15 pm

Re: Video4Linux2 driver ready!

Thu Sep 19, 2013 11:23 pm

Would it be possible to add YUV422 (YUYV) encoding as well? I would really like to use this driver with CMvision, which uses the 4:2:2 format by default. Many webcams provide this format, e.g. Logitech C310, C910, QuickCam Pro 9000 and the PlayStation Eye Camera.

tiger79
Posts: 15
Joined: Mon Sep 09, 2013 8:49 am

Re: Video4Linux2 driver ready!

Wed Sep 25, 2013 12:27 pm

Hi,
I am trying to use the v4l2 driver according to the Example 3: HTTP Server with mjpg-streamer or vlc found in http://www.linux-projects.org/modules/s ... e&artid=16
I am actually following every single step to the letter, but unfortunately what happens is that I see the preview window continuesly switching in what seems to be another preview window which is less zoomed in.
Also when looking at the output stream the framerate is really really low (2-3 fps)...
Another thing that I noticed is that when I actually try the command u4vl -t to list the available drivers I get none in return :(
Anyone had these issues and has any idea on how to solve this ?

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

Re: Video4Linux2 driver ready!

Wed Sep 25, 2013 1:20 pm

tiger79 wrote:I am trying to use the v4l2 driver according to the Example 3: HTTP Server.
I see the preview window continuesly switching in what seems to be another preview window which is less zoomed in.
I don't exactly understand what is the effect and/or what you expect to see. Can you give a screenshot? Have you considered the --nopreview option?
tiger79 wrote: Also when looking at the output stream the framerate is really really low (2-3 fps)...
With mjpeg-streamer the framerate is low because continuos still JPEG captures are natively slow. While with VLC the bottleneck is the CPU, since VLC needs to convert the frames to JPEG, which is okay for resolutions up to 352x288 , where you can get about 10fps.

If you can, use a RTSP server (see example 6) instead for an higher framerate.
tiger79 wrote: Another thing that I noticed is that when I actually try the command u4vl -t to list the available drivers.
uv4l -t lists the drivers statically linked to the core module. It has nothing to do with the above issues, you don't need to use it at all.

tiger79
Posts: 15
Joined: Mon Sep 09, 2013 8:49 am

Re: Video4Linux2 driver ready!

Wed Sep 25, 2013 1:53 pm

I don't exactly understand what is the effect and/or what you expect to see. Can you give a screenshot? Have you considered the --nopreview option?
ok what it looks like is that there are two preview screens, #1 is shown, then it dissapears and #2 is shown (even though this one is "zoomed out" compared to #1, thus showing a broader picture), then #2 dissapears and #1 reappears... this keeps going on...
If I use the --nopreview option I actually just see one preview screen but not continuesly because this one seems to want to alternate like described before but because there is no second preview screen none is shown, resulting in preview screen #1 to be shown, that dissapers to simply show whatever was behind it, then reappears etc....
With mjpeg-streamer the framerate is low because continuos still JPEG captures are natively slow. While with VLC the bottleneck is the CPU, since VLC needs to convert the frames to JPEG, which is okay for resolutions up to 352x288 , where you can get about 10fps.

If you can, use a RTSP server (see example 6) instead for an higher framerate.
Ok, my need is to stream a jmpeg stream... Before I tried the v4l-driver I have been playing with a modified mjpeg-streamer which has a raspicam.so input module (found that in this same forum), which resulted in about 12fps for 640x480 resolution....

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

Re: Video4Linux2 driver ready!

Wed Sep 25, 2013 2:21 pm

tiger79 wrote:
Ok, my need is to stream a jmpeg stream... Before I tried the v4l-driver I have been playing with a modified mjpeg-streamer which has a raspicam.so input module (found that in this same forum), which resulted in about 12fps for 640x480 resolution....
Is that plugin working for everyone now? If I remember well, someone reported some problems about frames getting "black" (underexposed?) after some time. Has been that improvement included in RaspiStill too?

tiger79
Posts: 15
Joined: Mon Sep 09, 2013 8:49 am

Re: Video4Linux2 driver ready!

Wed Sep 25, 2013 3:05 pm

no idea to be honest, I haven´t seen any b+ack frames on the other hand if I´m not mistaken that could happen after some time... I haven´t tested it very long...
My experience with this solution atm is that it also doesn´t work for everyone, in this case myself ;)

XAPBob
Posts: 91
Joined: Tue Jan 03, 2012 2:40 pm

Re: Video4Linux2 driver ready!

Thu Sep 26, 2013 11:32 am

Ah - I seem to have killed my pi...

Code: Select all

[email protected] ~ $ sudo aptitude install v4l-utils
The following NEW packages will be installed:
  libv4l-0{a} libv4lconvert0{a} v4l-utils
0 packages upgraded, 3 newly installed, 0 to remove and 3 not upgraded.
Need to get 265 kB of archives. After unpacking 701 kB will be used.
Do you want to continue? [Y/n/?]

Get: 1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libv4lconvert0 armhf 0.8.8-3 [92.7 kB]
Get: 2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libv4l-0 armhf 0.8.8-3 [54.9 kB]
Get: 3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main v4l-utils armhf 0.8.8-3 [117 kB]
Fetched 265 kB in 3s (69.9 kB/s)
Selecting previously unselected package libv4lconvert0:armhf.
(Reading database ... 64513 files and directories currently installed.)
Unpacking libv4lconvert0:armhf (from .../libv4lconvert0_0.8.8-3_armhf.deb) ...
dpkg: error processing /var/cache/apt/archives/libv4lconvert0_0.8.8-3_armhf.deb (--unpack):E: Sub-process /usr/bin/dpkg returned an error code (2)
_::false_, NoBackupFlag, Which*, step0*) [with Which = mpl_::int_<0>, step0 = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<2l>, aptitude::views::download_progress::file_progress, boost::mpl::l_item<mpl_::long_<1l>, std::basic_string<char>, boost::mpl::l_end> > >, boost::mpl::l_nt::decref()
sh: 1: Syntax error: redirection unexpected
[email protected] ~ $ sudo aptitude install v4l-utils
Segmentation fault
[email protected] ~ $ sudo aptitude
Segmentation fault
[email protected] ~ $ sudo apt-get
Segmentation fault
[email protected] ~ $ ls
Segmentation fault
[email protected] ~ $ df -h
Segmentation fault
[email protected] ~ $ sudo reboot
Segmentation fault
[email protected] ~ $
I have *no* idea what's triggered that, and I can't investigate further for a while, since my Pi is at home, and I am not :(

Completely dead - reimaged card.
Hmm - as simliar has happened again I'm starting to suspect the card :(

jhfelectric
Posts: 6
Joined: Mon Sep 30, 2013 5:35 am

Re: Video4Linux2 driver ready!

Mon Sep 30, 2013 5:40 am

Hi RpiName,
Thx a lot for your hard work on the raspicam driver. For me it works !
About low exposure or black image, I have noticed that the pi cam needed at least 10 seconds to 'warm up' (?).
I have created a simple program to test this:

Code: Select all

imgs = []
for i in range(1,10):
    imgs.append(cam.get_image())
i = 1   
for img in imgs:    
    pygame.image.save(img,'image_' + str(i) + '.jpeg')
    i += 1
Running this, you'll notice that the overall 'darkness' of images goes decrescendo.
Do you think this has something to do with uv4l ?
Thx

lingon
Posts: 115
Joined: Fri Aug 26, 2011 7:31 am

Re: Video4Linux2 driver ready!

Sat Oct 05, 2013 2:35 pm

This v4l driver seems to work nicely, so thanks for developing it!
How can one get the full field of view from the camera with this driver?

atfxann
Posts: 4
Joined: Sun Oct 20, 2013 3:45 pm

Re: Video4Linux2 driver ready!

Sun Oct 20, 2013 3:56 pm

Hi all!

I've the same problem than Lingon.
I try to get pictures using OpenCV in C++.
The problem is that the pictures taken with uv4l are much more "zoomed in" than the pictures
i have taken with raspistill.
Does anyone know how to fix it? I need the full picture taken by the camera and not the zoomed picture.

Hope I was clear enough since my mothertongue isn't English!
Thx all for your help,
and thx for developping this great driver;)

bvo
Posts: 6
Joined: Mon Oct 29, 2012 2:37 pm

Re: Video4Linux2 driver ready!

Wed Oct 23, 2013 9:25 pm

Thank you for developing this driver.
I'm afraid it still does not work for me in python opencv:

the driver only returns 64 x 64 pixel tiles of the captured frame.
I tried this in ipython, using opencv 2.3 and the newest uv4l and uv4l-raspicam:

Code: Select all

In [1]: !uv4l --driver raspicam --auto-video_nr --encoding yuv420 --width 320 --height 240
<notice> [core] Trying driver 'raspicam'
<warning> [core] Driver not found
<notice> [core] Loading external library libraspicam.so
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.7 built Aug 18 2013
<notice> [driver] Selected format: 320x240, encoding: yuv420, YUV 4:2:0 Planar (I420), max. 30 fps
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0

In [2]: import cv2

In [3]: cam = cv2.VideoCapture(-1)

In [4]: success, img = cam.read()

In [5]: img.shape
Out[5]: (64, 64, 3)
On the other hand, the pygame.camera returns the whole frame. Did someone get this working in python opencv?

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

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 2:09 am

jhfelectric wrote: Running this, you'll notice that the overall 'darkness' of images goes decrescendo.
Do you think this has something to do with uv4l ?
Thx
That's probably due to some initial shutter calibration while capturing JPEGs in Still Mode. But since v1.8 the driver also supports Video MJPEG at high framerates.

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

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 2:14 am

tiger79 wrote: Also when looking at the output stream the framerate is really really low (2-3 fps)...
Since v1.8 the driver also supports MJPEG Video Streaming at high framerates (other than the continous JPEG Still Capture). You may want to try it out.

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

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 2:21 am

bvo wrote: I'm afraid it still does not work for me in python opencv:
On the other hand, the pygame.camera returns the whole frame
python opencv might be the culprit.. It's worth to look at the differences between pyopencv and pygame or python opencv and C++ opencv to see what really happens, as AFAIK the latters work.

jhfelectric
Posts: 6
Joined: Mon Sep 30, 2013 5:35 am

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 2:58 am

Hi RpiName,
I have just upgraded to v 1.8, but it was all working correctly and now I get

Code: Select all

SystemError: Cannot open '/dev/video0' : 4, Interrupted system call
Any clues ?
Thx for your help

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

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 3:36 am

jhfelectric wrote:Hi RpiName,

Code: Select all

SystemError: Cannot open '/dev/video0' : 4, Interrupted system call
How can I reproduce the problem exactly? Please give more details.

jhfelectric
Posts: 6
Joined: Mon Sep 30, 2013 5:35 am

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 7:20 am

RpiName wrote:
jhfelectric wrote:Hi RpiName,

Code: Select all

SystemError: Cannot open '/dev/video0' : 4, Interrupted system call
How can I reproduce the problem exactly? Please give more details.

Thx for your quick reply.
I have updated the driver following your instructions here : http://www.linux-projects.org/modules/s ... e&artid=14

I launch the driver using this : sudo uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0

Then I run :

Code: Select all

[email protected] ~ $  v4l2-ctl --list-ctrls --device /dev/video0
Failed to open /dev/video0: Interrupted system call
Thx
Julien

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

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 4:47 pm

jhfelectric wrote:I launch the driver using this : sudo uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0
Then I run :

Code: Select all

[email protected] ~ $  v4l2-ctl --list-ctrls --device /dev/video0
Failed to open /dev/video0: Interrupted system call
I don't see any problems. This is the output:

Code: Select all

[email protected] ~ $ sudo uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.8 built Oct 24 2013
<notice> [driver] Selected format: 800x600, encoding: jpeg, JPEG Still Capture, max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0

Code: Select all

[email protected] ~ $ v4l2-ctl --list-ctrls --device /dev/video0
                     brightness (int)    : min=0 max=100 step=1 default=50 value=50
                       contrast (int)    : min=-100 max=100 step=1 default=0 value=0
                     saturation (int)    : min=-100 max=100 step=1 default=0 value=0
                            iso (int)    : min=100 max=800 step=50 default=400 value=400
              horizontal_mirror (bool)   : default=0 value=0
                vertical_mirror (bool)   : default=0 value=0
                      sharpness (int)    : min=-100 max=100 step=1 default=0 value=0
                  shutter_speed (int)    : min=0 max=1000 step=1 default=0 value=0
                    zoom_factor (int)    : min=1 max=8 step=1 default=0 value=1

fabioc
Posts: 2
Joined: Thu Oct 24, 2013 8:52 pm

Re: Video4Linux2 driver ready!

Thu Oct 24, 2013 9:01 pm

I get the same error.

[email protected] ~ $ v4l2-ctl --list-ctrls --device /dev/video0
Failed to open /dev/video0: Interrupted system call

Same when using sudo.

Loaded driver with:

sudo uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0

Could I please have a link to the previous version of the driver to see whether this works?

Many thanks.

jhfelectric
Posts: 6
Joined: Mon Sep 30, 2013 5:35 am

Re: Video4Linux2 driver ready!

Fri Oct 25, 2013 12:08 am

I don't see any problems. This is the output:

Code: Select all

[email protected] ~ $ sudo uv4l --driver raspicam --auto-video_nr --width 800 --height 600 --encoding jpeg --quality 100 --nopreview --sched-rr --exposure verylong --output-buffers 0
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.8 built Oct 24 2013
<notice> [driver] Selected format: 800x600, encoding: jpeg, JPEG Still Capture, max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0
Hi Again and thx for your tests.
I used to get the same output. I have noticed that I now have this one (notice the 2 first lines):

Code: Select all

<notice> [core] Trying driver 'raspicam'
<warning> [core] Driver not found
<notice> [core] Loading external library libraspicam.so
<notice> [core] Trying driver 'raspicam'
<notice> [driver] Raspicam Video4Linux2 Driver v1.8 built Oct 24 2013
<notice> [driver] Selected format: 800x600, encoding: jpeg, JPEG Still Capture, max. 30 fps
<notice> [driver] ROI: 0, 0, 1, 1
<warning> [driver] NOTE: you might need to run the driver with a RealTime scheduling (--sched-rr), if you are going to use the (slow) Read I/O interface at high resolutions.
<notice> [core] Device detected!
<notice> [core] Registering device node /dev/video0
and when I run a simple command, I get this

Code: Select all

[email protected] ~ $ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1
dd: opening `/dev/video0': Interrupted system call
I am very sure I did nothing special for this to occur, the only fact that I upgraded the system and the driver has lead to this. Here is the log of the update (sorry for posting such a long message), maybe something will ring a bell...

Code: Select all

[email protected] ~ $ sudo apt-get update
Hit http://archive.raspberrypi.org wheezy Release.gpg
Hit http://archive.raspberrypi.org wheezy Release
Hit http://archive.raspberrypi.org wheezy/main armhf Packages
Ign http://archive.raspberrypi.org wheezy/main Translation-en_US
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Get:1 http://www.linux-projects.org wheezy Release.gpg [198 B]
Get:2 http://www.linux-projects.org wheezy Release [924 B]
Get:3 http://www.linux-projects.org wheezy/main armhf Packages [1,340 B]
Ign http://www.linux-projects.org wheezy/main Translation-en_US
Ign http://www.linux-projects.org wheezy/main Translation-en
Hit http://raspberrypi.collabora.com wheezy Release.gpg
Hit http://raspberrypi.collabora.com wheezy Release
Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en_US
Get:4 http://mirrordirector.raspbian.org wheezy Release.gpg [490 B]
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en
Get:5 http://mirrordirector.raspbian.org wheezy Release [14.4 kB]
Get:6 http://mirrordirector.raspbian.org wheezy/main armhf Packages [7,415 kB]
Get:7 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.3 kB]
Get:8 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [48.0 kB]
Hit http://mirrordirector.raspbian.org wheezy/rpi armhf Packages
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Fetched 7,504 kB in 1min 36s (77.7 kB/s)
Reading package lists... Done
[email protected] ~ $ sudo apt-get install uv4l uv4l-raspicam
Reading package lists... Done
Building dependency tree
Reading state information... Done
uv4l is already the newest version.
The following packages will be upgraded:
  uv4l-raspicam
1 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
Need to get 117 kB of archives.
After this operation, 28.7 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://www.linux-projects.org/listing/uv4l_repo/raspbian/ wheezy/main uv4l-raspicam armhf 1.8 [117 kB]
Fetched 117 kB in 4s (25.6 kB/s)
(Reading database ... 77085 files and directories currently installed.)
Preparing to replace uv4l-raspicam 1.7 (using .../uv4l-raspicam_1.8_armhf.deb) ...
Unpacking replacement uv4l-raspicam ...
Setting up uv4l-raspicam (1.8) ...
Thx again for your help
Julien

Return to “Camera board”