我试图在exec上运行以下命令:
ffmpeg -y -i video.mp4 \
-ss 1067 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/6.ts \
-ss 1215 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/7.ts如果我复制这个命令并在shell上运行它
但是,运行低谷php,ffmpeg将返回以下错误:
[NULL @ 052a0060] Unable to find a suitable output format for '\'
\: Invalid argument即使我像这样复制粘贴命令:
<?php
$command = 'ffmpeg -y -i video.mp4 \
-ss 1067 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/6.ts \
-ss 1215 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/7.ts';
echo $command.chr(10);
$return = 0;
$output = array();
exec($command, $output, $return);
?>我是不是遗漏了什么?我试过逃逸,越狱,甚至双反斜杠来逃避反斜杠,什么都没有。
这在windows和Unix中都会发生,错误完全相同。
知道这是怎么回事吗?
发布于 2015-03-17 22:47:54
在本例中,shell脚本中的反斜杠()仅用于使其忽略换行(参考文献)
因此,尝试在单行中运行不带反斜杠的命令:
<?php
$command = 'ffmpeg -y -i video.mp4 -ss 1067 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/6.ts -ss 1215 -i video.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -t 32 tmp/cuts/7.ts';
(...)
?>https://stackoverflow.com/questions/29111014
复制相似问题