如何提取第一帧并恢复为ffmpeg的图像? [英] How to extract the 1st frame and restore as an image with ffmpeg?

查看:212
本文介绍了如何提取第一帧并恢复为ffmpeg的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道这个伎俩?



如何安装ffmpeg? yum install mpeg 只返回这个:

  ==== ==================================================符合:mpeg =============== ================================================== ===================== 
libiec61883.i386:IEEE1394的流媒体库
libiec61883.x86_64:IEEE1394的流媒体库
qffmpeg-devel.i386:qffmpeg
qffmpeg-devel.x86_64的开发包:qffmpeg
的开发包qffmpeg-libs.i386:qffmpeg
的库库qffmpeg-libs.x86_64:库qffmpeg


解决方案

它在联机帮助页上:

 
*您可以从视频中提取图像,或从许多
图像创建视频:

从一个视频:

ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg

这将从每秒提取一个视频帧视频将
输出到名为foo-001.jpeg,foo-002.jpeg等的文件中。图像
将被重新缩放以适应新的WxH值。

如果要仅提取有限数量的帧,可以使用
上述命令与-vframes或-t选项,或
组合 - ss从某个时间点开始提取。

但当然你必须先安装它。我在Debian上,不要使用yum。



[更新为其他问题]



<$ p $对于* .avi中的avi,p>
i = 1

ffmpeg -i $ avi -vframes 1 -f image2 /tmp/$i.jpg; i = $((i + 1))
done

测试和工作。 p>

[更新为另一个问题...]

  
for flv in * .flv; do
ffmpeg -i $ flv -vframes 1 -f image2 $ {flv %%。flv} .jpg
done


Anyone knows the trick?

And how to install ffmpeg ? yum install mpeg only returns this:

======================================================================================== Matched: mpeg ========================================================================================
libiec61883.i386 : Streaming library for IEEE1394
libiec61883.x86_64 : Streaming library for IEEE1394
qffmpeg-devel.i386 : Development package for qffmpeg
qffmpeg-devel.x86_64 : Development package for qffmpeg
qffmpeg-libs.i386 : Libraries for qffmpeg
qffmpeg-libs.x86_64 : Libraries for qffmpeg

解决方案

It's on the manpage:

* You can extract images from a video, or create a video from many
       images:

       For extracting images from a video:

               ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg

       This will extract one video frame per second from the video and will
       output them in files named foo-001.jpeg, foo-002.jpeg, etc. Images
       will be rescaled to fit the new WxH values.

       If you want to extract just a limited number of frames, you can use
       the above command in combination with the -vframes or -t option, or in
       combination with -ss to start extracting from a certain point in time.

But of course you have to install it first. I'm on Debian and don't use yum.

[update for the other question]


i=1
for avi in *.avi; do
 ffmpeg -i $avi -vframes 1 -f image2 /tmp/$i.jpg; i=$((i+1))
done

Tested and works.

[update for yet another question...]


for flv in *.flv; do
 ffmpeg -i $flv -vframes 1 -f image2 ${flv%%.flv}.jpg
done

这篇关于如何提取第一帧并恢复为ffmpeg的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆