doubi4531 2012-07-10 18:38
浏览 51
已采纳

直播不起作用

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()) . "
"; sleep (5); die; }
 if (socket_bind($sock, $address, $port) === false) { echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "
"; sleep (5); die; }
 if (socket_listen($sock, 5) === false) { echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "
"; sleep (5); die; }
 if (($msgsock = socket_accept($sock)) === false) { echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "
"; sleep (5); break; }
 do {
    $a = '';
    socket_recv ($msgsock, $a, 65536, MSG_WAITALL);
    fwrite ($ofp, $a);
    //echo strlen($a)."
";
 } 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?

  • 写回答

1条回答 默认 最新

  • doudou5101 2013-02-13 06:37
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题