question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RasPi V4L4J driver does not start for the second time

See original GitHub issue

This is in regards to V4L4J driver used on Raspberry Pi with CSI camera module.

At the first time driver works well, but every next run fails with the following stack trace and camera module power turned on.

[ libvideo.c:68 ] Using libvideo version 0.9-UNKNOWN
[ v4l2-query.c:49 ] Error looking up V4L2 format 34363248. Please submit
a bug report on the v4l4j mailing list.[ v4l2-query.c:484 ] libvideo has skipped an unsupported image format:
[ v4l2-query.c:485 ] H264 (0x34363248)
[ v4l2-query.c:486 ] Please let the author know about this error.
[ v4l2-query.c:487 ] See the ISSUES section in the libvideo README file.
Exception in thread "main" com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:72)
    at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:140)
    at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:46)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:302)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:251)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:236)
    at CalculateFPSExample.main(CalculateFPSExample.java:31)
Caused by: com.github.sarxos.webcam.WebcamException: au.edu.jcu.v4l4j.exceptions.V4L4JException: Error starting the capture
    at com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice.open(V4l4jDevice.java:350)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38)
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: au.edu.jcu.v4l4j.exceptions.V4L4JException: Error starting the capture
    at au.edu.jcu.v4l4j.AbstractGrabber.start(Native Method)
    at au.edu.jcu.v4l4j.AbstractGrabber.startCapture(AbstractGrabber.java:332)
    at com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice.open(V4l4jDevice.java:348)
    ... 5 more

And yet the next one:

[ libvideo.c:68 ] Using libvideo version 0.9-UNKNOWN
[ v4l2-query.c:49 ] Error looking up V4L2 format 34363248. Please submit
a bug report on the v4l4j mailing list.[ v4l2-query.c:484 ] libvideo has skipped an unsupported image format:
[ v4l2-query.c:485 ] H264 (0x34363248)
[ v4l2-query.c:486 ] Please let the author know about this error.
[ v4l2-query.c:487 ] See the ISSUES section in the libvideo README file.
Invalid argument
[ v4l2-input.c:405 ] Unable to set the palette: MJPEG
[ v4l2-input.c:406 ] Please let the author know about this error.
[ v4l2-input.c:407 ] See the ISSUES section in the libvideo README file.
[ v4l2-input.c:606 ] Listing the reported capabilities:
============================================
Querying general capabilities

Driver name: bm2835 mmal
Device name: mmal service -1.-684392064
bus_info: platform:bcm2835-v4l2
version: 3.18.7
Has capture capability
Does NOT have output capability
Has overlay capability
Does NOT have VBI capture capability
Does NOT have VBI output capability
Does NOT have SLICED VBI capture capability
Does NOT have SLICED VBI output capability
Does NOT have RDS capability
Does NOT have tuner capability
Does NOT have audio capability
Does NOT have radio capability
Has read/write capability
Does NOT have asyncIO capability
Has streaming capability

============================================
Querying capture capabilities
Input number: 0
Name: Camera 0
Type: (2) Camera
Supported standards: (0) 

============================================
Querying image format

0 - 4:2:0, packed YUV (compressed : 0) (0x32315559) 
1 - 4:2:2, packed, YUYV (compressed : 0) (0x56595559) 
2 - RGB24 (LE) (compressed : 0) (0x33424752) 
3 - JPEG (compressed : 1) (0x4745504a) 
4 - H264 (compressed : 1) (0x34363248) 
5 - MJPEG (compressed : 1) (0x47504a4d) 
6 - 4:2:2, packed, YVYU (compressed : 0) (0x55595659) 
7 - 4:2:2, packed, VYUY (compressed : 0) (0x59555956) 
8 - 4:2:2, packed, UYVY (compressed : 0) (0x59565955) 
9 - 4:2:0, packed, NV12 (compressed : 0) (0x3231564e) 
10 - RGB24 (BE) (compressed : 0) (0x33524742) 
11 - 4:2:0, packed YVU (compressed : 0) (0x32315659) 
12 - 4:2:0, packed, NV21 (compressed : 0) (0x3132564e) 
13 - RGB32 (BE) (compressed : 0) (0x34524742) 

============================================
Querying current image format settings

Current width: 320
Current height: 240
Current bytes per line: 320
Current image size: 81920
Current color space: 7
Current pixel format: MJPEG

============================================
Querying supported frame sizes

Image format: 4:2:0, packed YUV
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:2, packed, YUYV
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: RGB24 (LE)
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: JPEG
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: H264
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: MJPEG
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:2, packed, YVYU
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:2, packed, VYUY
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:2, packed, UYVY
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:0, packed, NV12
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: RGB24 (BE)
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:0, packed YVU
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: 4:2:0, packed, NV21
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2Image format: RGB32 (BE)
index 0 Min, max & step height: 16 - 1944 - 2 Min, max & stepwidth: 16 - 2592 - 2============================================
Querying standard controls

Control: id: 0x980900 - name: Brightness - min: 0 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980901 - name: Contrast - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980902 - name: Saturation - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98090e - name: Red Balance - min: 1 -max: 7999 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98090f - name: Blue Balance - min: 1 -max: 7999 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980914 - name: Horizontal Flip - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x980915 - name: Vertical Flip - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x980918 - name: Power Line Frequency - min: 0 -max: 3 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x98091b - name: Sharpness - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98091f - name: Color Effects - min: 0 -max: 15 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x980922 - name: Rotate - min: 0 -max: 360 - step: 90 - type: 1(Integer) - flags: 0 ()
Control: id: 0x98092a - name: Color Effects, CbCr - min: 0 -max: 65535 - step: 1 - type: 1(Integer) - flags: 0 ()
============================================
Querying private controls

============================================
Querying extended controls

Control: id: 0x980001 - name: User Controls - min: 0 -max: 0 - step: 0 - type: 6(Class) - flags: 68 (ReadOnly write-only)
Control: id: 0x980900 - name: Brightness - min: 0 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980901 - name: Contrast - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980902 - name: Saturation - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98090e - name: Red Balance - min: 1 -max: 7999 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98090f - name: Blue Balance - min: 1 -max: 7999 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x980914 - name: Horizontal Flip - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x980915 - name: Vertical Flip - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x980918 - name: Power Line Frequency - min: 0 -max: 3 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x98091b - name: Sharpness - min: -100 -max: 100 - step: 1 - type: 1(Integer) - flags: 32 (slider )
Control: id: 0x98091f - name: Color Effects - min: 0 -max: 15 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x980922 - name: Rotate - min: 0 -max: 360 - step: 90 - type: 1(Integer) - flags: 0 ()
Control: id: 0x98092a - name: Color Effects, CbCr - min: 0 -max: 65535 - step: 1 - type: 1(Integer) - flags: 0 ()
Control: id: 0x990001 - name: Codec Controls - min: 0 -max: 0 - step: 0 - type: 6(Class) - flags: 68 (ReadOnly write-only)
Control: id: 0x9909ce - name: Video Bitrate Mode - min: 0 -max: 1 - step: 1 - type: 3(Menu) - flags: 8 (Update )
Control: id: 0x9909cf - name: Video Bitrate - min: 25000 -max: 25000000 - step: 25000 - type: 1(Integer) - flags: 0 ()
Control: id: 0x9909e2 - name: Repeat Sequence Header - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x990a66 - name: H264 I-Frame Period - min: 0 -max: 2147483647 - step: 1 - type: 1(Integer) - flags: 0 ()
Control: id: 0x990a67 - name: H264 Level - min: 0 -max: 11 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x990a6b - name: H264 Profile - min: 0 -max: 4 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x9a0001 - name: Camera Controls - min: 0 -max: 0 - step: 0 - type: 6(Class) - flags: 68 (ReadOnly write-only)
Control: id: 0x9a0901 - name: Auto Exposure - min: 0 -max: 3 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x9a0902 - name: Exposure Time, Absolute - min: 1 -max: 10000 - step: 1 - type: 1(Integer) - flags: 0 ()
Control: id: 0x9a0903 - name: Exposure, Dynamic Framerate - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x9a0913 - name: Auto Exposure, Bias - min: 0 -max: 24 - step: 1 - type: 9(IntMenu) - flags: 0 ()
Control: id: 0x9a0914 - name: White Balance, Auto & Preset - min: 0 -max: 9 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x9a0916 - name: Image Stabilization - min: 0 -max: 1 - step: 1 - type: 2(Boolean) - flags: 0 ()
Control: id: 0x9a0917 - name: ISO Sensitivity - min: 0 -max: 4 - step: 1 - type: 9(IntMenu) - flags: 0 ()
Control: id: 0x9a0919 - name: Exposure, Metering Mode - min: 0 -max: 2 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x9a091a - name: Scene Mode - min: 0 -max: 13 - step: 1 - type: 3(Menu) - flags: 0 ()
Control: id: 0x9d0001 - name: JPEG Compression Controls - min: 0 -max: 0 - step: 0 - type: 6(Class) - flags: 68 (ReadOnly write-only)
Control: id: 0x9d0903 - name: Compression Quality - min: 1 -max: 100 - step: 1 - type: 1(Integer) - flags: 0 ()
Exception in thread "main" com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:72)
    at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:140)
    at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:46)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:302)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:251)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:236)
    at CalculateFPSExample.main(CalculateFPSExample.java:31)
Caused by: com.github.sarxos.webcam.WebcamException: au.edu.jcu.v4l4j.exceptions.ImageFormatException: Image format MJPEG not supported
    at com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice.open(V4l4jDevice.java:330)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38)
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: au.edu.jcu.v4l4j.exceptions.ImageFormatException: Image format MJPEG not supported
    at au.edu.jcu.v4l4j.AbstractGrabber.doInit(Native Method)
    at au.edu.jcu.v4l4j.AbstractGrabber.init(AbstractGrabber.java:189)
    at au.edu.jcu.v4l4j.JPEGFrameGrabber.init(JPEGFrameGrabber.java:105)
    at au.edu.jcu.v4l4j.VideoDevice.getJPEGFrameGrabber(VideoDevice.java:618)
    at com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice.open(V4l4jDevice.java:328)
    ... 5 more

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sarxoscommented, Nov 3, 2017

Hi @haoyun1129,

Here is the fork I used to build v4l4j JAR used by webcam capture driver:

https://github.com/sarxos/v4l4j

After you clone it into your local git repo, please replace these files with the ones you compiled on your RasPi:

https://github.com/sarxos/v4l4j/tree/master/src/main/resources/META-INF/native/linux-armhf

After this is done go to the repository root directory and run mvn clean install. This will create JAR in target directory. Just put this JAR in your application’s classpath and remove the old one beforehand.

That is all.

0reactions
yinhaoyuncommented, Nov 3, 2017

@sarxos I have download and built the v4l4j on my Pi but how to replace it in webcam-capture?

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Causes for a Raspberry Pi That Won't Boot (And How to Fix ...
Raspberry Pi won't boot? New Raspberry Pi 4 not booting, with no red or green lights? Try these Raspberry Pi troubleshooting tips.
Read more >
STICKY: Is your Pi not booting? (The Boot Problems Sticky)
Raspberry PI `s do not usually stop working for no reason: in the majority of cases, not booting points to an issue with...
Read more >
v4l4j - Google Groups
Re: The "Cant load v4l4j JNI library" error comes out when I run my own jar program with v4l4j inside. Try using java...
Read more >
R-Pi Troubleshooting - eLinux.org
Try with no cables connected except the USB power lead, and SD card inserted. You should see flashing of the OK light for...
Read more >
How to Run a Raspberry Pi Program on Startup
Run it with just the python command to make sure there are no problems ... we will show starting Python programs on boot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found