Access multiple stream concurrently

75 views
Skip to first unread message

aimaicai

unread,
Oct 11, 2011, 3:22:49 AM10/11/11
to v4l4j
Hi,
thank you for this great project! I'm using it with my PV-143 capture
card
( http://store.bluecherry.net/products/PV%252d143-%252d-4-port-video-capture-card-%2830FPS%29.html
). This is a pci card with 4 input for the cameras. With one camera it
works very well (in any channel), but I have some problems with 2
cameras at the same time. It throws a V4L4JException when I do the
"startCapture()" for the second FrameGrabber object. Can you help me?
Thanks

Roberto

aimaicai

unread,
Oct 11, 2011, 6:48:42 AM10/11/11
to v4l4j
Probably the problem is that it's impossible to get the frames
concurrently, but I have to access them in a multiplexing way, Doing
like this I make it work, but it's quite slow. So my new task is to
speed up the switching process from a channel to another.
Now I something like this:

frameGrabber.stopCapture();
videoDevice.releaseFrameGrabber();

#wait few milliseconds

frameGrabber=videoDevice.getJPEGFrameGrabber(...);
frameGrabber.setCaptureCallback(this);
frameGrabber.startCapture();

avoiding releaseFramegrabber don't save time...
I hope someone can help me... Now I'll try to check which line loose
more time than others.
Thanks

Roberto

aimaicai

unread,
Oct 11, 2011, 8:58:11 AM10/11/11
to v4l4j
after investigation I have that the switching process lies between 14
and 20 ms, so it's good. The laggy step is the receiving of the
"first" frame, that cost always 100-125 ms, against the normal 10-20
ms for the single flow.
What can I do??? Please help me!!!
Thanks

Roberto

Gilles Gigan

unread,
Oct 11, 2011, 6:28:20 PM10/11/11
to v4...@googlegroups.com
Hi Roberto,
I looked at the specs of the capture card you are using, and it has a
single bt878 chip, which means it can only capture from one video
source at a time.
I believe it is possible to obtain faster switching times (I remember
reading about this in the V4L specs) but as I dont have access to this
card, I ll have to rely on you to do the testing. Are you happy to do
that ?
Also, can you send the entire source code you used to measure the
switching times as reported in your last post ? It will help me
implement the switching feature in v4l4j.
Thanks
Gilles

> --
> You received this message because you are subscribed to the Google Groups "v4l4j" group.
> To post to this group, send email to v4...@googlegroups.com.
> To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.
>
>

aimaicai

unread,
Oct 12, 2011, 4:20:00 AM10/12/11
to v4l4j
Hi Gilles,
thank you for the reply and for help. My code is strongly based on the
example. I've extended it because I need to capture from all the 4
sources. It's just one file, maybe with some bug. The way I took the
times is very simple: I take a timestamp at the points of interest and
I subtract the one before... As I said before, the slowest point is
the coming of the first frame after the switching (every frame is the
first, because I always switch when comes a frame). I hope you can
help me, thanks! Now the code...

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

import au.edu.jcu.v4l4j.Control;
import au.edu.jcu.v4l4j.FrameGrabber;
import au.edu.jcu.v4l4j.CaptureCallback;
import au.edu.jcu.v4l4j.ImageFormat;
import au.edu.jcu.v4l4j.RawFrameGrabber;
import au.edu.jcu.v4l4j.V4L4JConstants;
import au.edu.jcu.v4l4j.VideoDevice;
import au.edu.jcu.v4l4j.VideoFrame;
import au.edu.jcu.v4l4j.exceptions.ControlException;
import au.edu.jcu.v4l4j.exceptions.NoTunerException;
import au.edu.jcu.v4l4j.exceptions.StateException;
import au.edu.jcu.v4l4j.exceptions.V4L4JException;

public class V4LCameraSwitch extends WindowAdapter implements
CaptureCallback
{
private static int DEFAULT_WIDTH=640;
private static int DEFAULT_HEIGHT=480;
private static final int
DEFAULT_FORMAT=V4L4JConstants.STANDARD_NTSC;
private static final String DEFAULT_DEVICE="/dev/video0";
private static final int DEFAULT_CHANNEL=0;
private static final int DEFAULT_JPEGQUALITY=90;
private static final int DEFAULT_CHANNELSNUMBER=1;

private VideoDevice videoDevice;
private FrameGrabber frameGrabber;

private int[] width;
private int[] height;
private String device;
private int channel;
private int format;
private int jpegQuality;
private BufferedImage[] lastFrames;
private long[] lastTimes;
private double[] fps;
private int currentChannel;
private int channelsNumber;
private JLabel[] labels;
private JFrame[] frames;

//timestamps for the calculation of times
long before;
long after;

public static void main(String args[])
{
int channels=2;

V4LCameraSwitch capture=new V4LCameraSwitch(channels);
boolean ok=capture.start();

if(ok)
for (;;)
{
for (int i=0; i<channels; i++)
{
capture.showFrame(i);

}

}

capture.stop();

}

public V4LCameraSwitch()
{
this(DEFAULT_DEVICE, DEFAULT_CHANNELSNUMBER, DEFAULT_FORMAT);

}

public V4LCameraSwitch(int channelsNumber)
{
this(DEFAULT_DEVICE, channelsNumber, DEFAULT_FORMAT);

}

public V4LCameraSwitch(String device)
{
this(device, DEFAULT_CHANNELSNUMBER, DEFAULT_FORMAT);

}

public V4LCameraSwitch(String device, int channelsNumber)
{
this(device, channelsNumber, DEFAULT_FORMAT);

}

public V4LCameraSwitch(String device, int channelsNumber, int
format)
{
this.channelsNumber=channelsNumber;
this.device=device;
this.format=format;
this.jpegQuality=DEFAULT_JPEGQUALITY;

this.lastFrames=new BufferedImage[this.channelsNumber];
this.lastTimes=new long[this.channelsNumber];
this.fps=new double[this.channelsNumber];
this.width=new int[this.channelsNumber];
this.height=new int[this.channelsNumber];

this.frames=new JFrame[this.channelsNumber];
this.labels=new JLabel[this.channelsNumber];

try
{
this.videoDevice = new VideoDevice(this.device);

}
catch (V4L4JException e)
{
e.printStackTrace();

}

}

/**
* Initialises the FrameGrabber object
* @throws V4L4JException if any parameter if invalid
*/
private void initFrameGrabber(int channel) throws
V4L4JException
{
// List<Control>
controls=this.videoDevice.getControlList().getList();
// for(Control c: controls)
// System.out.println("control name: "+c.getName()+" -
min: "+c.getMinValue()+" - max: "+c.getMaxValue()+" - step:
"+c.getStepValue()+" - value: "+c.getValue());
//
// this.videoDevice.releaseControlList();


this.frameGrabber=this.videoDevice.getJPEGFrameGrabber(DEFAULT_WIDTH,
DEFAULT_HEIGHT, channel, this.format, this.jpegQuality);
//
this.frameGrabber=this.videoDevice.getRGBFrameGrabber(this.width,
this.height, channel, this.format);
this.frameGrabber.setCaptureCallback(this);
this.width[channel]=this.frameGrabber.getWidth();
this.height[channel]=this.frameGrabber.getHeight();

if (this.frames[channel]==null)
{
this.initGUI(channel);

}

}

/**
* this method stops the capture and releases the frame
grabber and video device
*/

private boolean start()
{
try
{
// Initialise video device and frame grabber
try
{
this.initFrameGrabber(this.currentChannel);

}
catch (V4L4JException e1)
{
System.err.println("Error setting up capture");
e1.printStackTrace();

// cleanup and exit
this.stop();
return false;
}

this.frameGrabber.startCapture();
System.out.println("Starting capture at "+width
+"x"+height);
before=System.currentTimeMillis();

}
catch (V4L4JException e)
{
System.err.println("Error starting the capture");
e.printStackTrace();
return false;

}

return true;

}

private boolean switchChannel()
{
System.err.println("Leave from channel "+this.currentChannel);
this.currentChannel=(this.currentChannel+1)%this.channelsNumber;
System.err.println("Pass to channel "+this.currentChannel);

before=System.currentTimeMillis();
this.frameGrabber.stopCapture();
after=System.currentTimeMillis();
System.err.println("stopCapture->"+(after-before)+"ms");
before=after;
this.videoDevice.releaseFrameGrabber();
after=System.currentTimeMillis();
System.err.println("releaseFrameGrabber->"+(after-before)+"ms");
before=after;

//it seems to need a pause to work...
try
{
Thread.sleep(1);

}
catch (InterruptedException e)
{
// e.printStackTrace();

}

try
{
this.initFrameGrabber(this.currentChannel);
after=System.currentTimeMillis();
System.err.println("initFrameGrabber->"+(after-before)+"ms");
before=after;

this.frameGrabber.startCapture();
after=System.currentTimeMillis();
System.err.println("startCapture->"+(after-before)+"ms");
before=after;

}
catch (V4L4JException e)
{
e.printStackTrace();

}

return true;

}

private boolean stop()
{
try
{
this.frameGrabber.stopCapture();

}
catch (StateException ex)
{
// the frame grabber may be already stopped,
so we just ignore
// any exception and simply continue.

}

// release the frame grabber and video device
this.videoDevice.releaseFrameGrabber();
this.videoDevice.release();

return true;

}

/**
* Creates the UI components and initialises them
*/
public void initGUI(int i)
{
frames[i] = new JFrame();
labels[i] = new JLabel();
frames[i].getContentPane().add(labels[i]);
frames[i].setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frames[i].addWindowListener(this);
frames[i].setVisible(true);
frames[i].setSize(width[i], height[i]);


}

/**
* Catch window closing event so we can free up resources
before exiting
* @param e
*/
public void windowClosing(WindowEvent e) {
this.stop();

// close window
frames[0].dispose();
}

public void showFrame(int channel)
{
if (this.lastFrames[channel]!=null)

labels[channel].getGraphics().drawImage(this.lastFrames[channel], 0,
0, width[channel], height[channel], null);

}

public boolean setControlValue(String option, int value)
{
try
{

this.videoDevice.getControlList().getControl(option).setValue(value);

}
catch (ControlException e)
{
return false;

}

return true;

}

public int getControlValue(String option)
{
int value=-1;

try
{

value=this.videoDevice.getControlList().getControl(option).getValue();

}
catch (ControlException e)
{
return -1;

}

return value;

}

public double getFps(int channel)
{
return this.fps[channel];

}

private void updatedFps()
{
long newTime=System.currentTimeMillis();
long diff=newTime-this.lastTimes[this.currentChannel];
double fpsNew=100;
if (diff>0)
fpsNew=1000.0/diff;
this.lastTimes[this.currentChannel]=newTime;

//fps is the mean of the last 100 instant fpss

this.fps[this.currentChannel]=this.fps[this.currentChannel]*0.99+fpsNew*0.01;

System.out.println("fps["+this.currentChannel+"]:
"+this.fps[this.currentChannel]+" (current= "+fpsNew
+")");

}

@Override
public void exceptionReceived(V4L4JException e) {
// This method is called by v4l4j if an exception
// occurs while waiting for a new frame to be ready.
// The exception is available through e.getCause()
e.printStackTrace();
}

@Override
public void nextFrame(VideoFrame frame)
{
after=System.currentTimeMillis();
System.err.println("nextFrame->"+(after-before)+"ms");
before=after;
// This method is called when a new frame is ready.
// Don't forget to recycle it when done dealing with
the frame.
this.lastFrames[this.currentChannel]=frame.getBufferedImage();
frame.recycle();
after=System.currentTimeMillis();
System.err.println("recycle->"+(after-before)+"ms");
before=after;
this.updatedFps();
after=System.currentTimeMillis();
System.err.println("updatedFps->"+(after-before)+"ms");
before=after;
this.switchChannel();

}

public BufferedImage getFrame(int index)
{
return this.lastFrames[index];

Gilles Gigan

unread,
Oct 12, 2011, 5:52:03 AM10/12/11
to v4...@googlegroups.com
Roberto,
thanks for the code. Can you send me the output of "ant deviceInfo"
Gilles

aimaicai

unread,
Oct 12, 2011, 6:28:32 AM10/12/11
to v4l4j
Hi Gilles,
I face a problem with memory, so I would ask you if my switching
process could generate a memory leak problem, or if there's something
other to release (I just call the videoDevice.releaseFrameGrabber()
method).
Anyway, here is the output you asked me for:
deviceInfo:
[java] name: BT878 video (ProVideo PV143)
[java] Device file: /dev/video0
[java] Supported formats:
[java] GREY - 10 - no resolution information
[java] HI240 - 32 - no resolution information
[java] RGB555 - 2 - no resolution information
[java] RGB555 BE - 4 - no resolution information
[java] RGB565 - 3 - no resolution information
[java] RGB565 BE - 5 - no resolution information
[java] BGR24 - 6 - no resolution information
[java] BGR32 - 8 - no resolution information
[java] RGB32 - 9 - no resolution information
[java] YUYV - 18 - no resolution information
[java] YUYV - 18 - no resolution information
[java] UYVY - 21 - no resolution information
[java] YUV422P - 23 - no resolution information
[java] YUV420 - 31 - no resolution information
[java] YVU420 - 17 - no resolution information
[java] YUV411P - 24 - no resolution information
[java] YUV410 - 30 - no resolution information
[java] YVU410 - 16 - no resolution information
[java] Formats that can be RGB24-converted:
[java] BGR32 - 8 - no resolution information
[java] RGB32 - 9 - no resolution information
[java] BGR24 - 6 - no resolution information
[java] Formats that can be BGR24-converted:
[java] BGR24 - 6 - no resolution information
[java] Formats that can be YUV420-converted:
[java] YUV420 - 31 - no resolution information
[java] Formats that can be YVU420-converted:
[java] YVU420 - 17 - no resolution information
[java] Formats that can be JPEG-encoded:
[java] BGR24 - 6 - no resolution information
[java] BGR32 - 8 - no resolution information
[java] RGB32 - 9 - no resolution information
[java] YUYV - 18 - no resolution information
[java] YUYV - 18 - no resolution information
[java] UYVY - 21 - no resolution information
[java] YUV420 - 31 - no resolution information
[java] RGB24 - 7 - no resolution information
[java] Inputs:
[java] Name: Composite0
[java] Type: 2(Camera)
[java] Index: 0
[java] Supported standards:
[java] 1(PAL)
[java] 2(SECAM)
[java] 3(NTSC)
[java] Name: Composite1
[java] Type: 2(Camera)
[java] Index: 1
[java] Supported standards:
[java] 1(PAL)
[java] 2(SECAM)
[java] 3(NTSC)
[java] Name: Composite2
[java] Type: 2(Camera)
[java] Index: 2
[java] Supported standards:
[java] 1(PAL)
[java] 2(SECAM)
[java] 3(NTSC)
[java] Name: Composite3
[java] Type: 2(Camera)
[java] Index: 3
[java] Supported standards:
[java] 1(PAL)
[java] 2(SECAM)
[java] 3(NTSC)
[java] Control: Bass - min: 0 - max: 65535 - step: 655 - value: 0
[java] Control: Contrast - min: 0 - max: 65535 - step: 128 -
value: 32768
[java] Control: vcr hack - min: 0 - max: 1 - step: 1 - value: 0
[java] Control: Brightness - min: 0 - max: 65535 - step: 256 -
value: 32768
[java] Control: Treble - min: 0 - max: 65535 - step: 655 - value:
0
[java] Control: luma decimation filter - min: 0 - max: 1 - step:
1 - value: 0
[java] Control: combfilter - min: 0 - max: 1 - step: 1 - value: 0
[java] Control: full luma range - min: 0 - max: 1 - step: 1 -
value: 0
[java] Control: Hue - min: 0 - max: 65535 - step: 256 - value:
32768
[java] Control: Mute - min: 0 - max: 1 - step: 1 - value: 0
[java] Control: Balance - min: 0 - max: 65535 - step: 655 -
value: 0
[java] Control: Saturation - min: 0 - max: 65535 - step: 128 -
value: 32768
[java] Control: uv ratio - min: 0 - max: 100 - step: 1 - value:
50
[java] Control: whitecrush upper - min: 0 - max: 255 - step: 1 -
value: 207
[java] Control: chroma agc - min: 0 - max: 1 - step: 1 - value: 0
[java] Control: coring - min: 0 - max: 3 - step: 1 - value: 0
[java] Control: whitecrush lower - min: 0 - max: 255 - step: 1 -
value: 127
[java] Control: automute - min: 0 - max: 1 - step: 1 - value: 1
[java] Control: agc crush - min: 0 - max: 1 - step: 1 - value: 1
[java] [ libvideo.c:68 ] Using libvideo version 0.8-libvideo_r334
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 12, 2011, 6:48:53 AM10/12/11
to v4...@googlegroups.com
Roberto,
I didnt look closely at your code, but I saw one problem: in the
CaptureCallback.nextFrame() method, you recycle the video frame, even
though you have generated a BufferedImage and leaked a reference to
it. But more importantly, in your case, you immediately stop the
capture (from the callback method), which unmaps the buffers. And if
they are accessed after being unmapped (through the BufferedImage ref
you leaked), bad things will happen :). What you should do is create
the BufferedImage, use it and then recycle the frame, then stop the
capture and switch to the next input. Otherwise, the memory use by the
BufferedImage (which is mmap()'ed in the kernel) can be reused by the
driver to store a new frame, while it is being used in your app.
Thanks for the device info. I will create a special branch to work on
your issue, and will let you know when I have something ready for
testing.
Gilles

aimaicai

unread,
Oct 12, 2011, 10:49:43 AM10/12/11
to v4l4j
Hi Gilles,
thanks for the suggestion, but I think I can't follow it... Let me
explain: my application has to provide to other threads the last frame
of a channel. So I must keep that BufferedImage untill a newer comes.
Anyway, commenting the "this.switchChannel();" line, and so working
with the same channel, gives no problem (and non memory raising). I
even try to remove some lines from my switchChannel method, but every
line is necessary for the continuing of the flow.
Thank you for the new branch! So do you know if v4l provide a fast way
to switch channel?

Roberto

On 12 Ott, 12:48, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> ...
>
> leggi tutto

aimaicai

unread,
Oct 14, 2011, 11:38:58 AM10/14/11
to v4l4j
Hi Gilles,
any news?
Thanks

Roberto
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 15, 2011, 2:47:15 AM10/15/11
to v4...@googlegroups.com
Roberto,
I have a fix ready for you to test:
- uninstall the current version of v4l4j you have installed,
- check out the switch-input branch at
http://v4l4j.googlecode.com/svn/v4l4j/branches/switch-input
- ant clean all
- sudo ant install
- ant test-simpleViewer

this app will capture 5 frames from input 0, then 5 frames from input
1, then back to input 0 and so on.

Let me know how you go.

About your question on the captured frames and when to recycle them:
Once you call VideoFrame.recycle(), you cannot use that video frame
again, or any BufferedImage, byte[], DataBuffer or Rater object you
obtain from this video frame or you will end up crashing the JVM (in
most cases). If you need to pass the video and hang on to it, that's
fine, but make sure you recycle it when you no longer need it.
Otherwise, the driver will not have any empty buffers where it can
store new captured frames.
Hope this helps.
Gilles

aimaicai

unread,
Oct 17, 2011, 4:26:26 AM10/17/11
to v4l4j
Hi Gilles,
I have some problem with the installing of the branch. This is the
output for the "sudo ant install" command:

aimaicai@Dante:~/Scrivania/roba/prova/v4l4j$ sudo ant install
[sudo] password for aimaicai:
Buildfile: /home/aimaicai/Scrivania/roba/prova/v4l4j/build.xml

install-libvideo:
[exec] make: ingresso nella directory "/home/aimaicai/Scrivania/
roba/prova/v4l4j/libvideo"
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o
libvideo.o libvideo.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o pwc-
probe.o pwc-probe.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o gspca-
probe.o gspca-probe.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o qc-
probe.o qc-probe.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o fps-
param-probe.o fps-param-probe.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o v4l1-
query.o v4l1-query.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o v4l2-
query.o v4l2-query.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o v4l1-
tuner.o v4l1-tuner.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o v4l2-
tuner.o v4l2-tuner.c
[exec] gcc -DVER_MAJ=0 -DVER_MIN=8 -O3 -fPIC -I. -c -o
palettes.o palettes.c
[exec] LINKTYPE=static LIBDIR=/usr/lib/v4l4j \
[exec] make -C libv4lconvert
[exec] make[1]: ingresso nella directory "/home/aimaicai/
Scrivania/roba/prova/v4l4j/libvideo/libv4lconvert"
[exec] cc -Wp,-MMD,"libv4lconvert.d",-MQ,"libv4lconvert.o",-MP -c
-I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o libv4lconvert.o
libv4lconvert.c
[exec] cc -Wp,-MMD,"tinyjpeg.d",-MQ,"tinyjpeg.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o tinyjpeg.o tinyjpeg.c
[exec] cc -Wp,-MMD,"sn9c10x.d",-MQ,"sn9c10x.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o sn9c10x.o sn9c10x.c
[exec] cc -Wp,-MMD,"sn9c20x.d",-MQ,"sn9c20x.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o sn9c20x.o sn9c20x.c
[exec] cc -Wp,-MMD,"pac207.d",-MQ,"pac207.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o pac207.o pac207.c
[exec] cc -Wp,-MMD,"mr97310a.d",-MQ,"mr97310a.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o mr97310a.o mr97310a.c
[exec] cc -Wp,-MMD,"flip.d",-MQ,"flip.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o flip.o flip.c
[exec] cc -Wp,-MMD,"crop.d",-MQ,"crop.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o crop.o crop.c
[exec] cc -Wp,-MMD,"jidctflt.d",-MQ,"jidctflt.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o jidctflt.o jidctflt.c
[exec] cc -Wp,-MMD,"spca561-decompress.d",-MQ,"spca561-
decompress.o",-MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/
local/lib\" -DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -
O1 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o
spca561-decompress.o spca561-decompress.c
[exec] cc -Wp,-MMD,"rgbyuv.d",-MQ,"rgbyuv.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o rgbyuv.o rgbyuv.c
[exec] cc -Wp,-MMD,"sn9c2028-decomp.d",-MQ,"sn9c2028-decomp.o",-
MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -
DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -
Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o sn9c2028-
decomp.o sn9c2028-decomp.c
[exec] cc -Wp,-MMD,"spca501.d",-MQ,"spca501.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o spca501.o spca501.c
[exec] cc -Wp,-MMD,"sq905c.d",-MQ,"sq905c.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o sq905c.o sq905c.c
[exec] cc -Wp,-MMD,"bayer.d",-MQ,"bayer.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o bayer.o bayer.c
[exec] cc -Wp,-MMD,"hm12.d",-MQ,"hm12.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o hm12.o hm12.c
[exec] cc -Wp,-MMD,"stv0680.d",-MQ,"stv0680.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o stv0680.o stv0680.c
[exec] cc -Wp,-MMD,"cpia1.d",-MQ,"cpia1.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o cpia1.o cpia1.c
[exec] cc -Wp,-MMD,"control/libv4lcontrol.d",-MQ,"control/
libv4lcontrol.o",-MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/
local/lib\" -DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -
O1 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o
control/libv4lcontrol.o control/libv4lcontrol.c
[exec] control/libv4lcontrol.c: In function ‘v4lcontrol_create’:
[exec] control/libv4lcontrol.c:737: warning: ignoring return
value of ‘ftruncate’, declared with attribute warn_unused_result
[exec] cc -Wp,-MMD,"processing/libv4lprocessing.d",-
MQ,"processing/libv4lprocessing.o",-MP -c -I.. -fvisibility=hidden -
fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=\"libv4l\" -I../../
include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -o processing/libv4lprocessing.o processing/
libv4lprocessing.c
[exec] cc -Wp,-MMD,"processing/whitebalance.d",-MQ,"processing/
whitebalance.o",-MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/
local/lib\" -DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -
O1 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o
processing/whitebalance.o processing/whitebalance.c
[exec] cc -Wp,-MMD,"processing/autogain.d",-MQ,"processing/
autogain.o",-MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/
local/lib\" -DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -
O1 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o
processing/autogain.o processing/autogain.c
[exec] cc -Wp,-MMD,"processing/gamma.d",-MQ,"processing/gamma.o",-
MP -c -I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -
DLIBSUBDIR=\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -
Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o processing/
gamma.o processing/gamma.c
[exec] cc -Wp,-MMD,"helper.d",-MQ,"helper.o",-MP -c -I.. -
fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o helper.o helper.c
[exec] ar cqs libv4lconvert.a libv4lconvert.o tinyjpeg.o
sn9c10x.o sn9c20x.o pac207.o mr97310a.o flip.o crop.o jidctflt.o
spca561-decompress.o rgbyuv.o sn9c2028-decomp.o spca501.o sq905c.o
bayer.o hm12.o stv0680.o cpia1.o control/libv4lcontrol.o processing/
libv4lprocessing.o processing/whitebalance.o processing/autogain.o
processing/gamma.o helper.o
[exec] cc -Wp,-MMD,"ov511-decomp.d",-MQ,"ov511-decomp.o",-MP -c -
I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o ov511-decomp.o ov511-
decomp.c
[exec] cc ov511-decomp.o -o ov511-decomp
[exec] cc -Wp,-MMD,"ov518-decomp.d",-MQ,"ov518-decomp.o",-MP -c -
I.. -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/local/lib\" -DLIBSUBDIR=
\"libv4l\" -I../../include -D_GNU_SOURCE -g -O1 -Wall -Wpointer-arith -
Wstrict-prototypes -Wmissing-prototypes -o ov518-decomp.o ov518-
decomp.c
[exec] cc ov518-decomp.o -o ov518-decomp
[exec] make[1]: uscita dalla directory "/home/aimaicai/Scrivania/
roba/prova/v4l4j/libvideo/libv4lconvert"
[exec] cp libv4lconvert/libv4lconvert.a .
[exec] gcc v4l2-input.o v4l1-input.o libvideo.o pwc-probe.o gspca-
probe.o qc-probe.o fps-param-probe.o v4l1-query.o v4l2-query.o v4l1-
tuner.o v4l2-tuner.o palettes.o libv4lconvert.a -Wl,-
soname,libvideo.so.0 \
[exec] -lm -lrt -shared -o libvideo.so.0
[exec] ln -f -s libvideo.so.0 libvideo.so
[exec] mkdir -p /usr/include
[exec] install -p -m 644 libvideo.h libvideo-err.h libvideo-
palettes.h /usr/include
[exec] mkdir -p /usr/lib
[exec] install -m 755 libvideo.so.0 /usr/lib
[exec] cd /usr/lib && ln -f -s libvideo.so.0 libvideo.so
[exec] mkdir -p /usr/lib/v4l4j/libv4l
[exec] install -m 755 libv4lconvert/*-decomp \
[exec] /usr/lib/v4l4j/libv4l
[exec] make: uscita dalla directory "/home/aimaicai/Scrivania/
roba/prova/v4l4j/libvideo"

install-v4l4j:

BUILD FAILED
/home/aimaicai/Scrivania/roba/prova/v4l4j/build.xml:115: Warning:
Could not find file /home/aimaicai/Scrivania/roba/prova/v4l4j/
libv4l4j.so to copy.

I tried to search for it without success... Anyway, do you think that
with this improvement I could achieve faster switch time, and so
better fps for each input? I also tried last week to use directly v4l
from c++ with no good performances:
if I just change the input without closing anything, I achieve good
fps (4.5-5.5) but the frames are not good (one mixed with other).
Otherwise, if I close the capture, switch input and reopen the
capture, all is ok, but the fpss fall down to 1.5-1.8, like the ones I
obtained with your code and even worse (your more skilled than
me ;-) ). Also in this case, the most slow step, is the coming of the
new frame after the starting of the capture. Could it be impossible to
reduce it? I know that keeping 2 frames for each input I could almost
double the fps, but it would be not good for my application (I would a
constant flow).
Thank you very much for the time you're spending for me.

Roberto



On 15 Ott, 08:47, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> I have a fix ready for you to test:
> - uninstall the current version of v4l4j you have installed,
> - check out the switch-input branch athttp://v4l4j.googlecode.com/svn/v4l4j/branches/switch-input

Gilles Gigan

unread,
Oct 17, 2011, 7:36:04 AM10/17/11
to v4...@googlegroups.com

Hi Roberto,
Did you switch your working copy to the branch (what is the output of svn info? ). I don't have any issue compiling and installing v4l4j from that branch. Maybe try "ant clean all" then "sudo ant install" and see if this works.
About the fps, the card specs from the bluecherry website says you can expect 4-5 fps with 4 cameras...
Gilles

aimaicai

unread,
Oct 17, 2011, 9:52:18 AM10/17/11
to v4l4j
I've taken a look to the build.xml more closely (I never used ant
before...) and I notice that the "install" tag doesn't call either
directly, either indirectly the tag for compile libv4l4j.so and the
jar... So I just add these tags and bang! it compiles and install.
The app starts and switch trough inputs... but I notice the same
mixture as I told in my last post... About this I have a little update
from my adventure into v4l C code... I try to don't stop the capture
and switch the input, as before, but instead of taking the first frame
(the mixture), I wait for the second. Doing this I achieve better
performances (~2.5 fps). Unfortunally it persist the problem of the
mix of frames (not always, but 1 over 100 frames). Unfortunally^2 I
can't accept this, because I need to have stable and constant video
flow. If I discard 2 frames and take the 3rd, all is stable, but
framerate falls to 1.6 fps...
Thanks again

Roberto

On 17 Ott, 13:36, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Hi Roberto,
> Did you switch your working copy to the branch (what is the output of svn
> info? ). I don't have any issue compiling and installing v4l4j from that
> branch. Maybe try "ant clean all" then "sudo ant install" and see if this
> works.
> About the fps, the card specs from the bluecherry website says you can
> expect 4-5 fps with 4 cameras...
> Gilles
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 18, 2011, 2:00:44 AM10/18/11
to v4...@googlegroups.com
Roberto,
The install target does not depend on the build target because you
should not be using "sudo" when building v4l4j (or any other program
for that matter). You should be really using two commands: one to
build with normal user rights (ant clean all) and one to install with
admin rights (sudo ant install).
I am not too sure what you mean by "the problem of mix of frames" ...
Can you explain it ? For example, do you mean a single video frame
shows the top part from camera 1 and the bottom part from camera 2 ?
My feeling is that if you noticed the same behaviour in your C
application, it is most likely something outside v4l4j's control.
Gilles

aimaicai

unread,
Oct 20, 2011, 4:30:26 AM10/20/11
to v4l4j
Hi Gilles,
the sample gives me 2 type of mixture:
-as you said, the top part of the frame belongs to an input, and the
bottom to another;
-seldom I notice a superimposion of the 2 inputs.

I've got the same in my C project when I try to switch input without
restart capture, or without wait some time after the switching (~100
ms). If I go free, without waits, I have the 4-5 fps for each camera,
as the specs say, but the images are mixed. It seems like the grabber
need some time to reach a stable state. Do you know if it's possible
to know when a frame i fully loaded without mix?
Thanks

Roberto
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 21, 2011, 5:48:54 PM10/21/11
to v4...@googlegroups.com
Roberto,
There is one more thing I d like to explore. I noticed there is an
"input" field in struct v4l2_buffer, which according to the doc,
should be set by the application when queuing a buffer with
VIDIOC_QBUF to indicate which input to capture from (?) I guess.
I am making a few changes to use this field, and I ll let you know
when it s ready to test.
Gilles

Gilles Gigan

unread,
Oct 22, 2011, 1:28:58 AM10/22/11
to v4...@googlegroups.com
Roberto,
I have made changes so that struct v4l2_buffer->input is used instead
of ioctl(VIDIOC_S_INPUT) to change the current input. I am not sure
whether this is going to work, but it doesnt hurt to try.
Can you please update your copy, make sure you uninstall the current
version of v4l4j, then "ant clean all-debug", and "sudo ant install".
Test it with "ant test-simpleViewer". This will show 5 frames from
input 0, then 5 frames from input 1, if everything goes according to
plan.
Can you please send the output of "ant test-simpleViewer" (even if it works).
Thanks
Gilles

aimaicai

unread,
Oct 24, 2011, 3:42:50 AM10/24/11
to v4l4j
Hi Gilles,
it seems it doesn't work... it just show a frame, and freeze on it...
Anyway, the output is:

Buildfile: /home/aisac/Desktop/prove/branch2/v4l4j/build.xml

test-simpleViewer:
[java] Starting capture at 640x480
[java] [v4l4j_VideoDevice.c:37] [CALL] Entering
Java_au_edu_jcu_v4l4j_VideoDevice_doInit
[java] [v4l4j_VideoDevice.c:39] [MEMALLOC]: allocated 48 bytes of
type struct v4l4j_device * for var d (0x7f49bc019db0).
[java] [v4l4j_VideoDevice.c:42] [LIBVIDEO] Calling open_device()
[java] [ libvideo.c:68 ] Using libvideo version 0.8-libvideo_r344
dell'Ultimo
[java] [v4l2-input.c:54 check_capture_capabilities_v4l2] CAP:
Checking capture device
[java] [v4l4j_DeviceInfo.c:212] [CALL] Entering
Java_au_edu_jcu_v4l4j_DeviceInfo_getInfo
[java] [v4l4j_DeviceInfo.c:234] [LIBVIDEO] call to
get_device_info
[java] [v4l4j_DeviceInfo.c:242] [V4L4J] Creating inputInfo
objects
[java] [v4l4j_DeviceInfo.c:70] [CALL] Entering
create_inputs_object
[java] [v4l4j_DeviceInfo.c:132] [V4L4J] Setting new stds array
with array[3] @ 0x7f49bc01b480
[java] [v4l4j_DeviceInfo.c:139] [V4L4J] Creating input object (wo
tuner): name 'Composite0' - supported standards (3): 0x7f49bc01b480 -
index: 0
[java] [v4l4j_DeviceInfo.c:132] [V4L4J] Setting new stds array
with array[3] @ 0x7f49bc01b4a0
[java] [v4l4j_DeviceInfo.c:139] [V4L4J] Creating input object (wo
tuner): name 'Composite1' - supported standards (3): 0x7f49bc01b4a0 -
index: 1
[java] [v4l4j_DeviceInfo.c:132] [V4L4J] Setting new stds array
with array[3] @ 0x7f49bc002570
[java] [v4l4j_DeviceInfo.c:139] [V4L4J] Creating input object (wo
tuner): name 'Composite2' - supported standards (3): 0x7f49bc002570 -
index: 2
[java] [v4l4j_DeviceInfo.c:132] [V4L4J] Setting new stds array
with array[3] @ 0x7f49bc01b4c0
[java] [v4l4j_DeviceInfo.c:139] [V4L4J] Creating input object (wo
tuner): name 'Composite3' - supported standards (3): 0x7f49bc01b4c0 -
index: 3
[java] [v4l4j_DeviceInfo.c:246] [V4L4J] Creating Format objects
[java] [v4l4j_DeviceInfo.c:170] [CALL] Entering
create_formats_object
[java] [v4l4j_ImageFormatList.c:300] [CALL] Entering
Java_au_edu_jcu_v4l4j_ImageFormatList_listFormats
[java] [v4l4j_ImageFormatList.c:274] [V4L4J] Creating native
format list
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format GREY
- index: 10 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
HI240 - index: 32 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB555 - index: 2 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB555 BE - index: 4 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB565 - index: 3 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB565 BE - index: 5 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
BGR24 - index: 6 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
BGR32 - index: 8 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB32 - index: 9 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format YUYV
- index: 18 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format YUYV
- index: 18 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format UYVY
- index: 21 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YUV422P - index: 23 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YUV420 - index: 31 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YVU420 - index: 17 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YUV411P - index: 24 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YUV410 - index: 30 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
YVU410 - index: 16 - raw ? Yes-adding it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:282] [V4L4J] Checking format
RGB24 - index: 7 - raw ? No-skipping it
[java] [v4l4j_ImageFormatList.c:104] [V4L4J] Creating RGB
encodable format list
[java] [v4l4j_ImageFormatList.c:141] [V4L4J] Found v4l4j provided
RGB24 format from BGR32 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:141] [V4L4J] Found v4l4j provided
RGB24 format from RGB32 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:124] [V4L4J] Found libvideo-
converted RGB24 format from BGR24 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:160] [V4L4J] Creating BGR24
encodable format list
[java] [v4l4j_ImageFormatList.c:168] [V4L4J] Found native BGR24
format - adding it to list
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:198] [V4L4J] Creating YUV
encodable format list
[java] [v4l4j_ImageFormatList.c:206] [V4L4J] Found native YUV420
format - adding it to list
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:236] [V4L4J] Creating YVU
encodable format list
[java] [v4l4j_ImageFormatList.c:244] [V4L4J] Found native YVU420
format - adding it to list
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:61] [V4L4J] Creating JPEG
encodable format list
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from BGR24 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from BGR32 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from RGB32 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from YUYV format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from YUYV format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from UYVY format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from YUV420 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_ImageFormatList.c:84] [V4L4J] Found v4l4j-
convertible JPEG format from RGB24 format - add it
[java] [v4l4j_ResolutionInfo.c:53] [CALL] Entering
Java_au_edu_jcu_v4l4j_ResolutionInfo_doGetType
[java] [v4l4j_ResolutionInfo.c:64] [V4L4J] Returning resolution
of type 0 (unsupported)
[java] [v4l4j_VideoDevice.c:263] [CALL] Entering
Java_au_edu_jcu_v4l4j_VideoDevice_doGetTunerActions
[java] [v4l4j_VideoDevice.c:266] [LIBVIDEO] Calling
get_tuner_actions()
[java] [v4l4j_FrameGrabber.c:492] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_setQuality
[java] [v4l4j_FrameGrabber.c:365] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_doInit
[java] [v4l4j_FrameGrabber.c:305] [CALL] Entering
get_lastFrame_field_ids
[java] [v4l4j_FrameGrabber.c:379] [LIBVIDEO] Calling
init_capture_device()
[java] [v4l4j_FrameGrabber.c:235] [V4L4J] Setting output to JPEG
- input format: BGR24
[java] [v4l4j_FrameGrabber.c:242] [V4L4J] JPEG conversion done by
v4l4j
[java] [v4l4j_FrameGrabber.c:402] [V4L4J] input format: BGR24
[java] [v4l4j_FrameGrabber.c:404] [LIBVIDEO] calling
'set_cap_param'
[java] [v4l2-input.c:581 set_cap_param_v4l2] CAP: Setting capture
parameters on device /dev/video0.
[java] [ v4l2-input.c:155 ] The specified standard (0) is
invalid.
[java] [v4l2-input.c:113 detect_standard] Trying to autodetect
standard
[java] [ v4l2-input.c:122 ] Adjusted standard to PAL
[java] [v4l2-input.c:222 set_input] CAP: Setting input.
[java] [v4l2-input.c:384 set_image_format] [MEMALLOC]: allocating
208 bytes of type struct v4l2_format * for var c->convert->src_fmt
(0x7f49bc061400)
[java] [v4l2-input.c:385 set_image_format] [MEMALLOC]: allocating
208 bytes of type struct v4l2_format * for var c->convert->dst_fmt
(0x7f49bc0614e0)
[java] [v4l2-input.c:393 set_image_format] CAP: trying palettes
(1 to try in total)
[java] [v4l2-input.c:358 find_best_palette] CAP: trying palette
0x33524742 (BGR24) 640x480 - ...
[java] [v4l2-input.c:309 try_image_format] CAP: For dest palette
0x33524742 (BGR24 - 6) 640x480 - ...
[java] [v4l2-input.c:314 try_image_format] CAP: libv4lconvert
said to use palette 0x33524742 640x480 - ...
[java] [v4l2-input.c:320 try_image_format] CAP: which is libvideo
index 6, palette BGR24
[java] [v4l2-input.c:330 try_image_format] CAP: libv4lconvert
required ? No
[java] [v4l2-input.c:370 find_best_palette] CAP: palette (BGR24)
is best palette so far
[java] [v4l2-input.c:410 set_image_format] CAP: Setting to best
palette BGR24...
[java] [v4l2-input.c:309 try_image_format] CAP: For dest palette
0x33524742 (BGR24 - 6) 640x480 - ...
[java] [v4l2-input.c:314 try_image_format] CAP: libv4lconvert
said to use palette 0x33524742 640x480 - ...
[java] [v4l2-input.c:320 try_image_format] CAP: which is libvideo
index 6, palette BGR24
[java] [v4l2-input.c:330 try_image_format] CAP: libv4lconvert
required ? No
[java] [v4l2-input.c:248 apply_image_format] CAP: palette
0x33524742 - accepted at 640x480
[java] [v4l2-input.c:418 set_image_format] CAP: setting src
palette (BGR24) accepted
[java] [v4l2-input.c:438 set_image_format] CAP: capturing (src)
using width: 640, height: 480, bytes/line 1920, image size: 921600 -
palette: 6 (BGR24)
[java] [v4l2-input.c:443 set_image_format] CAP: libv4lconvert
required ? No
[java] [v4l2-input.c:454 set_image_format] CAP: conv to (dst)
width: 640, height: 480, bytes/line 1920, image size: 921600 -
palette: 6 (BGR24)
[java] [v4l4j_FrameGrabber.c:434] [LIBVIDEO] Calling
'init_capture(dev: /dev/video0)'
[java] [v4l2-input.c:640 init_capture_v4l2] CAP: Initialising
capture on device /dev/video0.
[java] [v4l2-input.c:650 init_capture_v4l2] CAP: asking for 4
V4L2 buffers
[java] [v4l2-input.c:659 init_capture_v4l2] CAP: driver said 4
V4L2 buffers
[java] [v4l2-input.c:662 init_capture_v4l2] [MEMALLOC]:
allocating 64 bytes of type struct mmap_buffer * for var c->mmap-
>buffers (0x7f49bc0615c0)
[java] [v4l2-input.c:693 init_capture_v4l2] CAP: mmap'ed 921600
bytes at 0x7f49c0b4d000
[java] [v4l2-input.c:693 init_capture_v4l2] CAP: mmap'ed 921600
bytes at 0x7f49c0a6c000
[java] [v4l2-input.c:693 init_capture_v4l2] CAP: mmap'ed 921600
bytes at 0x7f49c098b000
[java] [v4l2-input.c:693 init_capture_v4l2] CAP: mmap'ed 921600
bytes at 0x7f49c08aa000
[java] [v4l4j_FrameGrabber.c:173] [CALL] Entering
init_format_converter
[java] [v4l4j_FrameGrabber.c:178] [V4L4J] Initialising JPEG
converter
[java] [jpeg.c:473] [JPEG] Initialising the JPEG compressor
[java] [jpeg.c:474] [MEMALLOC]: allocated 32 bytes of type struct
jpeg_data * for var d->j (0x7f49bc061610).
[java] [jpeg.c:481] [MEMALLOC]: allocated 520 bytes of type
struct jpeg_compress_struct * for var d->j->cinfo (0x7f49bc061c40).
[java] [jpeg.c:482] [MEMALLOC]: allocated 168 bytes of type
struct jpeg_error_mgr * for var d->j->jerr (0x7f49bc061e50).
[java] [jpeg.c:483] [MEMALLOC]: allocated 40 bytes of type struct
jpeg_destination_mgr * for var d->j->destmgr (0x7f49bc061f00).
[java] [jpeg.c:530] [MEMALLOC]: allocated 1920 bytes of type
unsigned char * for var d->temp_conv_buffer (0x7f49bc06ab40).
[java] [jpeg.c:531] [JPEG] Setting jpeg compressor for BGR24
[java] [v4l4j_FrameGrabber.c:48] [CALL] Entering
update_width_height
[java] [v4l4j_FrameGrabber.c:111] [V4L4J] Setting format field to
'BGR24' image format
[java] [v4l4j_FrameGrabber.c:465] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_getBufferSize
[java] [v4l4j_FrameGrabber.c:121] [V4L4J] OUTPUT: RAW / JPEG -
Using byte array of size 921600
[java] [v4l4j_FrameGrabber.c:492] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_setQuality
[java] [v4l4j_FrameGrabber.c:496] [V4L4J] Setting JPEG quality to
80
[java] [v4l4j_FrameGrabber.c:476] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_start
[java] [v4l4j_FrameGrabber.c:480] [LIBVIDEO] Calling
'start_capture(dev: /dev/video0)'
[java] [v4l2-input.c:713 start_capture_v4l2] CAP: Starting
capture on device /dev/video0.
[java] [v4l4j_FrameGrabber.c:623] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_fillBuffer
[java] [v4l2-input.c:822 dequeue_buffer_v4l2] CAP: dequeuing
buffer on device /dev/video0.
[java] [v4l2-input.c:846 dequeue_buffer_v4l2] CAP: dequeued
buffer 0 length: 921600 - seq: 6 - time 1319441477101431
[java] [v4l2-input.c:743 print_buffer_details] Index: 0
[java] Input Flag: no
[java] Input: 0
[java] [jpeg.c:408] [CALL] Entering jpeg_encode_bgr24
[java] [jpeg.c:417] [JPEG] Starting compression (921600 bytes)
[java] [jpeg.c:431] [JPEG] Finished compression (42145 bytes)
[java] [v4l4j_FrameGrabber.c:612] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_enqueueBuffer
[java] [v4l2-input.c:856 enqueue_buffer_v4l2] CAP: queuing buffer
on device /dev/video0.
[java] [v4l2-input.c:867 enqueue_buffer_v4l2] CAP: error queuing
buffer
[java] [v4l4j_FrameGrabber.c:623] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_fillBuffer
[java] [v4l2-input.c:822 dequeue_buffer_v4l2] CAP: dequeuing
buffer on device /dev/video0.
[java] [v4l2-input.c:846 dequeue_buffer_v4l2] CAP: dequeued
buffer 1 length: 921600 - seq: 7 - time 1319441477141396
[java] [v4l2-input.c:743 print_buffer_details] Index: 1
[java] Input Flag: no
[java] Input: 0
[java] [jpeg.c:408] [CALL] Entering jpeg_encode_bgr24
[java] [jpeg.c:417] [JPEG] Starting compression (921600 bytes)
[java] [jpeg.c:431] [JPEG] Finished compression (31673 bytes)
[java] [v4l4j_FrameGrabber.c:612] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_enqueueBuffer
[java] [v4l2-input.c:856 enqueue_buffer_v4l2] CAP: queuing buffer
on device /dev/video0.
[java] [v4l2-input.c:867 enqueue_buffer_v4l2] CAP: error queuing
buffer
[java] [v4l4j_FrameGrabber.c:623] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_fillBuffer
[java] [v4l2-input.c:822 dequeue_buffer_v4l2] CAP: dequeuing
buffer on device /dev/video0.
[java] [v4l2-input.c:846 dequeue_buffer_v4l2] CAP: dequeued
buffer 2 length: 921600 - seq: 8 - time 1319441477181427
[java] [v4l2-input.c:743 print_buffer_details] Index: 2
[java] Input Flag: no
[java] Input: 0
[java] [jpeg.c:408] [CALL] Entering jpeg_encode_bgr24
[java] [jpeg.c:417] [JPEG] Starting compression (921600 bytes)
[java] [jpeg.c:431] [JPEG] Finished compression (31819 bytes)
[java] [v4l4j_FrameGrabber.c:612] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_enqueueBuffer
[java] [v4l2-input.c:856 enqueue_buffer_v4l2] CAP: queuing buffer
on device /dev/video0.
[java] [v4l2-input.c:867 enqueue_buffer_v4l2] CAP: error queuing
buffer
[java] [v4l4j_FrameGrabber.c:623] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_fillBuffer
[java] [v4l2-input.c:822 dequeue_buffer_v4l2] CAP: dequeuing
buffer on device /dev/video0.
[java] [v4l2-input.c:846 dequeue_buffer_v4l2] CAP: dequeued
buffer 3 length: 921600 - seq: 9 - time 1319441477221401
[java] [v4l2-input.c:743 print_buffer_details] Index: 3
[java] Input Flag: no
[java] Input: 0
[java] [jpeg.c:408] [CALL] Entering jpeg_encode_bgr24
[java] [jpeg.c:417] [JPEG] Starting compression (921600 bytes)
[java] [jpeg.c:431] [JPEG] Finished compression (36352 bytes)
[java] [v4l4j_FrameGrabber.c:612] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_enqueueBuffer
[java] [v4l2-input.c:856 enqueue_buffer_v4l2] CAP: queuing buffer
on device /dev/video0.
[java] [v4l2-input.c:867 enqueue_buffer_v4l2] CAP: error queuing
buffer
[java] [v4l4j_FrameGrabber.c:623] [CALL] Entering
Java_au_edu_jcu_v4l4j_AbstractGrabber_fillBuffer
[java] [v4l2-input.c:822 dequeue_buffer_v4l2] CAP: dequeuing
buffer on device /dev/video0.

I've tried to check (in my project) how change the input field, when I
switch input in the old manner, and I see that it doesn't change! it
is alwas 0.
I'm continuing to find a solution on the C side, but I'm new of v4l,
so no big step ahead, for now... I've tried even to contact the
provider of the card, but they told me just "look v4l api", so no real
help. Aniway, I must find a solution, so no rest for me...

On 22 Ott, 07:28, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> I have made changes so that struct v4l2_buffer->input is used instead
> of ioctl(VIDIOC_S_INPUT) to change the current input. I am not sure
> whether this is going to work, but it doesnt hurt to try.
> Can you please update your copy, make sure you uninstall the current
> version of v4l4j, then "ant clean all-debug", and "sudo ant install".
> Test it with "ant test-simpleViewer". This will show 5 frames from
> input 0, then 5 frames from input 1, if everything goes according to
> plan.
> Can you please send the output of "ant test-simpleViewer" (even if it works).
> Thanks
> Gilles
>
>
>
>
>
>
>
> On Sat, Oct 22, 2011 at 8:48 AM, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> > Roberto,
> > There is one more thing I d like to explore. I noticed there is an
> > "input" field in struct v4l2_buffer, which according to the doc,
> > should be set by the application when queuing a buffer with
> > VIDIOC_QBUF to indicate which input to capture from (?) I guess.
> > I am making a few changes to use this field, and I ll let you know
> > when it s ready to test.
> > Gilles
>
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 26, 2011, 6:24:00 AM10/26/11
to v4...@googlegroups.com
Roberto,
Looking at the traces, I can see why capture stops almost immediately:
There is an error queuing back buffers and the driver is starved
almost right after the start of capture. Let me ask on the v4l mailing
list. I ll get back to you when I have an definite answer on how to
perform the input switching.
Gilles

aimaicai

unread,
Oct 26, 2011, 8:33:35 AM10/26/11
to v4l4j
Gilles,
thank you. I've done some little progress for my application: now I
can grab from 4 cameras at 2.5 fps. I start to think that I couldn't
do better :-( . It seems that the time for the grabber to stabilize
itself after a switch is very high. My last implementation do this
cycle:

-grab a frame from channel i;
-switch to channel i+1;
-skip first frame;
-grab second frame;
-switch to channel i+2;
-...

All the frames I skipped are mixture of 2 consecutive cameras. The
acquisition process goes half than what specs say (but I read in the
"ask a question" section on the bluecherry site a reply from they
where it says that the max rate is 2-3 fps... so I'm confused...).
Maybe some guru from the mailing list will find a solution... Anyway
thanks for your great help.
Bye

Roberto


On 26 Ott, 12:24, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 28, 2011, 6:13:36 PM10/28/11
to v4...@googlegroups.com
Roberto,
The reply I got on the linux-media mailing list seems to indicate
that the way to do it is what I implemented originally using
VIDIOC_S_INPUT. Can i suggest you try the zoneminder app and the
officially supported bluecherryDVR app to see if you see the same
behaviour. But as far as I know there is much more v4l4j can do.
Gilles

Gilles Gigan

unread,
Oct 28, 2011, 6:45:05 PM10/28/11
to v4...@googlegroups.com
Roberto,
I just got a new reply to my post on the v4l-media ML with a patch for
the bttv driver which may fix the mixing issue you re seeing. You need
to get the v4l-media source code, apply the patch, build the modules,
load bttv and try v4l4j again.

You can find info on how to download, build and install the latest
v4l-media code here:
http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers#Retrieving_and_Building.2FCompiling_the_Latest_V4L-DVB_Source_Code

The patch you should apply before building v4l-media is here:
http://www.spinics.net/lists/linux-media/msg39505.html

Gilles

aimaicai

unread,
Oct 31, 2011, 11:06:18 AM10/31/11
to v4l4j
Hi Gilles,
unfortunally I'm not so skilled with the patching... :-(
I never did it in my life, so I need step by step instructions (I'm on
ubuntu 11.04 server). I try to google something, but all I found was
not easy to understand for me. Sorry.

Roberto

On 28 Ott, 23:45, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> I just got a new reply to my post on the v4l-media ML with a patch for
> the bttv driver which may fix the mixing issue you re seeing. You need
> to get the v4l-media source code, apply the patch, build the modules,
> load bttv and try v4l4j again.
>
> You can find info on how to download, build and install the latest
> v4l-media code here:http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4...
>
> The patch you should apply before building v4l-media is here:http://www.spinics.net/lists/linux-media/msg39505.html
>
> Gilles
>
>
>
>
>
>
>
> On Sat, Oct 29, 2011 at 9:13 AM, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> > Roberto,
> > The reply I got on the linux-media mailing list seems to  indicate
> > that the way to do it is what I implemented originally using
> > VIDIOC_S_INPUT. Can i suggest you try the zoneminder app and the
> > officially supported bluecherryDVR app to see if you see the same
> > behaviour. But as far as I know there is much more v4l4j can do.
> > Gilles
>
> ...
>
> leggi tutto

Gilles Gigan

unread,
Oct 31, 2011, 3:47:30 PM10/31/11
to v4...@googlegroups.com
Roberto,
This one is a simple patch so you can do it manually:
Just after you downloaded the v4l-media source code (ie just after the
"git clone" command), edit
v4l-media/drivers/media/video/bt8xx/bttv-driver.c and change line 3981
from

if (UNSET != btv->new_input) {

to

if (! btv->curr.top && UNSET != btv->new_input) {

then continue as directed by the wiki page.

Gilles

Gilles Gigan

unread,
Oct 31, 2011, 8:00:13 PM10/31/11
to v4...@googlegroups.com
Roberto,
I should have warned you earlier:
what you are doing can ruin your Linux installation if you are not careful.
I suggest you try the new v4l-media modules BEFORE overwriting your
distro's modules with the new ones.
If you can do the udpate/testing on a test machine.
I have compiled the latest v4l-media tree successfully on Ubuntu
10.04.2. This is what I did:

git clone git://linuxtv.org/media_build.git
cd media_build/linux
make download
make untar
vi drivers/media/video/bt8xx/bttv-driver.c (change line 3981 to "if (!
btv->curr.top && UNSET != btv->new_input) {")
cd ..
make -j 4 (change 4 to the number of cores on your machine + 1)
cd v4l
sudo modprobe i2c-algo-bit
sudo insmod media.ko
sudo insmod v4l2-compat-ioctl32.ko
sudo insmod videodev.ko
sudo insmod v4l2-common.ko
sudo insmod videobuf-core.ko
sudo insmod videobuf-dma-sg.ko
sudo insmod videofub-dma-contig.ko
sudo insmod videobuf2-core.ko
sudo insmod videobuf2-memops.ko
sudo insmod videobuf2-dma-sg.ko
sudo insmod rc-core.ko
sudo insmod btcx-risc.ko
sudo insmod tveeprom.ko
sudo insmod bttv.ko

Hopefully, you ll get through this without error, and you can test
v4l4j with the latest bttv driver and the patch to synchronise the
input change to the video stream.
I have reverted the last change in the switch-input branch, so that
v4l4j uses VIDIOC_S_INPUT to change the current input (instead of the
input field / VIDIOC_QBUF), so make
sure you update your working copy, rebuild v4l4j and reinstall it
before testing the new bttv module.


Let me know how you go.

Gilles

aimaicai

unread,
Nov 2, 2011, 11:12:26 AM11/2/11
to v4l4j
Hi Gilles...
I've got a compilation problem: when I send the "make -j #" command I
have this output:

make[1]: ingresso nella directory "/home/aisac/Desktop/prove/patch/
media_build"
make[1]: attenzione: jobserver non disponibile, viene usato -j1.
Aggiungere "+" alla regola make superiore.
make -C /home/aisac/Desktop/prove/patch/media_build/v4l
make[2]: ingresso nella directory "/home/aisac/Desktop/prove/patch/
media_build/v4l"
Updating/Creating .config
make[3]: Entering directory `/home/aisac/Desktop/prove/patch/
media_build/linux'
Applying patches for kernel 2.6.38-11-server
patch -s -f -N -p1 -i ../backports/api_version.patch
patch -s -f -N -p1 -i ../backports/no_atomic_include.patch
patch -s -f -N -p1 -i ../backports/v4l2-compat-timespec.patch
patch -s -f -N -p1 -i ../backports/
v2.6.38_use_getkeycode_new_setkeycode_new.patch
Patched drivers/media/dvb/dvb-core/dvbdev.c
Patched drivers/media/video/v4l2-dev.c
Patched drivers/media/rc/rc-main.c
make[3]: Leaving directory `/home/aisac/Desktop/prove/patch/
media_build/linux'
Preparing to compile for kernel version 2.6.38
File not found: /lib/modules/2.6.38-11-server/build/.config at ./
scripts/make_kconfig.pl line 33, <IN> line 4.
make[2]: *** Nessuna regola per generare l'obiettivo ".myconfig",
necessario per "config-compat.h". Arresto.
make[2]: uscita dalla directory "/home/aisac/Desktop/prove/patch/
media_build/v4l"
make[1]: *** [all] Errore 2
make[1]: uscita dalla directory "/home/aisac/Desktop/prove/patch/
media_build"
make: *** [default] Errore 2

I tried even the ./build command in the media_build dir, but it seems
to stop in the same point:

******************
* Start building *
******************
make -C /home/aisac/Desktop/prove/patch/media_build/v4l allyesconfig
make[1]: ingresso nella directory "/home/aisac/Desktop/prove/patch/
media_build/v4l"
make[2]: Entering directory `/home/aisac/Desktop/prove/patch/
media_build/linux'
Applying patches for kernel 2.6.38-11-server
patch -s -f -N -p1 -i ../backports/api_version.patch
patch -s -f -N -p1 -i ../backports/no_atomic_include.patch
patch -s -f -N -p1 -i ../backports/v4l2-compat-timespec.patch
patch -s -f -N -p1 -i ../backports/
v2.6.38_use_getkeycode_new_setkeycode_new.patch
Patched drivers/media/dvb/dvb-core/dvbdev.c
Patched drivers/media/video/v4l2-dev.c
Patched drivers/media/rc/rc-main.c
make[2]: Leaving directory `/home/aisac/Desktop/prove/patch/
media_build/linux'
./scripts/make_kconfig.pl /lib/modules/2.6.38-11-server/build /lib/
modules/2.6.38-11-server/build 1
Preparing to compile for kernel version 2.6.38
File not found: /lib/modules/2.6.38-11-server/build/.config at ./
scripts/make_kconfig.pl line 33, <IN> line 4.
make[1]: *** [allyesconfig] Errore 2
make[1]: uscita dalla directory "/home/aisac/Desktop/prove/patch/
media_build/v4l"
make: *** [allyesconfig] Errore 2
can't select all drivers at ./build line 379.

:-(

On 1 Nov, 01:00, Gilles Gigan <gilles.gi...@gmail.com> wrote:
> Roberto,
> ...
>
> leggi tutto

aimaicai

unread,
Nov 3, 2011, 12:17:06 PM11/3/11
to v4l4j
After install some packages and change some includes, I've compiled
it.
When I type the list of module to load, I've got this output:
insmod: error inserting 'media.ko': -1 File exists
insmod: error inserting 'v4l2-compat-ioctl32.ko': -1 File exists
insmod: error inserting 'videodev.ko': -1 File exists
insmod: error inserting 'v4l2-common.ko': -1 File exists
insmod: error inserting 'videobuf-core.ko': -1 File exists
insmod: error inserting 'videobuf-dma-sg.ko': -1 File exists
insmod: error inserting 'videobuf2-memops.ko': -1 File exists
insmod: error inserting 'rc-core.ko': -1 File exists
insmod: error inserting 'btcx-risc.ko': -1 File exists
insmod: error inserting 'tveeprom.ko': -1 File exists

The others are ok.

Anyway I tried to run the test with no luck; all 2 example (mine and
your) mixed the images. I'm afraid of a limit of the hardware...


I don't know
> ...
>
> leggi tutto

Gilles Gigan

unread,
Nov 3, 2011, 6:26:13 PM11/3/11
to v4...@googlegroups.com
Roberto,
i forgot to mention that for all the modules in the list I sent you
must be unloaded before loading the new ones.
So in the list, replace insmod with rmmod and run the commands in reverse order:

sudo rmmod bttv.ko
sudo rmmod tveeprom.ko
sudo rmmod btcx-risc.ko
sudo rmmod rc-core.ko
sudo rmmod videobuf2-dma-sg.ko
sudo rmmod videobuf2-memops.ko
sudo rmmod videobuf2-core.ko
sudo rmmod videofub-dma-contig.ko
sudo rmmod videobuf-dma-sg.ko
sudo rmmod videobuf-core.ko
sudo rmmod v4l2-common.ko
sudo rmmod videodev.ko
sudo rmmod v4l2-compat-ioctl32.ko
sudo rmmod media.ko

sudo modprobe i2c-algo-bit
sudo insmod media.ko
sudo insmod v4l2-compat-ioctl32.ko
sudo insmod videodev.ko
sudo insmod v4l2-common.ko
sudo insmod videobuf-core.ko
sudo insmod videobuf-dma-sg.ko
sudo insmod videofub-dma-contig.ko
sudo insmod videobuf2-core.ko
sudo insmod videobuf2-memops.ko
sudo insmod videobuf2-dma-sg.ko
sudo insmod rc-core.ko
sudo insmod btcx-risc.ko
sudo insmod tveeprom.ko
sudo insmod bttv.ko

Gilles

Reply all
Reply to author
Forward
0 new messages