Loading...
Обучение/Помощь новичкам | Помогите с кодом за деньги
Есть код, в нём нужно интегрировать функцию получения нескольких изображения с видео, а не только один с 20сек начала видео. Кусочек основного кода:



// Скрин
$check_screen = $db->query("SELECT `id` FROM `video_screen` WHERE `id_video` = '". $file['id'] ."'");
if ($db->numRows($check_screen)==0){
$x = 0;
for ($x=0; $x++<$set['max_fotoVideo'];){
if (is_file(H."video/foto/mini/" . $file['id'] . "_" . $x . ".png")){
if ($file['ext'] != '.mp4')echo "<img src = '/video/foto/mini/" . $file['id'] . "_" . $x . ".png' itemprop='thumbnail' height='" . $set['size_foto_2'] . "px' style='padding: 5px;' alt='" . filter(str_replace('_', ' ', $file['name2'])) . "' />";
} else {
// Главная
if ($x == 1){
$id_res = $db->query("INSERT INTO `video_screen` (`id_video`, `screen_key`, `time`, `oblozhka`, `num`) VALUES ('". $file['id'] ."', '".$file['id'] . "_" . $x ."', '".time()."', '1', '".$x."')");
$fotoid = $db->insertId($id_res);
$db->query("UPDATE `video_file` SET `logo` = '".$x."' WHERE id = '". $file['id'] ."' LIMIT 1");
} else {
$db->query("INSERT INTO `video_screen` (`id_video`, `screen_key`, `time`, `num`) VALUES ('". $file['id'] ."', '".$file['id'] . "_" . $x ."', '".time()."', '".$x."')");
}
$moment_s = (15 * $x);

$frames_count = $ThisFileInfo['quicktime']['video']['frame_count'];
$frames_rate = $ThisFileInfo['quicktime']['video']['frame_rate'];
$seconds = ceil($frames_count/$frames_rate);
for($k=1; $k<=$seconds-15; $k=$k+$moment_s){
$frame = ceil($k*$frames_rate);
echo $frame."<br>";
shell_exec('ffmpeg -ss 00:00:20 -i "'.H.'video/video/'.$file['id'].$file['ext'].'" -f image2 -vframes '.$frame.' "'.H.'video/foto/mini/'.$file['id'].'_'.$x.'.png"');

$image = new SimpleImage();

$image->load(H.'video/foto/mini/'.$file['id'].'_'.$x.'.png');
$image->resize(640, 420);
$image->save(H.'video/foto/mini/'.$file['id'].'_big.png');

$image->load(H.'video/foto/mini/'.$file['id'].'_'.$x.'.png');
$image->resize(338, 190);
$image->save(H.'video/foto/mini/'.$file['id'].'_'.$x.'.png');

}
header('Location: /watch/' . $file['name_translit'] . '/');
}
}
}



Поставил условию с выводом shell_exec 5 раз с интервалом +10сек при каждом выводе но не работает, цикл с shell_exec тоже с переменой вместо секунд. Кряч, воспользовался методом "тыка" но что-то не получается. Подскажите, пожалуйста, правильное решение Гг

За помощь могу оплатить на Qiwi или Wm.
________
посл. ред. 23.06.2019 в 15:05; всего 1 раз(а); by Boy
...
________
посл. ред. 23.06.2019 в 14:00; всего 1 раз(а); by Boy
Boy , 210 р
Онлайн: 1
Время:
Gen. 0.0811
(c) Bym.Guru 2010-2026