View Single Post
ישן 17-02-14, 21:13   # 1
איציק ברבי
עסק רשום [?]
 
מיני פרופיל
תאריך הצטרפות: Feb 2011
הודעות: 970

איציק ברבי לא מחובר  

לחתוך תמונה מסרטון

מצאתי קוד באינטרנט שחותך תמונה מתוך הסרטון ושומר בשרת,
עכשיו במקום לשמור בשרת אני רוצה להציג אותה בדפדפן,
ומשום מה זה לא מביא לי.

הגדרתי כמו שצריך את הContent-Type
הנה הקוד:
PHP קוד:
<?php 
function captureVideoPosterImg($movie_file '')
{
    
extension_loaded('ffmpeg');
    
// Instantiates the class ffmpeg_movie so we can get the information you want the video
    
$movie = new ffmpeg_movie($movie_file);
    
// Get The duration of the video in seconds
    
echo $Duration round($movie->getDuration(), 0);
    
// Get the number of frames of the video
    
$TotalFrames $movie->getFrameCount();
    
// Get the height in pixels Video
    
$height $movie->getFrameHeight();
    
// Get the width of the video in pixels
    
$width $movie->getFrameWidth();
    
//Receiving the frame from the video and saving
    // Need to create a GD image ffmpeg-php to work on it
    
$image imagecreatetruecolor($width$height);
    
// Create an instance of the frame with the class ffmpeg_frame
    
$Frame = new ffmpeg_frame($image);
    
// Choose the frame you want to save as jpeg
    
$thumbnailOf = (int) round($movie->getFrameCount() / 2.5);
    
// Receives the frame
    
$frame $movie->GetFrame($thumbnailOf);
    
// Convert to a GD image
    
$image $frame->toGDImage();
    
// Save to disk.
    //echo $movie_file.'.jpg';
    
header('Content-Type: image/jpeg');
    
imagejpeg($image,null,100);
}    
echo 
captureVideoPosterImg("smovie.mp4");
?>
אשמח לעזרה!
__________________

איציק ברבי - שירות לקוחות
כתובת אתר: http://build-net.co.il/
איימל: Support@build-net.co.il
טלפון: 052-3937296.
  Reply With Quote