FFMpeg相关 - lhf 的窝
FreeType的光栅化功能

FFMpeg相关

LiHengFeng posted @ 2009年8月05日 21:34 in 编程 with tags FFMpeg mepg , 2479 阅读
本blog所有文章,除声明了作者外,均为原创。欢迎转载,转载请注明作者。

1、ffmpeg.exe的使用

ffmeg.exe功能强大,可用于视频格式转换,截图,或捕获视频音频等。这里只说明截图的方式,做个记录,以备将来参考。

截图的主要参数是:

    -i  :指定输入文件(视频文件),可以是相对路径或绝对路径。

   -y  :覆盖输出文件,即如果有同名文件的话,则直接覆盖。

  -f    :输出格式,一般采用 image2。

 -ss: 表示相对于文件开始处的时间偏移值, 单位是秒,也支持  hh:mm:ss的格式。

-s    : 指定输出图片的尺寸。 比如: -s 120*90

-vframes: 表示截图的数  。

上面各参数之间的顺序不重要,但一般好像都把 -i 作为第一个参数

 

看一个例子:ffmpeg -i  aa.mpg  -f image2 -ss 5 -s 120*90 -vframes 1 test.jpg 

含义是: 对当前目录下的aa.mpg截图,从第5秒开始截图,图片尺寸是 120*90,只截第一个图,保存为 test.jpg。

 

如果要输出多个图,则可以在图片名称中加入%d的参数,输出时,%d会被序号代替(支持扩展的%02d等格式)。比如:

ffmpeg -i aa.mpg tt%02d.jpg              输出aa.mpg中的每一帧图像,依次保存为 tt01.jpg,tt02.jpg等等。

ffmpeg -i aa.mpg tt%02d.jpg -vframes 5   输出aa.mpg的前5帧图像,依次保存为 tt01.jpg,tt02.jpg等等。

ffmpeg -i aa.mpg -ss 2 tt%02d.jpg -vframes 5  输出从第2秒开始的连续5帧图,依次为 tt01.jpg,tt02.jpg等。

 

 

Avatar_small
Emma 说:
2023年2月01日 22:13

Using ffmpeg.exe is an excellent way to take screenshots and capture video and audio. To take screenshots, the parameters -i, -y, -f, -ss, -s and -vframes are the main find homes Saint Augustine ones to consider. The order between the parameters doesn't matter, but it's best to start with -i. For example, the command 'ffmpeg -i aa.mpg -f image2 -ss 5 -s 120*90 -vframes 1 test.jpg' is a great way to take a screenshot. It's also worth noting that this powerful software can be used for other tasks such as video format conversion.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter