How to use gstreamer to save webcam video to file?

I've been trying to get emgu to save same webcam video to file

The problem is opencv only ssupports avi, and avi does not seem to suit a format like X264 very well.

Could I use Gstreamer to do this for me in C?

It would be good if I could choose the file format and container type too. It would be good if I could use a format like schrodinger dirac.

I'm new to GStreamer so I'm not quite sure if I'm on the right track here.

EDIT

I've managed to capture the webcam video using

gst-launch-0.10 ksvideosrc ! autovideosink

Now how to transcode this to a format like H264 or dirac ...?

EDIT

gst-launch-0.10 ksvideosrc num-buffers=10 ! decodebin2 ! ffmpegcolorspace ! x264enc ! matroskamux ! filesink location=video.mkv

This seems to create a file, but VLC player can't read it.


This

gst-launch-0.10

ksvideosrc !  
decodebin2 !      
ffmpegcolorspace !
schronc ! 
matroskamux ! 
filesink location=gopro2.mkv

Seems to handle dirac encoding

And this

gst-launch-0.10 ksvideosrc num-buffers=500 ! decodebin2 ! ffmpegcolorspace ! x264enc ! mp4mux ! filesink location=gopro2.mp4

Handles x264


This pipeline captures video from webcam, encodes it in h264 and finally uses flv container to store it at any specified location.

gst-launch-1.0 v4l2src ! videoconvert ! x264enc ! flvmux ! filesink location=xyz.flv

Hope this helps


This directly captures the video from webcam and writes as an avi file which will be played-back by VLC player.

   gst-launch v4l2src ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=output.avi

Hope this help!

链接地址: http://www.djcxy.com/p/43912.html

上一篇: Gstreamer录制音频和视频

下一篇: 如何使用gstreamer将网络摄像头视频保存到文件?