udp - perl - how do I capture a multicast [video] stream? -
i trying record multicast stream coming webcam, , record file. can access multicast stream , see video vlc, can't see when try play file i'm writing via perl.
here's code:
use strict; use warnings; use io::socket::multicast; $group = shift @argv; $port = shift @argv; # set stream $stream = io::socket::multicast->new(proto=>'udp', localport => $port); $stream->mcast_add($group) or die "couldn't set group: $!\n"; # date , time. we'll use name stream file $fname = `date +%y-%m-%dt%h_%m_%s`; chomp $fname; $fname .= ".mpg"; open (my $file, ">", $fname) or die "couldn't open file $fname writing: $!"; binmode($file); print "streaming $group:$port $fname!\n"; $i (0..500){ $data; next unless $stream->recv($data,1024); print "data received! $i \n"; print {$file} $data; } close ($file);
wireshark shows protocol of stream mpeg ts
.
i appreciate assistance!
Comments
Post a Comment