2013-07-05 105 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'获取更多信息。 –

相关问题