ffmpeg - 带缩略图的多输出 [英] ffmpeg - multiple output with thumbnails
问题描述
我希望ffmpeg执行以下操作:
I would like ffmpeg to do the following:
- 读取输入mp4 ( - 我的movie.mp4) em>
- 跳过前5秒( - ss 5)
- 查找场景更改并显示帧号( - vfselect = gt(scene\,0.4,showinfo))
- 输出#1 - gif文件(output.gif) / em>
- 输出#2 - 所有缩略图的联系表( - vfselect scale = 320:-1,tile = 12x200thumbnailails.png) em>
- read an input mp4 (-i movie.mp4)
- skip the first 5 seconds (-ss 5)
- find scene changes and display the frame numbers (-vf "select=gt(scene\, 0.4, showinfo))
- output #1 - a gif file (output.gif)
- output #2 - a contact sheet with all the thumbnails (-vf "select scale=320:-1, tile=12x200" thumbnails.png)
这将生成缩略图:
ffmpeg -hide_banner -i d:/Test/movie01.mp4 -ss 5 -vf "select=gt(scene\,0.4), showinfo, scale=320:-1, tile=12x200" -vsync 0 thumbnails%03d.png
这将生成gif:
ffmpeg -hide_banner -i d:/Test/movie01.mp4 -ss 5 -vf "select='not(mod(n,60))',setpts='N/(30*TB)', scale=320:-1" -vsync 0 output.gif
我想做b另外还有另外两个功能:
I would like to do both at once with 2 more features:
-
设置gif的fps和分辨率;我希望gif在X秒内以X fps表示整个电影(我知道输入电影的持续时间,所以我可以计算一帧需要被捕获的频率)
set fps and resolution for the gif; I would like the gif to represent the whole movie in X seconds, at Y fps (I know the duration of the input movie so I can calculate how often a frame needs to be captured)
仅为缩略图片(tile = 12)设置宽度,并让ffmpeg确定适当的高度
set the width only for the thumbnail picture (tile=12 for example) and let ffmpeg determine the appropriate height
我已经尝试从我在此页面上看到的命令行: https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs ,使用split / map命令,但我无法使其工作
I have tried to compose a command line from what I read on this page: https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs, using the split / map commands but I couldn't get it to work
推荐答案
使用
ffmpeg -ss 5 -i input.mp4
-vf "select='not(mod(n,60))',setpts=N/Y/TB',scale=320:-1" -r Y output.gif
-vf "select='gt(scene\,0.4)',showinfo,scale=320:-1,tile=12x200" -vsync 0 thumbnails%03d.png
tile
确定W和H都要设置。
tile
requires both W and H to be set.
这篇关于ffmpeg - 带缩略图的多输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!