How to grab a single image from a video stream without connecting the stream (bandwidth issue)

こ雲淡風輕ζ 提交于 2019-12-11 17:25:57

问题


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)?

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

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.

Thanks


回答1:


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.

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

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.

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.



来源:https://stackoverflow.com/questions/48620863/how-to-grab-a-single-image-from-a-video-stream-without-connecting-the-stream-ba

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