Why can I stream h264 encoded video from webcam to BOTH display and file, but NOT raw video?

…衆ロ難τιáo~ 提交于 2019-12-03 03:58:23

Streaming raw video from a webcam (not specific to C920) to both display and h.264 encoded file can be done. The x264enc property tune needs to be set to zerolatency.

h.264 example:

gst-launch-1.0 -v v4l2src device=/dev/video0 \ ! video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 \ ! tee name=t t. ! queue ! xvimagesink sync=false t. ! queue ! \ videoconvert ! x264enc tune=zerolatency ! h264parse ! \ matroskamux ! filesink location='raw_dual.mkv' sync=false

Alternatively, one can skip h.264 altogether and encode to theora or vp8 instead.

theora example:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! \ video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 ! \ tee name=t t. ! queue ! xvimagesink sync=false t. ! queue ! \ videoconvert ! theoraenc ! theoraparse ! \ matroskamux ! filesink location='raw_dual.mkv' sync=false

vp8 example:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! \ video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 ! \ tee name=t t. ! queue ! xvimagesink sync=false t. ! queue ! \ videoconvert ! vp8enc ! \ matroskamux ! filesink location='raw_dual.mkv' sync=false

Thanks a lot to Jan Spurny and Tim.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!