Ich habe mehrere Dateien, die bereits codiert sind, wurden (sie haben das gleiche Format und Größe) ich auf einem einzigen Video verketten möchte (, die bereits vorhanden und muss werden überschrieben).Concatenate mehrere Video-php ffmpeg
Nach den official FAQ Documentation I 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.
Das Problem verwenden soll, ist, dass ich eine .txt
Datei mit einer Liste von Dateien mit dieser Befehlszeile
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
verwenden sollte, wo mylist.txt
sollte :
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
Wie kann ich mit PHP machen?
auch versucht, mit concat Protokoll
ich mit auch versucht, die concat protocol
, die mit diesen Zeilen Code neu kodieren Videos:
$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);
, die diese Befehlszeile erzeugen:
/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
aber ich habe diesen Fehler:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8aa800000] Found duplicated MOOV Atom. Skipped it
Fragen Sie, wie Sie eine Textdatei in PHP erstellen? –
Nun, ich frage, wie man mehrere Dateien mit ffmpeg und php verketten kann, aber ich kann das auf zwei Arten erreichen. Das Beste ist die Benutzung des Demuxers ... also auf diese Weise, ja, wenn es möglich ist ... –