An idea for image preview video

I use flowplayer3.

What do yours think of:

Rather than manually add an image with the same file name.
Create a script for when the video was "start" the first time preview.
Create an image generated with the same name and the same album automatically?

Comments

  • acrylian Administrator, Developer
    The problem is that this is not as easy as it sounds because neither GD libary nor Imagick can do that. This will require that special extensions like ffmeg or similar are installed on the server. Since Zenphoto is made with the goal to run on standard shared hosts and not custom dedicated servers basically no one will be able to use that.

    But that should not keep you from creating a plugin for this if you need and want to do this.
  • I find what I need to do.
    I'm not a PHP programmer.

    I'll find stuff.
    To You create.
  • acrylian Administrator, Developer
    Well, sorry, then you have to live with the way it is now. Even if we had a tool for this you would have to install something on your server (and I am not talking about installing something like Zenphoto)
  • I got the code.
    I think it works.

    //Return the duration of a movie or audio file in seconds.
    $movie->getDuration()
    //Return the number of frames in a movie or audio file.
    $movie->getFrameCount()
    //Return the frame rate of a movie in fps.
    $movie->getFrameRate()
    //Return the height of the movie in pixels.
    $movie->getFrameHeight()
    //Return the width of the movie in pixels.
    $movie->getFrameWidth()
    //Returns a frame from the movie as an ffmpeg_frame object.
    //Returns false if the frame was not found.
    //framenumber - Frame from the movie to return.
    //If no framenumber is specified, returns the next frame of the movie.
    $movie->getFrame([Integer framenumber])

    if ( ! extension_loaded ( 'ffmpeg' ) ) exit ( 'ffmpeg is not load!' );

    //class ffmpeg_movie of ffmpeg-php

    // instancia a classe ffmpeg_movie para pegarmos as informações que queremos o vídeo
    $movie = new ffmpeg_movie($movie_file);
    // pegamos a duranção do video em segundos
    $duration = round ( $movie->getDuration() , 0 );
    // recebemos o número de frames do vídeo
    $totalFrames = $movie->getFrameCount();
    // recebemos a altura do vídeo em pixels
    $height = $movie->getFrameHeight ();
    // recebemos a largura do vídeo em pixels
    $width = $movie->getFrameWidth ();

    $thumbnailOf = round ( $movie->getFrameCount() / 2 );

    // precisamos criar uma imagem GD para o ffmpeg-php trabalhar nela
    $image = imagecreatetruecolor ( $width , $height ) ;
    // criamos a instancia do frame com a classe ffmpeg_frame
    $frame = new ffmpeg_frame ( $image );
    // escolhemos o frame que queremos salvar como jpeg
    $thumbnailOf = (int) round ($movie->getFrameCount() / 2.5);
    // recebe o frame
    $frame = $movie->getFrame ( $thumbnailOf );
    // converte para uma imagem GD
    $image = $frame->toGDImage ();
    //salva no HD.
    imagejpeg($image, $movie_file.'.jpg', 100);
  • acrylian Administrator, Developer
    Still all this requires a native php server extension called ffmpeg you need to install as binaries. Not even I know how to do that on a server. Needless to say that my server does not support that.

    But as said we welcome third party contributions in form of plugins.
Sign In or Register to comment.