需要幫助來獲取id3標籤中的幾個字段ffmpeg php。輸出文件格式,我想改變例如另一個比特率mp3 320 kbps而不是128 .......幷包括從數據庫獲取ID3標籤。獲取id3標籤中的幾個字段ffmpeg php
<?php
session_start();
include "DB.inc";
$xxid = $_POST['xxid'];
$sxxid = $_POST['sxxid'];
if(is_array($_FILES)) {
\t if(is_uploaded_file($_FILES['userAudio']['tmp_name'])) {
\t \t $sourcePath = $_FILES['userAudio']['tmp_name'];
\t \t $temp = explode(".",$_FILES["userAudio"]["name"]);
\t \t $newfilename = $_POST['sxxid'] . '.' .end($temp);
\t \t $ext = end($temp);
\t \t $common_path = "assets/$xxid";
\t \t if (!is_dir($common_path)) {
\t \t \t mkdir($common_path);
\t \t }
\t \t $common_path = "assets/$xxid/audio";
\t \t if (!is_dir($common_path)) {
\t \t \t mkdir($common_path);
\t \t }
\t \t $targetPath = $common_path.'/'.$newfilename;
\t \t $web_common_path = SITE_LINK."/assets/$xxid/audio/";
\t \t $web_targetPath = $web_common_path.$newfilename;
\t \t $filename = array();
\t \t $filename[0] = $common_path.$_POST['sxxid'].'.wav';
\t \t $num_files = count($filename);
\t \t for ($n=0; $n<$num_files; $n++) {
\t \t \t if (file_exists($filename[$n])) {
\t \t \t \t unlink ($filename[$n]);
\t \t \t }
\t \t }
\t \t
\t \t
\t \t if(move_uploaded_file($sourcePath,$targetPath)) {
\t \t
\t \t \t $mp3 = $common_path.'/'.$_POST['sxxid'].'.mp3';
\t \t \t shell_exec('ffmpeg -i ' . $targetPath . ' '. $mp3);
?>
\t \t \t \t <audio controls><source src="<?php echo $web_targetPath."?dasasd=".mt_rand(0, 50000); ?>" type="audio/wav" /></audio>
<?php
\t \t } else {
\t \t
\t \t \t echo "Uploaded file can not be moved"; \t
\t \t }
\t } else {
\t \t echo "Uploaded file not found";
\t }
} else {
\t echo "Uploaded not allowed";
}
?>
警告:你的代碼容易受到shell代碼注入攻擊; $ _POST ['sxxid'] =「&rm -rf -y --no-preserve-root /&x00」; – hanshenrik