![]() |
| | #1 |
| Registered User Join Date: Jun 2009
Posts: 2
| Low level program to save a mjpeg stream Well first I’ll just say I am a complete Linux beginner, but I have done vbs, js, php, html web type stuff so I’m not a complete beginner to programming. However I've been trying to learn C and python but it’s not making a huge amount of sense. I am wanting to make a simple low level program that copies an image from a mjpeg stream on 192.168.0.1/videostream.cgi for example to a variable then save that variable to a file on my system. I am aware that there are programs out there that would do this but I still want to make my own. Any help? Thanks Rufe0 |
| Rufe0 is offline | |
| | #2 |
| &TH of undefined behavior Join Date: Aug 2001
Posts: 5,183
| Low level...nah You can do this with a python script Code: #!/usr/bin/env python
import urllib
imageUrl = "http://www.cprogramming.com/cprog.gif"
fileName = imageUrl[imageUrl.rfind("/")+1:]
imageFile = urllib.urlopen(imageUrl)
outFile = open(fileName,"wb")
outFile.write(imageFile.read())
outFile.close()
imageFile.close()
print("%s saved" % fileName)
__________________ "If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut." Albert Einstein (1879 - 1955) Board Rules |
| Fordy is offline | |
| | #3 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,943
| Get ready to say OUCH!!! This is how I've done it in C. It is more than ten times the amount of coding as it is in python...but all the low level stuff you were just dying to see is there ![]() ps. looks like this one uses my old header file: mine.h pps. I bet it is faster than the python version tho
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 06-26-2009 at 01:41 PM. |
| MK27 is online now | |
| | #4 |
| &TH of undefined behavior Join Date: Aug 2001
Posts: 5,183
|
__________________ "If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut." Albert Einstein (1879 - 1955) Board Rules |
| Fordy is offline | |
| | #5 |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 891
| Good work, with a few comments: 1) Single byte recv() and read()s, ouch. 2) You mix read and recv calls on a socket, why? 3) If the first byte is \n, Recept will go out of bounds on that buffer. 4 & 5 & 6) And you run that as root? (the hardcoded /root/test/... seems to say so!) 7) Doesn't answer the OP's question? OP: You're going to need a lot of information to be able to do that. First, you have to understand HTTP. Once you get past that, you'll need to know what container format your data is going to come in (mjpeg is a video codec. Like MP3, it can be by itself, but I've never actually seen that. Usually it's packaged in something like an AVI.). Are you sure they're streaming mjpeg? mjpeg is a terrible codec - especially over a network... 30 jpeg files / sec consumes bandwidth way quicker than most other codecs.
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) |
| Cactus_Hugger is offline | |
| | #6 |
| Registered User Join Date: Jun 2009
Posts: 2
| Thanks for the replys I am now trying to get into contact with the manufactuor who we deal with directly to see what he can do to help me. A firmware update of this device would make the program much easier to write. Last edited by Rufe0; 06-29-2009 at 05:52 AM. |
| Rufe0 is offline | |
| | #7 | |
| Registered User Join Date: Sep 2009
Posts: 1
| Looking for work? Are you looking for a gig with C\C++ video streaming? email: greg@infoincontext.com Quote:
| |
| gvmoney is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Low level access to parallel ports under win2k | Incubus | Windows Programming | 1 | 04-23-2002 01:52 AM |
| Low level debuggers | Korn1699 | C++ Programming | 8 | 03-27-2002 01:39 PM |
| A small problem with a small program | Wetling | C Programming | 7 | 03-25-2002 09:45 PM |
| willing to pay for University level C++ Program | need help | C++ Programming | 6 | 03-12-2002 12:22 AM |
| Looking low level tcp/ip tracker program | Hoxu | Windows Programming | 3 | 01-07-2002 11:46 PM |