简体   繁体   中英

Streaming audio and video with Python

I need to make an application which streams live multimedia. At present my application is taking image frames from a webcam (using OpenCV) and sending it to the client. It is also sending audio using pymedia module. The problem is that both the image and audio packets that arrive at the client are out of sync.

So I have following questions:

  1. Is there any module in python for live-multimedia streaming?
  2. Can I make the audio and image frames somehow in sync for the client?

PS. pymedia has not been in development since 2006 and is not working.

You can try gst-python module.

refer to the gstPython Documentation for more detail.

You can use gstreamer's python module. I mean gst-python mentioned above. Use rtmp protocol to synchronize client/server videos. Last time I use gst-python, there was no support for rtmp. At the time, my solution was to limit buffer size. When buffer gets full oldest frames will be dropped.

What you need is a command-line application that does multimedia streaming, which should be much easier to find than a Python module. Your Python application would then call the streaming app using subprocess.Popen(), something like:

from subprocess import Popen, PIPE

cmd = "c:\Program Files\appdir\streamer.exe"
subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE).communicate())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM