This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GStreamer JPEG capture while encoding/previewing video



Hi,

 We need to simultaneously capture/preview video while asyncronously taking JPEG stills from the same video stream.  Playing around with gst-launch, TIImgenc1 only seems to exit 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 \
! queue \
! filesink location=output.jpg

Is it possible to preview/capture video while capturing stills from the source using gStreamer?

 

Thanks,

Paul

  • Update:

     

     

    After receiving guidance from the kind people on the Gstreamer list, I've found that this works:

    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

     

    and this fails:

    gst-launch -vt --gst-plugin-spew \
     videotestsrc num-buffers=100  \
    ! 'video/x-raw-yuv, framerate=30/1' \
    ! videorate silent=FALSE \
    ! TIImgenc1  iColorSpace=UYVY oColorSpace=YUV420P qValue=75 engineName=codecServer \
    ! 'image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)1/1, pixel-aspect-ratio=(fraction)1/1' \
    ! multifilesink location=output-%05d.jpg

     

     

    The only difference being that in the failed version I've used TIImgenc1 vs the generic jpegenc

     

  • Looks like the problem is in the TIImgenc1 element. At the end of the encoder loop, there is a call to

    Buffer_freeUseMask(hDstBuf, gst_tidmaibuffer_CODEC_FREE);

    And this doesn't actually mark the buffer as free from BufTab's perspective.