<small id='CyRFs'></small><noframes id='CyRFs'>

      • <bdo id='CyRFs'></bdo><ul id='CyRFs'></ul>
    1. <tfoot id='CyRFs'></tfoot>

      <legend id='CyRFs'><style id='CyRFs'><dir id='CyRFs'><q id='CyRFs'></q></dir></style></legend>
      <i id='CyRFs'><tr id='CyRFs'><dt id='CyRFs'><q id='CyRFs'><span id='CyRFs'><b id='CyRFs'><form id='CyRFs'><ins id='CyRFs'></ins><ul id='CyRFs'></ul><sub id='CyRFs'></sub></form><legend id='CyRFs'></legend><bdo id='CyRFs'><pre id='CyRFs'><center id='CyRFs'></center></pre></bdo></b><th id='CyRFs'></th></span></q></dt></tr></i><div id='CyRFs'><tfoot id='CyRFs'></tfoot><dl id='CyRFs'><fieldset id='CyRFs'></fieldset></dl></div>

        如何通过 OpenCV 处理 VLC UDP 流

        时间:2023-09-28

        <tfoot id='QoOfg'></tfoot>
        • <legend id='QoOfg'><style id='QoOfg'><dir id='QoOfg'><q id='QoOfg'></q></dir></style></legend>
            <tbody id='QoOfg'></tbody>
        • <small id='QoOfg'></small><noframes id='QoOfg'>

          <i id='QoOfg'><tr id='QoOfg'><dt id='QoOfg'><q id='QoOfg'><span id='QoOfg'><b id='QoOfg'><form id='QoOfg'><ins id='QoOfg'></ins><ul id='QoOfg'></ul><sub id='QoOfg'></sub></form><legend id='QoOfg'></legend><bdo id='QoOfg'><pre id='QoOfg'><center id='QoOfg'></center></pre></bdo></b><th id='QoOfg'></th></span></q></dt></tr></i><div id='QoOfg'><tfoot id='QoOfg'></tfoot><dl id='QoOfg'><fieldset id='QoOfg'></fieldset></dl></div>

              <bdo id='QoOfg'></bdo><ul id='QoOfg'></ul>

                  本文介绍了如何通过 OpenCV 处理 VLC UDP 流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我能够通过 VLC 命令行接收/查看 UDP h264 数据包(即 VLC --network-caching 0 --demux h264 udp://...)

                  I was able to receive/view UDP h264 packets through VLC command line (i.e. VLC --network-caching 0 --demux h264 udp://...)

                  我计划通过 OpenCV 算法处理这些帧.但是,我似乎找不到将 VLC 帧发送到我的 Python OpenCV 脚本的方法.

                  I am planning on processing those frames through OpenCV algorithms. However, I can't seem to find a way to send the VLC frames over to my Python OpenCV script.

                  是否可以通过管道在单独的脚本中通过 Numpy 处理 VLC 流输出?

                  Is it possible to pipe VLC stream output to be processed through Numpy in a separate script?

                  我之前曾尝试使用其 VideoCapture 功能直接流式传输到 OpenCV,但由于某种原因,视频停顿并停止在扭曲的黑色图像上.目前看来,合并 VLC 似乎是唯一的解决方案(尽管我不完全确定为什么 VLC 优于其他方法).

                  I have previously tried directly streaming to OpenCV by using its VideoCapture function, but for some reason, the video stalls and stops at a distorted black image. For now, it seems like incorporating VLC is the only solution (even though I am not totally sure why VLC works over other methods).

                  谢谢.

                  以下是终端上的错误消息片段.前几帧似乎有问题,但我不知道为什么流在 VLC 上工作.从客户端,我先发送了一个默认的关键帧数据,然后发送了video feed h264数据.

                  The following is a snippet of the error message on the terminal. It seems like there are problems with the first few frames, but I don't know why the stream works on VLC. From the client, I first sent a default key frame data, and then sent video feed h264 data.

                  [h264 @ 0x7f9c50020200] top block unavailable for requested intra mode -1
                  [h264 @ 0x7f9c50020200] error while decoding MB 7 0, bytestream 7208
                  [h264 @ 0x7f9c50020200] top block unavailable for requested intra mode -1
                  [h264 @ 0x7f9c50020200] error while decoding MB 8 9, bytestream 7381
                  

                  推荐答案

                  你可以使用 ffmpeg用于流式传输.

                  You can use ffmpeg for streaming.

                  在终端中首次测试 ffmpeg 流.在 linux 中,我们使用 v4l2 从相机中抓取帧.

                  First test ffmpeg streaming in terminal. In linux, we use v4l2 to grab frames from camera.

                  服务器:

                  ffmpeg -f v4l2 -i /dev/video0 -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -f h264 udp://127.0.0.1:5000
                  

                  客户:

                  ffplay udp://127.0.0.1:5000
                  

                  如果您能够在客户端查看流,那么我们可以使用 OpenCV 进行图像处理.OpenCV 必须有 ffmepg 支持.有关 ffmpeg 支持检查,请参阅 此链接.

                  If you're able to view the stream on the client side, then we can use OpenCV for image processing. OpenCV must have ffmepg support. See this link for ffmpeg support check.

                      cap = cv2.VideoCapture('udp://127.0.0.1:5000',cv2.CAP_FFMPEG)
                      if not cap.isOpened():
                          print('VideoCapture not opened')
                          exit(-1)
                  
                      while True:
                          ret, frame = cap.read()
                  
                          if not ret:
                              print('frame empty')
                              break
                  
                          cv2.imshow('image', frame)
                  
                          if cv2.waitKey(1)&0XFF == ord('q'):
                              break
                  
                      cap.release()
                      cv2.destroyAllWindows()
                  

                  这篇关于如何通过 OpenCV 处理 VLC UDP 流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Python 中接收广播数据包 下一篇:看不到来自另一台设备的 UDP 多播消息

                  相关文章

                    <bdo id='ipoRW'></bdo><ul id='ipoRW'></ul>
                  <tfoot id='ipoRW'></tfoot>

                    1. <i id='ipoRW'><tr id='ipoRW'><dt id='ipoRW'><q id='ipoRW'><span id='ipoRW'><b id='ipoRW'><form id='ipoRW'><ins id='ipoRW'></ins><ul id='ipoRW'></ul><sub id='ipoRW'></sub></form><legend id='ipoRW'></legend><bdo id='ipoRW'><pre id='ipoRW'><center id='ipoRW'></center></pre></bdo></b><th id='ipoRW'></th></span></q></dt></tr></i><div id='ipoRW'><tfoot id='ipoRW'></tfoot><dl id='ipoRW'><fieldset id='ipoRW'></fieldset></dl></div>

                    2. <small id='ipoRW'></small><noframes id='ipoRW'>

                      <legend id='ipoRW'><style id='ipoRW'><dir id='ipoRW'><q id='ipoRW'></q></dir></style></legend>