使用GStreamer作v4l2摄像头采集和输出到YUV文件及屏幕的相关测试

来源:互联网 发布:机动战士age知乎 编辑:程序博客网 时间:2024/05/16 10:33

环境:ubuntu 9.10 

安装软件:gstreamer 基本包 以及gst-plug-ins-bad, mplayer

 

1、使用mplayer播放yuv文件

shallon@shallon-desktop:~/yuv_play_test_from_hp$ mplayer test.yuv1   -demuxer   rawvideo  -rawvideo  w=352:h=288
MPlayer SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing test.yuv1.
rawvideo file format detected.
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: No such file or directory.
[VO_3DFX] Unable to open /dev/3dfx.
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 352 x 288 (preferred colorspace: Planar I420)
VDec: using Planar I420 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 352x288 => 352x288 Planar I420
Selected video codec: [rawi420] vfm: raw (RAW I420)
==========================================================================
Audio: no sound
Starting playback...
V:   1.0  26/ 26  0%  4%  0.0% 0 0

Exiting... (End of file)
--------------------------------------------------------------------------------------------------------------------
2、v4l2 摄像头采集并输出到屏幕

shallon@shallon-desktop:~/yuv_play_test_from_hp$ gst-launch-0.10 v4l2src !  video/x-raw-yuv,width=352,height=288 ! xvimagesink

(gst-launch-0.10:13429): GLib-WARNING **: g_set_prgname() called multiple times
设置暂停管道 ...
管道正在使用且不需要 PREROLL ...
设置播放管道 ...
New clock: GstSystemClock
^CCaught interrupt -- handling interrupt.
中断:停止流水线作业...
Execution ended after 5775814760 ns.
设置暂停管道 ...
正在完成设置管道 ...
正在设置管道为 NULL ...
释放管道资源 ...

-------------------------------------------------------------------------------------------------------------------------
3、v4l2 摄像头采集并输出到yuv文件

gst-launch-0.10 v4l2src  ! ffmpegcolorspace ! video/x-raw-yuv, format=/(fourcc/)I420, width=352,height=288 ! filesink location=v4l2.yuv1

shallon@shallon-desktop:~$ gst-launch-0.10 v4l2src  ! ffmpegcolorspace ! video/x-raw-yuv, format=/(fourcc/)I420, width=352,height=288 ! filesink location=v4l2.yuv1

(gst-launch-0.10:2152): GLib-WARNING **: g_set_prgname() called multiple times
设置暂停管道 ...
管道正在使用且不需要 PREROLL ...
设置播放管道 ...
New clock: GstSystemClock
^CCaught interrupt -- handling interrupt.
中断:停止流水线作业...
Execution ended after 6094593351 ns.
设置暂停管道 ...
正在完成设置管道 ...
正在设置管道为 NULL ...
释放管道资源 ...


-------------------------------------------------------------------------------------------------------------------------
4、使用gstreamer 将yuv文件读出并显示到屏幕上

  shallon@shallon-desktop:~$  gst-launch-0.10 filesrc location=v4l2.yuv1  ! videoparse width=352 height=288 ! xvimagesink

(gst-launch-0.10:2521): GLib-WARNING **: g_set_prgname() called multiple times
设置暂停管道 ...
管道正在 PREROLLING ...
管道预读完成 ...
设置播放管道 ...
New clock: GstSystemClock
收到来自组件“pipeline0”的 EOS 信号。
Execution ended after 4480103264 ns.
设置暂停管道 ...
正在完成设置管道 ...
正在设置管道为 NULL ...
释放管道资源 ...

 

原创粉丝点击