Concat (#309)
* Fixed the way to throw an exception when we open the file in the Concat media.
This commit is contained in:
parent
fe47ab74ef
commit
a76f6528ff
1 changed files with 11 additions and 6 deletions
|
|
@ -91,19 +91,24 @@ class Concat extends AbstractMediaType
|
||||||
$sourcesFile = $fs->createTemporaryFile('ffmpeg-concat');
|
$sourcesFile = $fs->createTemporaryFile('ffmpeg-concat');
|
||||||
|
|
||||||
// Set the content of this file
|
// Set the content of this file
|
||||||
$fileStream = fopen($sourcesFile, 'w') or die("Cannot open file.");
|
$fileStream = @fopen($sourcesFile, 'w');
|
||||||
|
|
||||||
|
if($fileStream === false) {
|
||||||
|
throw new ExecutionFailureException('Cannot open the temporary file.');
|
||||||
|
}
|
||||||
|
|
||||||
$count_videos = 0;
|
$count_videos = 0;
|
||||||
if(is_array($this->sources) && (count($this->sources) > 0)) {
|
if(is_array($this->sources) && (count($this->sources) > 0)) {
|
||||||
foreach ($this->sources as $videoPath) {
|
foreach ($this->sources as $videoPath) {
|
||||||
$line = "";
|
$line = "";
|
||||||
|
|
||||||
if($count_videos != 0)
|
if($count_videos != 0)
|
||||||
$line .= "\n";
|
$line .= "\n";
|
||||||
|
|
||||||
$line .= "file ".$videoPath;
|
$line .= "file ".$videoPath;
|
||||||
|
|
||||||
fwrite($fileStream, $line);
|
fwrite($fileStream, $line);
|
||||||
|
|
||||||
$count_videos++;
|
$count_videos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +198,7 @@ class Concat extends AbstractMediaType
|
||||||
$complex_filter .= '['.$i.':v:0] ['.$i.':a:0] ';
|
$complex_filter .= '['.$i.':v:0] ['.$i.':a:0] ';
|
||||||
}
|
}
|
||||||
$complex_filter .= 'concat=n='.$nbSources.':v=1:a=1 [v] [a]';
|
$complex_filter .= 'concat=n='.$nbSources.':v=1:a=1 [v] [a]';
|
||||||
|
|
||||||
$commands[] = $complex_filter;
|
$commands[] = $complex_filter;
|
||||||
$commands[] = '-map';
|
$commands[] = '-map';
|
||||||
$commands[] = '[v]';
|
$commands[] = '[v]';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue