Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

Single frame capture with gstreamer

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


fabrice.desre at gmail

Nov 19, 2009, 3:01 AM

Post #1 of 5 (3428 views)
Permalink
Single frame capture with gstreamer

hello,

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 ;-)

Thanks,

Fabrice

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


mohammed.2.hassan at nokia

Nov 19, 2009, 5:58 AM

Post #2 of 5 (3394 views)
Permalink
Re: Single frame capture with gstreamer [In reply to]

On Thu, 2009-11-19 at 12:01 +0100, ext Fabrice Desré wrote:
> hello,
>
> 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

Use v4l2camsrc instead of v4l2src

> 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 guess you need gst-launch camerabin filename="foo.jpg" (Not 100%
sure). Try gst-inspcct camerabin

Maybe you can use gdigicam
(http://maemo.gitorious.org/fremantle-gdigicam) for that ?

Cheers,

--
Senior Software Engineer
Maemo Software

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


fabrice.desre at gmail

Nov 19, 2009, 6:06 AM

Post #3 of 5 (3390 views)
Permalink
Re: Single frame capture with gstreamer [In reply to]

>> 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
>
> Use v4l2camsrc instead of v4l2src

v4l2camsrc is unknown on the N810 runnning diablo. The v4l2src works
fine eg with the simple video pipeline (v4l2src ! ffmpegcolorspace !
xvimagesink)

>> For the N900, I'd be grateful for any help since I don't have this
>> lovely device yet ;-)
>
> I guess you need gst-launch camerabin filename="foo.jpg" (Not 100%
> sure). Try gst-inspcct camerabin

Thanks for the hint !

Fabrice

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


Manuel.Serrano at sophia

Nov 19, 2009, 6:10 AM

Post #4 of 5 (3386 views)
Permalink
Re: Single frame capture with gstreamer [In reply to]

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
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


fabrice.desre at gmail

Nov 19, 2009, 6:35 AM

Post #5 of 5 (3378 views)
Permalink
Re: Single frame capture with gstreamer [In reply to]

Bonjour Manuel,

> 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).

Thanks ! I found my mistake : the ffmpegcolorspace was not where it
should. Here's a working pipeline for the N810 :

v4l2src num-buffers=1 ! ffmpegcolorspace ! video/x-raw-
yuv,width=640,height=480,framerate=8/1 ! jpegenc ! filesink
location=test.jpg

Fabrice

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.