/**
 * Get the videos and their thumbnails
 *
 * Extracting thumbnails from video files
 * --------------------------------------
 * VLC (newer versions)
 * vlc /path/to/video/process.mp4 --rate=1 --video-filter=scene --vout=dummy --start-time=10 --stop-time=11 --scene-format=png --scene-ratio=24 --scene-prefix=snap --scene-path=C:\path\for\snapshots\ vlc://quit
 *
 * VLC (older versions)
 * vlc /path/to/video/process.mp4 -V image --start-time 0 --stop-time 1 --image-out-format
 *
 */
function get_videos($location)
{
    $cache_path = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . 'video';
    $video_mkv = find_filetype('mkv', $location);
    $video_mp4 = find_filetype('mp4', $location);
    $video_m4v = find_filetype('m4v', $location);
    $video_files = array_merge($video_mkv, $video_mp4);
    $video_files = array_merge($video_files, $video_m4v);
    $video_files = array_unique($video_files);
    $c = 0;
    $clips = array();
    foreach ($video_files as $file) {
        $video_path = dirname($file);
        $video_file = basename($file);
        $video = $video_path . DS . $video_file;
        if (stristr($video, 'jwplayer/demo.mp4')) {
            // skip
            continue;
        } else {
            $thumb = $cache_path . DS . substr($video_file, 0, 5) . "-" . $c . ".png";
            $clips['thumb'][$c] = $thumb;
            $clips['video'][$c] = $video;
            $command = "/usr/bin/ffmpegthumbnailer -i'" . $video . "' -o'" . $thumb . "'";
            exec($command, $output, $return);
            $c++;
        }
    }
    //debug_print_array($video_files);
    //exit;
    //$video_out = sort_video_by_length($video_files);
    unset($video_files);
    return $clips;
}
<html>
<head>
<title>Photo Viewer</title>
<?php 
js_add_jquery();
// adding jquery library
js_add_jquery_ui();
// adding jquery ui library
html_add_link_css(SLIDESHOW_PATH . DS . 'css/supersized.css', 'media="screen"');
html_add_link_css(SLIDESHOW_PATH . DS . 'theme/supersized.shutter.css', 'media="screen"');
html_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js');
html_add_js(SLIDESHOW_PATH . DS . 'js/jquery.easing.min.js');
html_add_js(SLIDESHOW_PATH . DS . 'js/supersized.3.2.7.min.js');
html_add_js(SLIDESHOW_PATH . DS . 'theme/supersized.shutter.min.js');
$cache_path = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . 'photo';
$photo_files = find_filetype('jpg', PLATFORM_SANDBOX_WORKSPACE_PATH);
$c = 0;
?>
	
		<script type="text/javascript">
			
			jQuery(function($){
				
				$.supersized({
				
					// Functionality
					slide_interval          :   3000,		// Length between transitions
					transition              :   3, 			// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
					transition_speed		:	700,		// Speed of transition
															   
					// Components							
function find_all($file, $in)
{
    $files = find_file($file, $in);
    $filetypes = find_filetype($file, $in);
    $all_files = array_merge($files, $filetypes);
    return array_unique($all_files);
}