1

我已经使用 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;
?>
4

1 回答 1

2

刚刚看到你的问题...... :) 你缺少一个大括号}

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

改用这个:

function getEncodedVideoString($type, $file) {
    return 'data:video/' . $type . ';base64,' . base64_encode(file_get_contents($file));
}`
于 2017-05-31T03:01:02.310 回答