如何在不连接流的情况下从视频流中抓取单个图像(带宽问题) [英] How to grab a single image from a video stream without connecting the stream (bandwidth issue)

查看:71
本文介绍了如何在不连接流的情况下从视频流中抓取单个图像(带宽问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定是否可行,但是如何在不连接流 (rtsp) 本身的情况下从视频流中获取单个图像(我有带宽问题)?

Not sure it is possible, but how can I get a single Image from video stream WITHOUT connecting the stream (rtsp) itself (I have bandwidth issue)?

(python 优先,但任何代码框架/语言都可以).

(priority to python but any code framework/language will be good).

这是流的示例 SDP 文件:

This is an example SDP file of the stream:

v=0
o=Teleste 11501847 688 IN IP4 1.1.1.1
s=unnamed (mpeg4/tx-1)
i=Teleste MP-X AUDIO/VIDEO Encoder
c=IN IP4 221.1.1.1/64
t=0 0
m=video 4002 RTP/AVP 96
b=AS:6400
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1;config=000001B005000001B509000001000000012000C4F84048800F516843C1463F

我有一个在与流建立连接后提取单个图像的解决方案,但我正在寻找一种解决方案,由于带宽问题,它不需要完全连接到流.

I have a solution for extract a single image after establish a connection to the stream, but I'm looking for a solution that will not require a full connection to the stream because of the bandwidth issue.

我是视频流世界的新手,任何想法或建议都会很好.

I'm new with the video streaming world and any idea or suggestion will be good.

谢谢

推荐答案

除非您的服务器支持某些功能来提供此功能,否则我认为您无法在不连接到流的情况下从流中获取某些内容.

Unless your server supports some functionality to provide this, I don't think you can get something from the stream without connecting to the stream.

您大概已经有了一些解决方案,可以连接、获取框架,然后断开连接,我猜.如果您不知道,您也可以使用以下命令通过 ffmpeg 执行此操作,尽管我不确定带宽开销是多少或它如何在幕后打开和关闭连接 - 您需要对其进行试验以查看:

You presumably already have some solution which will connect, get a frame, and then disconnect, I am guessing. In case you are not aware you can also do this via ffmpeg with the following command, although I am not sure what the bandwidth overhead is or how it opens and closes the connection under the covers - you would need to experiment with it to see:

ffmpeg -y -i rtsp://your_rtsp_strea -frames:v 1 output.jpg

ffmpeg -y -i rtsp://your_rtsp_strea -frames:v 1 output.jpg

值得注意的是,所使用的编解码器会影响您需要的帧数 - 简单的编解码器或编解码器配置文件将分别对每一帧进行编码,但其他人将每帧都有参考帧,例如第 10 帧和中间的帧将被编码为参考帧的增量.因此,除了目标帧之外,您还需要实际获取上一个参考帧,有时甚至下一个参考帧才能实际提取图像.

Its worth noting that the codec in use will affect the number of frames you need - simple codecs or codec profiles will encode each frame separately, but others will have reference frames every, for example, 10th frame and the frames in-between will be encoded as a delta to the reference frames. Hence, you need to actually get the previous and sometimes even the next reference frame in addition to your target frame to actually extract the image.

如果您的流在 DASH 或 HLS 中可用,那么您还可以选择只下载一个片段 - 这些协议已经将视频流分成多个片段,通常长度在 2 到 10 秒之间.但是,您确实需要确保以所需的比特率下载片段 - 这些协议将具有多个比特率流以支持不同的分辨率和网络条件.

If your stream is available in DASH or HLS, then you also have the option to just download a single segment - these protocols will already have broken the video stream into multiple segments, typically somewhere between 2 and 10 seconds long. However, you do need to make sure you download the segment from the bitrate that you need - these protocols will have multiple bit rates streams to allow for different resolutions and network conditions.

这篇关于如何在不连接流的情况下从视频流中抓取单个图像(带宽问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆