gpt4 book ai didi

php - 在ffmpeg文件名变量php中转义单引号

转载 作者:行者123 更新时间:2023-12-04 23:35:10 27 4
gpt4 key购买 nike

代码工作正常,但如果文件名只有一个 qoute,就像“Britney's video.mp4”一样,它就不起作用。

$ffmpeg = "/usb/bin/local/ffmpeg";
$videos = "/videos/*.mp4";
$ouput_path = "/videos/thumbnails/";


foreach(glob($videos) as $video_file){

$lfilename = basename($video_file);
$filename = basename($video_file, ".mp4");
$thumbnail = $ouput_path.$filename.'.jpg';
if (!file_exists($filename)) {
#$thumbnail = str_replace("'", "%27", $thumbnail);
exec("/usr/local/bin/ffmpeg -i '$video_file' -an -y -f mjpeg -ss 00:00:30 -vframes 1 '$thumbnail'");
}
echo "<a href='$lfilename'>$filename<img src='thumbnails/$filename.jpg' width='350'>";

最佳答案

我让它工作但没有使用过于复杂的东西。
谢谢大家

$comd = "/usr/local/bin/ffmpeg -i \"$video_file\" -y -f mjpeg -ss 00:00:30 -vframes 1 \"$thumbnail\" 2>&1"; shell_exec($comd);
shell_exec($comd);

关于php - 在ffmpeg文件名变量php中转义单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40733458/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com