2013-07-05 56 views
0
ffmpeg -ss 2.5 -i input_vid.mp4 -vframes 1 -f image2 output_img.jpg 

上面的ffmpeg命令從位於輸入視頻文件(用作視頻縮略圖)的2.5秒幀中創建一個jpg圖像。這個ffmpeg命令中倒數第二個參數是做什麼的?

image2在這裏玩的角色是什麼?我已經看到了幾個博客文章和SO答案,image2image3作爲-vframes標誌的參數放置在這裏,但我不明白它的用途。臨時內存中的文件名可能?

我檢查了ffmpeg documentation,但找不到答案。

回答

0

image2是使用FFMPEG讀取該媒體文件到分組(組塊)的圖像文件demuxer


docs

image2分路器從一個模式指定的圖像文件的列表讀取。該模式可能包含一個後綴,用於自動確定文件中包含的圖像的格式。

在這種情況下,output_img.jpg是模式,分解器根據文件的擴展名將格式設置爲JPEG格式。

1
ffmpeg -ss 2.5 -i input_vid.mp4 -vframes 1 -f image2 output_img.jpg 
#           |  | 
#           \ /
#           ------ 
#            | 
# as you can see, image2 is actually part of the argument "-f image2". This 
# explicitly sets the container format. Some containers can have the same 
# file extension, so this is a way to disambiguate. 

§ 5.4 Main options

 
‘-f fmt (input/output)’ 

    Force input or output file format. The format is normally auto detected for input 
    files and guessed from the file extension for output files, so this option is not 
    needed in most cases. 
+0

容器格式不是'output_img.jpg'的擴展名嗎?並且'image2'是這個命令中設置的任意變量名稱,還是它是普遍意義上的東西? – sgarza62

+1

@ sgarza62是的,通常格式是由擴展名設置,但正如我說的一些格式使用相同的擴展名,所以你需要消除歧義。 'ffmpeg -formats'獲取更多信息。 –

相關問題