jeffbass / imagezmq

A set of Python classes that transport OpenCV images from one computer to another using PyZMQ messaging.
MIT License
1.01k stars 160 forks source link

is it possible to directly send video clips? #60

Open MeixinZhu opened 3 years ago

MeixinZhu commented 3 years ago

Thanks for this great repo! It works very nicely for sending images. I wonder whether it is possible to directly send video clips to remote servers? instead of sending frames to the server then combine them into a video.

jeffbass commented 3 years ago

No, imageZMQ is not suitable for sending video clips that are NOT implemented by sending individual image frames. With imageZMQ each image frame is a distinct ZMQ message. True "video streaming" with multiframe compression (like that used in most video streaming codecs) won't work with imageZMQ.

MeixinZhu commented 3 years ago

Hi Jeff, thanks for your reply. I got it. Do you know any other approaches for video streaming? Thanks!

timsu92 commented 3 years ago

You can use OpenCV to read a video into frames, and also use OpenCV to save them to a clip.

timsu92 commented 3 years ago

However, I don't think sending clips using this is ideal, because you need to decode and encode, which causes quality loss. Instead, it would be better to transmit the original bytes using 0mq, the upstream of this good work.

jeffbass commented 3 years ago

Hi @MeixinZhu, As @timsu92 mentioned, you may want to build your own video streaming protocol using ZeroMQ. If not, there are many video streaming protocols and applications to choose from. Which one to choose is really dependent on what you are trying to do. You might want to look at tutorials for ffmpeg or gstreamer. If you want to stream a webcam to a browser, you may want to start with one of these Webcam to Browser video streaming tutorials using Flask: PyImageSearch or Miguel Grinberg.

MeixinZhu commented 3 years ago

Thank you!! This is really helpful.