我有多个已编码的文件(它们具有相同的格式和大小 em> )我想在一个视频(已经存在并且必须被覆盖 em>)上连接。 p>
在官方FAQ文档我应该使用demuxer p>
FFmpeg有一个concat demuxer,当你想避免重新编码时你可以使用它,你的格式不支持文件级连接。 p>
blockquote>
< 问题是我应该使用 其中 怎么能 我用PHP吗? p>
还尝试使用concat协议 strong> p>
我尝试使用 生成此命令行: p>
但是我收到了这个错误: p>
\ n
.txt code>文件和一个使用此命令行的文件列表 p>
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output code> p>
mylist.txt code>应为: p>
< code> file'/ path / to / file1'
file'/ path / to / file2'
file'/ path / to / file3'
code> pre>
\ n concat协议 code>重新编码视频 代码: p>
$ cli = FFMPEG。' -y -i \'concat:';
foreach($ data as $ key =&gt; $ media){
$ tmpFilename = $ media ['id'];
$ tmpPath = $ storePath。'/ tmp /'.$ tmpFilename。'。mp4';
if($ key!=($ dataLenght - 1)){
$ cli。= $ tmpPath。'|';
} else {
$ cli。= $ tmpPath。'\'';
}
}
$ cli。=' - c copy'。$ export;
exec($ cli);
code> pre>
/ usr / local / bin / ffmpeg -i'concat:/ USER / storage / app / public /video/sessions/590916f0d122b/tmp/1493768472144.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493767926114.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp /1493771107551.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493771114598.mp4'-c:v libx264 /USER/storage/app/public/video/sessions/590916f0d122b/tmp_video_session.mp4 < / code> p>
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8aa800000]发现 复制的MOOV Atom。 跳过它 code> p>
div>
I have multiple files that are already been encoded (they have the same format and size) I would like to concatenate on a single video (that already exist and has to be overwritten).
Following the official FAQ Documentation I should use demuxer
FFmpeg has a concat demuxer which you can use when you want to avoid a re-encode and your format doesn’t support file level concatenation.
The problem is that I should use a .txt
file with a list of files using this command line
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
where mylist.txt
should be:
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
How can I do with PHP?
Also tried with concat protocol
I tried using also the concat protocol
that re-encode videos with these lines of code:
$cli = FFMPEG.' -y -i \'concat:';
foreach ($data as $key => $media) {
$tmpFilename = $media['id'];
$tmpPath = $storePath.'/tmp/'.$tmpFilename.'.mp4';
if ($key != ($dataLenght - 1)) {
$cli .= $tmpPath.'|';
} else {
$cli .= $tmpPath.'\'';
}
}
$cli .= ' -c copy '.$export;
exec($cli);
that generate this command line:
/usr/local/bin/ffmpeg -i 'concat:/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493768472144.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493767926114.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493771107551.mp4|/USER/storage/app/public/video/sessions/590916f0d122b/tmp/1493771114598.mp4' -c:v libx264 /USER/storage/app/public/video/sessions/590916f0d122b/tmp_video_session.mp4
but I got this error:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8aa800000] Found duplicated MOOV Atom. Skipped it