Hi Fabrice,
> I'm trying to build a gstreamer pipeline to take snapshots (only on
> picture) from the camera. I'd like one for the N810 and one for the N900.
>
> On the N810, I came up with :
> gst-launch v4l2src num-buffers=1 ! video/x-raw-
> rgb,width=640,height=480,framerate=8/1 ! ffmpegcolorspace ! jpegenc !
> filesink location=test.jpg
>
> The pipeline is executed as it should, but the jpeg file is a black
> frame... I tested v4l2src ! ffmpegcolorspace ! xvimagesink to check the
> camera hardware and it's ok.
>
> For the N900, I'd be grateful for any help since I don't have this lovely
> device yet ;-)
I have tried something similar: take a snapshot on the N810. I have found
a solution that almost works except that from to time, I also get a black
frame. Here is the code I'm using (this is a Hop (http://hop.inria.fr)
source code but I'm sure you will manage to transpose it in your own
language).
Cheers,
--
Manuel
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
(define (gstreamer-v4l-init!)
(set! *src*
(gst-element-factory-make "v4l2src" "video-src"))
(set! *csp-filter*
(gst-element-factory-make "ffmpegcolorspace" "csp_filter1"))
(set! *img-enc*
(gst-element-factory-make "jpegenc" "img-enc"))
(set! *pipeline*
(gst-pipeline-new "webcam-pipeline"))
(gst-bin-add! *pipeline* *src* *csp-filter* *img-enc*)
(gst-element-link! *src* *csp-filter*)
(gst-element-link-mime! *csp-filter* *img-enc*
"video/x-raw-yuv"
:width 640 :height 480
:framerate '(fraction 8 1))
(gst-object-property-set! *src* :num-buffers 1))
(define-service (hopcam/snapshot #!key key)
(with-lock *mutex-snapshot*
(lambda ()
(let* ((path (let ((p (make-file-name *tmp* "hopcam.jpeg")))
(when (file-exists? p) (delete-file p))
p))
(sink (gst-element-factory-make "filesink" "image-sink"
:location path))
(bus (gst-pipeline-bus *pipeline*)))
(gst-bin-add! *pipeline* sink)
(gst-element-link! *img-enc* sink)
(gst-element-state-set! *pipeline* 'playing)
(unwind-protect
(let loop ((play 0))
(let ((msg (gst-bus-poll bus)))
(cond
((gst-message-eos? msg)
(gst-element-state-set! *pipeline* 'null)
(instantiate::http-response-file
(file path)))
((gst-message-error? msg)
(tprint (gst-message-error-string msg))
(error 'hopcam/snapshot
"Cannot produce image"
(gst-message-error-string msg)))
(else
(loop play)))))
(gst-bin-remove! *pipeline* sink))))))
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers