為什麼使用 -vframes 和 -ss 從影片中獲取縮圖?

為什麼使用 -vframes 和 -ss 從影片中獲取縮圖?

我使用 FFmpeg 的這個參數從視訊檔案中獲取縮圖:

ffmpeg -i input.mp4 -vframes 1 -s 320x240 -ss 10 output.jpg

我知道 -ss 10 告訴 FFmpeg 在第 10 秒捕捉縮圖,但是 -vframes 1 的目的是什麼?

答案1

這將告訴ffmpeg輸出一幀。否則它將嘗試使用影像檔案混合器輸出多個影像。來自幫助:

$ ffmpeg -h
...
-vframes number     set the number of video frames to record

答案2

為了以後,如果您想將縮圖添加為文件圖標,並刪除中間 jpeg,請將其添加到自動程式“快速操作”中,並將輸入作為參數傳遞:

export PATH=/usr/local/bin:/opt/homebrew/bin:$PATH

for f in "$@"
do 
   ffmpeg -y -ss 60 -i "$f" -v error -vf select="eq(pict_type\,I),scale=-1:640,crop=in_w:in_h:0:0" -qscale:v 3 -vframes 1 "$f".jpg
   fileicon set "$f" "$f".jpg
   rm "$f".jpg
done

相關內容