View file loads/inc/files/ff_file.php

File size: 3.01Kb
<?php

if (is_file(H . "sys/loads/screens/128/$size.$name.gif")) {
    
} elseif (class_exists('ffmpeg_movie')) {
    if (!isset($set['video_select']) || $set['video_select'] == '0') {
        $media = new ffmpeg_movie(realpath($dir_loads . '/' . $file));
        $k_frame = intval($media->getFrameCount());
        $w = $media->GetFrameWidth();
        $h = $media->GetFrameHeight();
        $k_kadr = 6;
        for ($i = 0; $i < $k_kadr; $i++) {
            $ff_frame = $media->getFrame(intval($k_frame / ($k_kadr / ($i + 1))));
            if ($ff_frame) {
                $gd_image = $ff_frame->toGDImage();
                if ($gd_image) {
                    $des_img = imagecreatetruecolor(128, 128);
                    $s_img = $gd_image;
                    imagecopyresampled($des_img, $s_img, 0, 0, 0, 0, 128, 128, $w, $h);
                    $des_img = img_copyright($des_img); // копирайт
                    $frames[$i] = H . "sys/tmp/frame_$sess.$i.gif";
                    imagegif($des_img, $frames[$i]);
                    chmod($frames[$i], 0777);
                    $framed [$i] = 60;
                    imagedestroy($des_img);
                    imagedestroy($s_img);
                }
            }
        }
        include H . 'sys/classes/gifencoder.class.php';
        $gif = @new GIFEncoder($frames, $framed, 0, 2, 0, 0, 0, "url");
        $screen = $gif->GetAnimation();
        file_put_contents(H . "sys/loads/screens/128/$size.$name.gif", $screen);
        @chmod(H . "sys/loads/screens/128/$size.$name.gif", 0777);
        for ($i = 0; $i < $k_kadr; $i++) {
            unlink(H . "sys/tmp/frame_$sess.$i.gif");
        }
    }
}

#Вывод скриншотов
include 'file_scr.php';
include 'data_ff.php';

if (class_exists('ffmpeg_movie')) {
    $media = new ffmpeg_movie(realpath($dir_loads . '/' . $file));
    echo "<div class='list-group-item'>";
    echo 'Разрешение: ' . $media->GetFrameWidth() . 'x' . $media->GetFrameHeight() . "пикс<br />\n";
    echo 'Частота кадров: ' . $media->getFrameRate() . "<br />\n";
    echo 'Кодек (видео): ' . $media->getVideoCodec() . "<br />\n";

    if (intval($media->getDuration()) > 3599) {
        echo 'Время: ' . intval($media->getDuration() / 3600) . ":" . date('s', fmod($media->getDuration() / 60, 60)) . ":" . date('s', fmod($media->getDuration(), 3600)) . "<br />\n";
    } elseif (intval($media->getDuration()) > 59) {
        echo 'Время: ' . intval($media->getDuration() / 60) . ":" . date('s', fmod($media->getDuration(), 60)) . "<br />\n";
    } else {
        echo 'Время: ' . intval($media->getDuration()) . " сек<br />\n";
    }
    echo "Битрейт: " . ceil(($media->getBitRate()) / 1024) . " KBPS<br />\n";
    echo "</div>";
}

include 'opis_ff.php';
include 'prosm.php';
include 'rating.php';

if (class_exists('ffmpeg_movie') && isset($user) && $user['level'] == 4) {
    include 'inc/convert.php';
}
include 'inc/add_file_loads.php'; // обработа вывода ссылки
include 'komm.php';
?>