public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Format of /dev/video0 data for HVR-4000 frame grabber
@ 2010-11-09  8:43 Michael PARKER
  2010-11-09  9:10 ` Daniel Glöckner
  0 siblings, 1 reply; 6+ messages in thread
From: Michael PARKER @ 2010-11-09  8:43 UTC (permalink / raw)
  To: linux-media@vger.kernel.org

All,

I'm attempting to capture a single frame from the /dev/video0 output of my HVR-4000 card's analogue tuner as a JPEG.

Whilst several resources exist for capturing the output of a card with h/w MPEG compression, I'm unable to determine the format of the /dev/video0 data for a frame grabber such as the HVR-4000.

Can anyone suggest a means by which I can capture a single frame from a frame grabber card? Can I just use "dd if=/dev/video0 of=image.jpg bs=64K" or similar or do I have to access the card via the V4L2 drivers?

Many thanks in advance,

Mike




^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: Format of /dev/video0 data for HVR-4000 frame grabber
@ 2010-11-09 17:39 Andy Walls
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Walls @ 2010-11-09 17:39 UTC (permalink / raw)
  To: Michael PARKER; +Cc: Daniel Glöckner, linux-media@vger.kernel.org

Mike,

1. For a utility look at what ffmpeg has to offer.  Id wager it can be employed to do what ever you want.  (Although single JPEG image creation might have nonobvious command line arguments compared to MJPEG)

2. If you are writing code, you may want to link with libv4l2, libv4l, and/or libv4lconvert to have the library to transparent format conversion in userspace.  Search the list archives for announcement by Hans de Goede.

Regards,
Andy

Michael PARKER <michael.parker@st.com> wrote:

>Andy,
>
>Thanks - I'm looking over the source code for the V4L2 sample capture application (http://v4l2spec.bytesex.org/v4l2spec/capture.c) for inspiration.
>
>I'm still more than a little unclear how I go about transforming my captured frame into an image file. 
>
>Can you point me in the direction of a utility/methodology that I can use to transform RGB/BGR/YCbCr/greyscale into JPEG/PNG/GIF or similar?
>
>Cheers,
>
>Mike
>
>> -----Original Message-----
>> From: Andy Walls [mailto:awalls@md.metrocast.net]
>> Sent: 09 November 2010 12:29
>> To: Michael PARKER
>> Cc: Daniel Glöckner; linux-media@vger.kernel.org
>> Subject: RE: Format of /dev/video0 data for HVR-4000 frame grabber
>> 
>> On Tue, 2010-11-09 at 10:34 +0100, Michael PARKER wrote:
>> > Daniel,
>> >
>> > Many thanks for your mail. Please excuse the naivety of my questions -
>> > I'm a h/w guy and a nube to the s/w world.
>> 
>> 
>> > Do you know which of these is the default format or how to determine
>> > the format I'm seeing coming out of /dev/video0?
>> 
>> $ v4l2-ctl -d /dev/video0 --list-formats
>> $ v4l2-ctl -d /dev/video0 --get-fmt-video
>> $ v4l2-ctl --help
>> 
>> > Do you have a suggestion for how data captured from /dev/video0 can be
>> > converted into a recognisable image format (JPEG, GIF, PNG etc.)?
>> >
>> > I'm keen, if possible, to grab the single frame image using just
>> > command line tools and without recourse to ioctls, compiled code etc.
>> 
>> v4l2-ctl can set up the device.  As you and Daniel mentioned, dd can
>> read off a frame given the proper parameters.
>> 
>> 
>> > Also, how do I synchronise dd to the beginning of a new frame (and
>> > thus avoid capturing sections of two frames)?
>> 
>> When dd open()s the device and does a read() it should start a capture.
>> When dd close()s the device and exits, it should stop the capture.  I'm
>> fairly certain stopping and restarting a capture should resynchronize
>> things, but I'm not sure.  The overhead of stopping and starting a
>> capture may cause you some noticeable delays, but again, I'm not sure.
>> 
>> I think the answer is to write some code and use the Streaming I/O
>> ioctl()s interface to get frame based data. I know you were hoping to
>> avoid that.
>> 
>> Regards,
>> Andy
>> 
>> > Thanks again,
>> >
>> > Mike
>> 
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-09 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09  8:43 Format of /dev/video0 data for HVR-4000 frame grabber Michael PARKER
2010-11-09  9:10 ` Daniel Glöckner
2010-11-09  9:34   ` Michael PARKER
2010-11-09 12:28     ` Andy Walls
2010-11-09 15:06       ` Michael PARKER
  -- strict thread matches above, loose matches on Subject: below --
2010-11-09 17:39 Andy Walls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox