Friday, September 16, 2011

SoMagic EasyCap - almost two fields

Continuing on with the EasyCap device, I've been able to generate some executables to initialise the device, and capture some video data.

This is the current best result, generated with "mplayer cap.out -demuxer rawvideo -rawvideo "w=724:h=460:format=uyvy"
SoMagic EasyCap capture of Test Ctard F - work in progress

It seems - unless I'm doing it wrong - that you need to manually find the horizontal sync markers in the video data. And the vertical sync, which you can see from the image, I haven't done yet.

The biggest problem I need to overcome is that what you see here is generated from 4 isochronous USB transfers of near 200kbytes each. There seems to be some kind of delay in fetching the data - evidenced by the three "cuts" in the vertical picture ( the second is in the vertical blanking section, so you can't see it)

I'm using libusb, and this is the section that captures the video data:

ret = usb_isochronous_setup(&isourb, 0x00000082, 3072, isobuf, 64 * 3072);
printf("195 isochronous setup returned %d\n", ret);
ret = usb_isochronous_submit(devh, isourb, &isotv);
printf("195 isochronous submit returned %d\n", ret);


ret = usb_isochronous_setup(&isourb1, 0x00000082, 3072, isobuf1, 64 * 3072);
printf("195a isochronous setup returned %d\n", ret);
ret = usb_isochronous_submit(devh, isourb1, &isotv1);
printf("195a isochronous submit returned %d\n", ret);

ret = usb_isochronous_setup(&isourb2, 0x00000082, 3072, isobuf2, 64 * 3072);
printf("195b isochronous setup returned %d\n", ret);
ret = usb_isochronous_submit(devh, isourb2, &isotv2);
printf("195b isochronous submit returned %d\n", ret);

ret = usb_isochronous_setup(&isourb3, 0x00000082, 3072, isobuf3, 64 * 3072);
printf("195c isochronous setup returned %d\n", ret);
ret = usb_isochronous_submit(devh, isourb3, &isotv3);
printf("195c isochronous submit returned %d\n", ret);

int r1,r2,r3,r4;
ret = usb_isochronous_reap(devh, isourb, &isotv, 1000);
//printf("195 isochronous reap returned %d, bytes: ", ret);
r1=ret;

ret = usb_isochronous_reap(devh, isourb1, &isotv1, 1000);
//printf("195a isochronous reap returned %d, bytes: ", ret);
r2=ret;

ret = usb_isochronous_reap(devh, isourb2, &isotv2, 1000);
//printf("195b isochronous reap returned %d, bytes: ", ret);
r3=ret;

ret = usb_isochronous_reap(devh, isourb3, &isotv3, 1000);
//printf("195c isochronous reap returned %d, bytes: ", ret);
r4=ret;

save_bytes(isourb->buffer, r1);
save_bytes(isourb1->buffer, r2);
save_bytes(isourb2->buffer, r3);
save_bytes(isourb3->buffer, r4);
Any clues anyone?



No comments: