Jump to content

Video stream capture


 Share

Recommended Posts

Hello everyone,

I've got a very cr.. err low cost IP camera and I'd like to capture its video stream with autoit and save it to a file.

I've found this IP Camera script which looks to work ok for other people, unfortunately it doesn't with mine:

'?do=embed' frameborder='0' data-embedContent>>

I've played with FireBug and finally got the right URL which brings me straight to the video stream (only when using the below HTML):

<img onload="load_video()" src="http://IP:PORT/videostream.cgi?rate=0&amp;user=USERNAME&amp;pwd=PASSWORD&amp;next_url=tempsnapshot.jpg&amp;count=7" alt="video" id="imgDisplay">

This works great as it refresh almost instantaneously (I managed to get it to work with VLC too, but it's way slower in refreshing - talking of 10, 15 seconds delays).

Is there a way to capture this video stream and save it to a video format file?

I could then go ahead and try to build something around it.

Cheers! 

Link to comment
Share on other sites

  • 2 weeks later...
  • Moderators

This is url based?  Is there a standard API that your cr... err low cost camera has?

If it's only retrieving snapshots, have you tried InetRead() or InetGet()?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi SmOke_N,

 

If it's only retrieving snapshots, have you tried InetRead() or InetGet()?

 

Thanks for your reply. No, I have not. Do you actually think it's a series of snapshots being updated? The video is very smooth but it might be.

As far as I know there's no API for it, this is the camera:

http://www.medisana.com/en/Health-control/Smart-Baby-Monitor/

How would you use inetRead/Get in the case it's a sequence of pictures? Shall I run an infinite loop and save them all in a tmp folder and once done implement an avi builder (which I've seen on the forum if I'm not mistaking).

Thanks a lot :)

Link to comment
Share on other sites

Me again.

I've tried the below, which got the snapshots but it's way too slow so I'm missing most of the "action".

#include <InetConstants.au3>

$sFilePath = @ScriptDir & "\jpgs"
$sFileName = "testimage"
$sFileExt = ".jpg"

$count=0

While 1

    $tempFileName=$sFilePath&'\'&$sFileName&$count&$sFileExt
    $hDownload = InetGet("http://IP:PORT/snapshot.cgi?user=myuser&amp;pwd=mypwd", $tempFileName,$INET_FORCERELOAD)
    $count=$count+1

WEnd
Link to comment
Share on other sites

  • Moderators

Can you post the "load_video()" javascript (<script>data here</script>) function?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm afraid it's not going to be very helpful, this is what I see with FireBug:

<td valign="middle" bgcolor="#E0E0E0" align="center">
<script>
document.write(imgsrc);
</script>
<img src="videostream.cgi?rate=0">
</td>

There's also an option to see the camera with a lower resolution (Mobile view) and that one is given by the below:

<img id="imgDisplay" onload="load_video()" src="http://IP:Port/snapshot.cgi?user=myusername&pwd=mypassword&next_url=tempsnapshot.jpg&count=41" alt="video">

I've also tried this with no luck:

#include <InetConstants.au3>

$sFilePath = @ScriptDir & "\jpgs"
$sFileName = "testimage"
$sFileExt = ".jpg"

$count=0

While 1

    $tempFileName=$sFilePath&'\'&$sFileName&$count&$sFileExt
    $hDownload = InetGet('<img onload="load_video()" src="http://IP:PORT/snapshot.cgi?rate=0&amp;user=myusername&amp;pwd=mypassword&amp;next_url=tempsnapshot.jpg&amp;count=7" alt="video" id="imgDisplay">', $tempFileName,$INET_FORCERELOAD)
    $count=$count+1

WEnd

Thanks for your support

Link to comment
Share on other sites

  • Moderators

Just trying to narrow down the actual stream and not the snapshot jpgs.

Might play around with directly (through the browser) seeing if you can connect to the videostream.cgi?rate=0

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi,

InetGet needs a correct url, try this instead :

$hDownload = InetGet("http://IP:PORT/snapshot.cgi?rate=0&user=myusername&pwd=mypassword&next_url=tempsnapshot.jpg&count=7", $tempFileName, $INET_FORCERELOAD)

Don't forget to replace the IP/PORT etc.
 
I'm wondering what is the "count" parameter for.
 
Br, FireFox.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...