A simple mjpeg streamer for python
I've been working with networking stuffs lately, like XML, parsing and lately streaming. Originally, I wanted to do this for my Android project which is still slightly veiled in secrecy. It will be open sourced completely though, when it matures. So, I wrote this application in an effort to understand the networking behind it and get it to work on Android. Frankly, I am not so good with Java and working with networking stuffs with objects. Everyday I appreciate more of that power though and it's fun to learn new things. I tend to practice with python first and after the proof of concept works there, I do it in Java. It's slightly roundabout way of doing things but it works for me.
What this application does is that it takes snapshots of the jpeg files from the server fast enough for making it seem like it's video.. Well, that's what it is anyways. Let's just say I haven't understood streaming and multi part files properly enough to implement. So, basically, it just sends a GET to the server and pulls the file one by one in a loop. It's really that simple.
The tricky part was to get it to display properly. Tkinter took care of that with Python Image Library. It would be easier if the files aren't jpeg though. That might be for future implementations but for now it's fine for what I'm doing with my Android project.
Anyways, I decided to open source it entirely at
http://code.google.com/p/mjpeg-stream-client/
That might be useful to someone, if nothing but just to learn a new thing or two about python. It' s fairly unpolished even as a basic tool but I hope to improve it to some degree to learn about multimedia streaming and threading concepts in python.
If the application was any bit useful, do drop a comment.
Here are the sources, if you wanted to view them right away
http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/StreamViewer.py
http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/client.py
Here's my picture after I finally got video in Android.. hehe. That program did serve a purpose. Phew!
Cheers!
What this application does is that it takes snapshots of the jpeg files from the server fast enough for making it seem like it's video.. Well, that's what it is anyways. Let's just say I haven't understood streaming and multi part files properly enough to implement. So, basically, it just sends a GET to the server and pulls the file one by one in a loop. It's really that simple.
The tricky part was to get it to display properly. Tkinter took care of that with Python Image Library. It would be easier if the files aren't jpeg though. That might be for future implementations but for now it's fine for what I'm doing with my Android project.
Anyways, I decided to open source it entirely at
http://code.google.com/p/mjpeg-stream-client/
That might be useful to someone, if nothing but just to learn a new thing or two about python. It' s fairly unpolished even as a basic tool but I hope to improve it to some degree to learn about multimedia streaming and threading concepts in python.
If the application was any bit useful, do drop a comment.
Here are the sources, if you wanted to view them right away
http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/StreamViewer.py
http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/client.py
Here's my picture after I finally got video in Android.. hehe. That program did serve a purpose. Phew!
Cheers!
Comments
Starting from your code, I am working on an application which to display as many streams I want, and to run it on any platform I want. My office runs FreeBSD on workstations, clients offices on windows.
Thank you!
please help me
just a simple code
The video is blinking because when you are displaying images you need to hold the photoimage in 2 copies.
When you change image the garbage collector starts working and the image disappear and blinks. you can search for it in google.
Also you didn't use mjpeg streaming protocol - there is a simple client code using reactor and python twisted library (called: python-mjpeg-over-http-client).
visit
free money to learn and earn more money.
व्यक्तिगत व्यवसायका लागि ऋण चाहिन्छ? तपाईं आफ्नो इमेल संपर्क भने उपरोक्त तुरुन्तै आफ्नो ऋण स्थानान्तरण प्रक्रिया गर्न
ठीक।