2013-04-18 83 views
2

我正在使用gstreamer(gst-launch)捕獲攝像頭並將視頻和圖像幀保存爲視頻和圖像幀。流水線的問題是,當流水線結束(通過中斷)視頻記錄時,它不能支持位置跟蹤和搜索。因此,視頻在具有未知長度的vlc播放器中播放。我認爲問題在於管道本身。我們如何實現支持位置跟蹤和尋找。Gstreamer視頻輸出位置跟蹤和尋求

這裏下面你可以看到GStreamer的管道代碼:

gst-launch -v --gst-debug-level=0 \ 
     v4l2src device=/dev/video0 \ 
     ! videorate \ 
     ! video/x-raw-yuv, width=320, height=240, framerate=5/1 \ 
     ! tee name=tp 
     tp. \ 
     ! queue \ 
     ! videobalance saturation=0.0 \ 
     ! textoverlay halign=left valign=top text="(c)PARK ON OM " shaded-background=true \ 
     ! clockoverlay halign=right valign=top time-format="%D %T " text="Date:" shaded-background=true \ 
     ! queue \ 
     ! ffmpegcolorspace \ 
     ! ffenc_mpeg4 \ 
     ! avimux \ 
     ! filesink location=/ram/pmc/recordCAM1.mp4 \ 
     tp. \ 
     ! queue \ 
     ! jpegenc \ 
     ! multifilesink location=/ram/pmc/webcam1.jpeg & 

管線的解釋是象下面這樣:

             ______________ ________ _______  ________________ 
                 |convert into|->|append|->|encode| -> |save file as | 
_________________ ________________ _____________ | grayscale | |text | |ffenc | | recordCAM1.mp4 | 
| use /dev/video |-> |set framerate |-> |multiplexer|-> 
| as input source| |and resolution| | named tp |-> 
                 __________ _________________ 
                 |jpeg enc|->|save to filesink| 
                 | encode | | as jpeg  | 

末兩複用器輸出將文件保存到磁盤。 我應該添加什麼東西才能在任何媒體播放器上實現位置跟蹤。

問候

回答

1

確保正確的GStreamer信號流是即將結束的所有元素,當你中斷它。

通常這是通過發送EOS事件來完成的。

man gst-launch 
    [...] 
    -e, --eos-on-shutdown 
      Force an EOS event on sources before shutting the pipeline down. 
      This is useful to make sure muxers create readable files when a muxing 
      pipeline is shut down forcefully via Control-C.