John Smith
John Smith

Reputation: 283

Live streaming doesn't work

I'm using FFmpeg to capture my screen:

ffmpeg -f dshow -i video="UScreenCapture" -r 5 -s 640x480 -acodec libmp3lame -ac 1 -vcodec mpeg 4 -vtag divx -q 10 -f mpegts tcp://127.0.0.1:1234

so let it stream to somewhere. The accepter script:

 error_reporting(E_ALL); /* Allow the script to hang around waiting for connections. */
 set_time_limit(30); /* Turn on implicit output flushing so we see what we're getting as it comes in. */
 ob_implicit_flush();


$address = '127.0.0.1';
$port = 1234;
$outfile = dirname(__FILE__)."/output.flv";
$ofp = fopen($outfile, 'wb');

 if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; sleep (5); die; }
 if (socket_bind($sock, $address, $port) === false) { echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
 if (socket_listen($sock, 5) === false) { echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
 if (($msgsock = socket_accept($sock)) === false) { echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); break; }
 do {
    $a = '';
    socket_recv ($msgsock, $a, 65536, MSG_WAITALL);
    fwrite ($ofp, $a);
    //echo strlen($a)."\r\n";
 } while (true);

it seems to save the stuff to the disk OK. Now here comes the html:

I dont really know how to do this, but based on an example:

<video src="/output.flv"></video>

but it doesn't do anything. And if I want to stream the live incoming stuff, then what's the matter?

Upvotes: 1

Views: 279

Answers (1)

Thirumalai murugan
Thirumalai murugan

Reputation: 5896

HTML 5 Video will not support the Flv format HTML5 will be support the following format video only

.mp4 = H.264 + AAC
.ogg/.ogv = Theora + Vorbis
.webm = VP8 + Vorbis

study the HTML5 video basics in the following site HTML5 video basics

if you want to play the flv you have to use the flash or Flex program or some flv players like flowplayer

Upvotes: 1

Related Questions