Thanks @arturo @roxlu.
I’ve done more snooping around and a few more tests.
I’ve been tinkering with VLC using DirectShow as source:
MRL: dshow://
options: :dshow-vdev=Logitech HD Pro Webcam C920 :dshow-adev=none :dshow-size=1920x1080 :live-caching=10
but it’s super slow and does not display at 1080p
When I use GraphEdit (from the Windows 8 DirectShow SDK) the preview is very responsive, but I can’t change the capture pin to use MJPG 1080p @30FPS
and I’m sttill missing a second Capture pin which is probably H264.
I’ve also tried the cam on a mac like so:
- using OpenCV’s VideoCapture class in c++ (I think it uses ffmpeg behind the scenes) > I get about 12/15fps with 1080p even though I’ve tried setting H264 or MJPG codecs
- using VLC/open capture > I get smooth/fluid video 1080p (might actually be close to 30fps, way better than what I get with opencv) but it’s a few frames behind
For reference here’s my OpenCV test:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
Mat frame;
VideoCapture cap(0);
cap >> frame;
cap.set(CV_CAP_PROP_FOURCC,CV_FOURCC('H','2','6','4'));
// cap.set(CV_CAP_PROP_FOURCC,CV_FOURCC('M','J','P','G'));
cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);
cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
cap.set(CV_CAP_PROP_FPS, 30);
namedWindow("Frame");
int f = 0;
bool rec = false;
time_t start,end;
time(&start);
int counter=0;
for(;;)
{
cap >> frame;
if(rec) {
ostringstream filename;
filename << "frame" << f << ".png";
imwrite(filename.str().c_str(),frame);
f++;
ellipse( frame, Point( 100, 100 ),Size( 50,50),0, 0,360,Scalar( 0, 0, 255 ),20,8 );
}
imshow("Frame",frame);
time(&end);
++counter;
double sec=difftime(end,start);
double fps=counter/sec;
printf("\n%lf fps",fps);
if(waitKey(30) == 27) break;
if(waitKey(30) == 'r') rec = !rec;
}
return 0;
}
Also had a look at how ofVideoGrabber works and the DirectShow grabber is actually using @theo’s videoInput library (https://github.com/ofTheo/videoInput). My hunch is I’ll need to use DirectShow to access the camera but use the correct H264 filter (which I assume is the one used by Skype and the Logitech Webcam Software). At the moment I have no clue how do to that, so even a minimal example would help a lot.
I’ll also test V4L2 on osx, hopefully that would be another solution.
Thanks again,
George