How to capture a still image while previewing live video?

Paul Stuart paul_stuart at seektech.com
Wed Sep 14 13:32:41 PDT 2011


Mike,
 Wow, that works flawlessly on my DM365, thanks!
Interestingly, when I subbed in:

! TIImgenc1  iColorSpace=UYVY oColorSpace=YUV420P qValue=75 
engineName=codecServer \

for your  generic:

! jpegenc \

it hung again. Something is rotten in Denmark, where Denmark = TIImgenc1.

Guess I need to profile the CPU loading to see how painful doing a 
non-HW-acclerated JPEG compression is, but this looks promising.

Thanks,
Paul

Mike Mitchell wrote:
> Paul,
>
> First Wes was right that you need multifilesink, otherwise your output 
> will be appended, not overwritten. I could not use your TIVidResize or 
> TIImgenc1. So I used the generic modules. Below you will find a linux 
> example that creates a JPG for every second of the incoming video.  
> Notice the caps on either side of the videorate element.  These tell 
> videorate that it must drop frames to meet your criterion, and with 
> silent=FALSE you can see it will drop 95/100. I think it is working as 
> you would expect . At first I guessed it would drop 97 frames and 
> forward only 30,60 and 90.  But perhaps it's forwarding frames 
> 1,31,61,91 and an EOS frame.
>
> *Mike Mitchell, MBA*
> Principal
> Panometric LLC
>
> gst-launch -vt --gst-plugin-spew \
>  videotestsrc num-buffers=100  \
> ! 'video/x-raw-yuv, framerate=30/1' \
> ! videorate silent=FALSE \
> ! jpegenc \
> ! 'image/jpeg, width=(int)320, height=(int)240, 
> framerate=(fraction)1/1, pixel-aspect-ratio=(fraction)1/1' \
> ! multifilesink location=output-%05d.jpg
> ls -al outpu*.jpg
>
>
>
> ---------- Forwarded message ----------
> From: Paul Stuart <Paul_Stuart at seektech.com 
> <mailto:Paul_Stuart at seektech.com>>
> To: "gstreamer-devel at lists.freedesktop.org 
> <mailto:gstreamer-devel at lists.freedesktop.org>" 
> <gstreamer-devel at lists.freedesktop.org 
> <mailto:gstreamer-devel at lists.freedesktop.org>>
> Date: Tue, 13 Sep 2011 16:23:51 -0700
> Subject: How to capture a still image while previewing live video?
>
> Hi,
>
>   We need to simultaneously capture/preview video on a TI DM365 while 
> asynchronously taking JPEG stills from the same video stream.  Playing 
> around with gst-launch, it only seems to work correctly when v4l2src 
> num-buffers=1. Sample working pipeline:
>
> gst-launch -v v4l2src  num-buffers=1 always-copy=FALSE  
> input-src=composite \
> ! TIVidResize contiguousInputFrame=TRUE \
> ! 'video/x-raw-yuv,width=(int)736,height=(int)480' \
> ! queue \
> ! TIImgenc1  iColorSpace=UYVY oColorSpace=YUV420P qValue=75 
> engineName=codecServer \
> ! queue \
> ! filesink location=output.jpg
>
>  
>
> If I modify the above to remove num-buffers=1, or even just set 
> num-buffers=2, it hangs and never produces a valid JPEG. I would have 
> expected it to just overwrite output.jpg
>
>  
>
> If, I change this to something that is, for instance, previewing the 
> video at the same time, things break as well. Sample Pipeline:
>
> gst-launch -v v4l2src always-copy=FALSE  input-src=composite \
> ! queue \
> ! tee name= t \
> ! 'video/x-raw-yuv,width=(int)736,height=(int)480' \
> ! tidisplaysink2 video-standard=vga display-output=lcd 
> mmap-buffer=FALSE dma-copy=TRUE \
> t. \
> ! queue \
> ! 'video/x-raw-yuv,width=(int)736,height=(int)480' \
> ! videorate \
> ! TIImgenc1  iColorSpace=UYVY oColorSpace=YUV420P qValue=75 
> engineName=codecServer \
> ! filesink location=output.jpg
>
>  
>
> Is it possible to create a gstreamer pipeline using “standard” parts 
> to accomplish what I need, or will I need to modify my JPEG encoder 
> element to make this work?
>
>  
>
> Thanks!
>
> Paul
>
>  
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110914/49e5cf5f/attachment-0001.htm>


More information about the gstreamer-devel mailing list