問題描述
我是 php 的新手.我已經在我的本地 iis 中安裝了 ffmpeg .. 是否可以為 flv 文件生成縮略圖.?請幫忙..
I am new to php. I have installed ffmpeg in my local iis.. Is it possible to generate a thumbnail image for a flv file.? Please help..
推薦答案
試試這個
$ffmpeg = 'ffmpeg.exe';
//video dir
$video = 'video.flv';
//where to save the image
$image = 'image.jpg';
//time to take screenshot at
$interval = 5;
//screenshot size
$size = '320x240';
//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";
$return = `$cmd`;
命令選項說明:
-i 文件名(源視頻的文件路徑)
-deinterlace(將隔行視頻轉換為非隔行格式)
-an(錄音被禁用;我們不需要它來制作縮略圖)
-ss position(輸入視頻被解碼和轉儲,直到時間戳到達位置,我們的縮略圖的位置以秒為單位)
-f 輸出文件格式
-t duration(輸出文件在 duration 秒后停止寫入)
-r fps(設置要寫入的幀速率;fps 以赫茲(1/秒)表示;我們使用 1 以便我們只抓取一幀)
-y(如果已經存在則覆蓋輸出文件)
-s 寬x高(以像素為單位的框架大小)
-i filename (the source video's file path)
-deinterlace (converts interlaced video to non-interlaced form)
-an (audio recording is disabled; we don't need it for thumbnails)
-ss position (input video is decoded and dumped until the timestamp reaches position, our thumbnail's position in seconds)
-f output file format
-t duration (the output file stops writing after duration seconds)
-r fps (sets the frame rate to write at; fps is expressed in Hertz (1/seconds); we use 1 so that we grab only one frame)
-y (overwrites the output file if it already exists)
-s widthxheight (size of the frame in pixels)
這篇關于FFMpeg - 為視頻文件創建縮略圖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!