Look at the grab_one sub, and the for(0..1){...}

To be honest, I don't fully understand why, but without that, the picture won't sync. I translated the code from a V4l2 code I saw, I think it was in c IIRC. The other thing you will notice, is that the picture comes out BGR, instead of RGB, and it is flipped vertically. Luckily, you can just reverse the data, and it comes out OK, then use Imager to flip it upright.

The reason why I suspect it needs 2 (and why I guess it's due to interlacing) is the way NTSC video works. It is sent as 2 frames(called odd and even). This was originally done to reduce flicker, as it essentially doubles the refresh rate.

<guess_hat_on>

So think what happens when you try to grab a picture. You may be intercepting the video stream at any point in a frame, so you need to latch on to it first, and wait for the sync signal, which resets to the upper left corner, then start the grab on the next frame.

I'm guessing this won't be a problem with pure digital cameras, but NTSC cameras need it. I see from your grabinfo, that your camera supports pal, ntsc and secam.....those are the basic old analog video formats used in Europe, the US, and S. America.


I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re^3: Video::Capture::V4l tv parameters. by zentara
in thread Video::Capture::V4l tv parameters. by CptSkripto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.