2013-07-22 129 views
0

我有2個腳本:發送h264視頻流的服務器和播放流的客戶端。兩者都使用gstreamer-1.0。這裏是客戶端的代碼:使用gstreamer 1.0錄製來自視頻的視頻

DEST=10.2.2.30 
LATENCY=0 

VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" 


VIDEO_DEC="rtph264depay ! avdec_h264 max_threads=0" 

VIDEO_SINK="videoconvert ! videoscale ! autovideosink sync=false async=false" 


gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY         \ 
    udpsrc caps=$VIDEO_CAPS port=6000 ! rtpbin.recv_rtp_sink_0      \ 
     rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK            \ 
    udpsrc port=6001 ! rtpbin.recv_rtcp_sink_0          \ 
     rtpbin.send_rtcp_src_0 ! udpsink port=6005 host=$DEST sync=false async=false 

而不是播放流,我想將它記錄到一個yuv文件。我怎樣才能做到這一點 ?

回答

2

只需用文件鏈接代替autovideosink,並可能使用capsfilter來決定所需的YUV格式。因此,對於I420,你可以這樣做:

VIDEO_SINK="videoconvert ! 'video/x-raw,format=(string)I420' ! filesink location=myfile.yuv sync=false async=false" 

,或者如果你想有一個特定的分辨率:

VIDEO_SINK="videoconvert ! videoscale ! 'video/x-raw,format=(string)I420,width=1280,height=720' ! filesink location=myfile.yuv sync=false async=false" 

希望有所幫助。