繁体   English   中英

如何在php中编码视频并将编码后的视频保存在文件中,然后将其解码并保存在数据库中

[英]how to encode video in php and save that encoded video in a file and then decode and save it in a database

我已经使用html在Php中编码了视频,现在我想将其解码并保存在php中。 但是我不知道如何保存编码的视频以及如何将其解码。 帮帮我,我在这里附上我的代码

<html>
  <video controls>
    <source type="video/mp4" src="<?php echo getEncodedVideoString('mp4','add.mp4');?>">
  </video>
</html> 
<?php
  include("connect.php");
  function getEncodedVideoString($type, $file) {
    $filename= 'data:video/' . $type . ';base64,' . base64_encode(file_get_contents($file));
    echo $filename;
?>

刚看到您的问题... :)您缺少大括号}

echo $filename; <---- Why echo $filename??? 

使用此代替:

function getEncodedVideoString($type, $file) {
    return 'data:video/' . $type . ';base64,' . base64_encode(file_get_contents($file));
}`

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM