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

如何用php编码视频并将编码后的视频保存在文件中,然后解码并保存在数据库中,php,android,html,Php,Android,Html,我用html用Php编码了一个视频,现在我想用Php解码并保存它。 但我不知道如何保存已编码的视频以及如何将其解码。 请帮帮我,我在这里附上我的代码 <html> <video controls> <source type="video/mp4" src="<?php echo getEncodedVideoString('mp4','add.mp4');?>"> </video> </html> <

我用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??? 

我在您的问题中添加了您的代码,以便更具可读性@Diego C Nascimento:不,我只想再次以.mp4格式解码,该格式应存储在现有数据库中的某个位置OHK,然后请告诉我如何将编码视频存储在文件中。@Diego C Nascimento很抱歉让您困惑,但实际上我的方案是我将从android应用程序,然后我必须解码该视频,并将其存储在myserver上。出于虚拟目的,我试图对其进行编码,然后解码并将视频存储在数据库中。希望你能理解我的情况,给我带来积极的结果。。
function getEncodedVideoString($type, $file) {
    return 'data:video/' . $type . ';base64,' . base64_encode(file_get_contents($file));
}`