Hi i have a live streaming code and i stream my web cam on the local host.
Here is my stream file code
<?php
function flush_buffers(){
ob_end_flush();
ob_flush();
flush();
ob_start();
}
header('Content-Type: video/mpeg');
$stream = fopen( 'http://localhost:8080/stream.mp2v', "rb" );
#$save = fopen("save.mp4", "w");
while ( ! feof( $stream ) )
{
$response = fread( $stream, 8192 );
echo $response;
#fwrite($save,$stream);
flush_buffers();
}
fclose( $stream );
fclose($save);
exit();
What I need to do is record this live streaming simultaneously to a file here i stated save.mp4 in my code.I tried to do that with fwrite but when i run the program with this code i could see my webcam running but it could not record anything to save.mp4.I dont think fwrite is a suitable function for my purpose.I need help in this point.What should i do?
Select Create > Record screen from your navigation bar in Stream. If needed for your recording, make sure your device's camera and microphone are enabled. Select to start recording. You'll then be prompted to choose what you want to record: your entire screen, an application window, or browser tab.
There are several ways to record a live stream. You can do it through an encoder, an online video player, or through a dedicated screen-capture tool. Let's take a look at how to record live streaming videos with each of these methods.
I should have written fwrite($save,$response);
instead of fwrite($save,$stream);
. It worked in this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With