Skip to contentSkip to conversation

Extracting video stream

linux-dvb Jelle De Loecker 2 participants 2 messages Jan 29, 2009 – Feb 2, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi everyone,

This is not a real -dvb question, but -media seemed too official.

A device of mine is serving a video stream on a certain port, (Hawking HNC210, video surveillance cam)
unfortunately it uses its own (very simple) protocol: it's a bunch of jpegs in a row.

I have this script that checks the stream every second and creates a jpeg out of it,
but I really want a continuous video stream. Is there a way to do this?

This is the script:

#!/usr/bin/perl
use IO::Socket;
#SET WHERE CAMERA IS
$sock = new IO::Socket::INET (PeerAddr => '10.11.0.101',

                                PeerPort => 4321,
                                Proto    => 'tcp',
                                Timeout  => 1);

#do it again forever
while (1){
#sleep timeout (this value give us 1fps)
select(undef, undef, undef, 0.5);

$sock->send("0110\n");
$sock->read($size, 2);
$sock->read($j1, 1);
$sock->read($j2, 1);
$j1=oct("0x".unpack("H*", $j1));
$j2=oct("0x".unpack("H*", $j2));
#print "J1_USERS:".$j1."\n";
#print "J2:".$j2."\n";
$size=oct("0x".unpack("H*", $size));
#print "SIZE:".$size."\n";
if ($size != 0) {
$sock->read($data, $size);
open OUTF, "> /var/www/hawking.jpg" or die "Can't open $outfile : $!"; print OUTF $data;
close OUTF;
}
}

Greetings,
Jelle De Loecker

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead [email protected] [email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#1 lore raw

Sorry for taking so long to reply...

Quoted 1 line · Jelle De Loecker

This is not a real -dvb question, but -media seemed too official.

Unfortunately, it is exactly the sort of question that belongs on -media (or the v4linux list it replaced), and has no bearing on DVB at all...

``Too official''? On a list where more than half the posts seem to discuss webcams and other analogue sources? Nevertheless...

Quoted 5 lines

unfortunately it uses its own (very simple) protocol: it's a bunch of jpegs in a row.
I have this script that checks the stream every second and creates a jpeg out of it,
but I really want a continuous video stream. Is there a way to do this?

I really don't know anything about this, but might MJPEG (a motion-picture series of JPEG images) be a solution?

You are far more likely to reach people who can help on the -media list, if you haven't received an off-list response already...

just saying,
barry bouwsma

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead [email protected] [email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb