Gstreamer不会沉入命名管道 [英] Gstreamer does not sink to named pipe
问题描述
当gst启动管道的接收器是命名管道与普通文件时,我得到了不同的行为.
I'm getting different behavior when the sink of a gst-launch pipeline is a named pipe vs a normal file.
我有一个gst启动管道,该管道在OMAP嵌入式(linux)板上显示来自摄像机的视频,并通过T型接头将视频作为avi传输.
I have a gst-launch pipeline which displays video from a camera on an OMAP embedded (linux) board and delivers the video as avi via a tee.
gst-launch -v -e omx_camera device=0 do-timestamp=1 mode=0 name=cam cam.src ! "video/x-raw-yuv, format=(fourcc)NV12, width=240, height=320, framerate=30/1" ! tee name=t1 t1. ! queue ! ducatih264enc profile=100 level=50 rate-preset=low-delay bitrate=24000 ! h264parse ! queue ! avimux ! filesink location=/tmp/camerapipe t1. ! queue ! dri2videosink sync=false
如果我做
filesink location=/some/real/file t1.
一切都很好
但是我希望使用Java/opencv进程读取输出,当我这样做时,我对Java进程一无所知. gst启动过程确实宣布它已更改为PLAY.
but I wish to read the output with a Java/opencv process, and when I do this I don't get anything to the java process. The gst-launch process does announc that it's changed to PLAY.
为简化操作而不是Java流程,我tail -f
命名管道
To simplify things instead of the java process I tail -f
the named pipe
,也看不到任何输出,尽管在两种情况下dri2videosink都在显示视频
and also don't see any output, though in both cases the dri2videosink is displaying the video
使用tail或java进程,杀死它也会停止gst-launch进程,因此显然它在某种意义上是连接的".
With either tail or the java process, killing it also stops the gst-launch process, so obviously it's 'connected' in some sense.
退出gst-launch后,终止运行并终止gst-launch启动过程看起来像是几K,可能是一帧数据.
Killing the gst-launch process with the tail running gets what looks like a few K, maybe 1 frame of data, after gst-launch exits.
我已经尝试将其保存到普通文件中并通过java进程进行读取,这是可行的,所以我知道这不是数据格式.
I've tried saving to normal file and reading with the java process, that works, so I know it's not the data format.
推荐答案
我试图做同样的事情,我在c中使用opencv并在ubuntu中工作.
I am trying to do the same thing, I am using opencv in c and working in ubuntu though.
我确实完成了以下工作:
I did get the following to work:
我使用mkfifo在/dev/中创建了一个名为video_stream的命名管道,使您有权读取或写入它,也可以只使用sudo.
I created a named pipe in /dev/ called video_stream using mkfifo make sur eyou have permissions to read/write to/from it or just use sudo.
将测试视频播放到命名管道
Play with test video to a named pipe
sudo gst-launch -e videotestsrc ! video/x-raw-yuv, framerate=20/1, width=640, height=480 ! ffenc_mpeg4 ! filesink location=/dev/video_stream
从网络摄像头播放到命名管道:
Play from web cam to a named pipe:
sudo gst-launch -e v4l2src device=/dev/video0 ! ffenc_mpeg4 ! filesink location=/dev/video_stream
然后我在上使用了面部检测教程
I then used the face detection tutorial at
进行所有测试,但是将我的输入从网络摄像头1更改为namedpipe.
to test everything, but changed my input from webcam 1 to the namedpipe.
capture = cvCaptureFromCAM( -1 );
成为
VideoCapture capture("/dev/video_stream");
这篇关于Gstreamer不会沉入命名管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!