ffmpeg将一系列图像转换为视频 - 交叉渐变或每两帧之间的任何其他转换 [英] ffmpeg convert a series of images to video - with crossfade or any other transition between every two frames
问题描述
我目前可以将一系列图像转换为视频,但我也需要在它们之间添加转换/动画。
String [] ffmpegCommand = {/ data / data / mypackage / app_bin / ffmpeg,-y,
-qscale,1,-r ,-i,/data/data/mypackage/app_ipImg/image%3d.jpg,
-t,+(((total_images)* delay_of_each_frame_in_seconds)+ 4),// -s,heightwidth,
-vcodec,libx264,-s,640x480,
Environment.getExternalStorageDirectory()+/photo_directory/myVideo.mp4};
上述命令正在为我创建来自图像系列的视频 / p>
但
现在,我想添加淡入淡出或其他转换/动画在每个框架之前的最终视频中显示。
我google了很多,但没有找到解决这个问题的办法,
请以建议的方式。
提前感谢。
我建议您找到有关框架混合或运动插补的更多信息。
这是例如在timelapse视频中用于平滑渲染。
-
混合帧,使用ffmpeg与tblend过滤器。
例如,以下命令可以帮助:
ffmpeg -i {input} -vftblend = average,framestep = 2,setpts = 0.50 * PTS-r {srcfps} - {encoding parameters} {output}
。通过输入文件的名称{input}
由输入文件{output}
替换{srcfps}
每秒的源帧数,以及- {encoding parameters}
您要告诉ffmpeg输出的参数。
您还可以将minterpolate
过滤器添加到过滤器堆栈中以添加一些运动模糊。 -
为了根据运动生成新的框架,Butterflow项目可以帮助: https://
< b $ b使运动内插视频(通过基于运动渲染中间帧来增加视频的帧速率,使用像素扭曲和混合的组合)。
使平滑运动视频(简单的帧间混合)。
利用内插帧使流体慢动作视频。
I am currently able to convert a series of images to video, but I do also need to add transitions / animation in between them.
String[] ffmpegCommand = {"/data/data/mypackage/app_bin/ffmpeg", "-y",
"-qscale", "1", "-r", "" + framerate, "-i", "/data/data/mypackage/app_ipImg/image%3d.jpg",
"-t", "" + (((total_images) * delay_of_each_frame_in_seconds) + 4), //"-s",heightwidth,
"-vcodec", "libx264", "-s", "640x480",
Environment.getExternalStorageDirectory() + "/photo_directory/myVideo.mp4"};
The above command is working for me to create video from image series
But
Now, I do want to add fade or other transition / animation to be displayed in final video before each of the frames.
I googled a lot, but didn't find any solution to this trouble, yet.
Please suggest me the way.
Thanks in advance.
I would suggest you to find more information about Frame Blending or Motion interpolation.
This is for example used in timelapse videos to smooth the render.
To blend frames, use ffmpeg with the tblend filter. For example the following command can help :
ffmpeg -i {input} -vf "tblend=average,framestep=2,setpts=0.50*PTS" -r {srcfps} -{encoding parameters} {output}
. Replace{input}
by your input file,{output}
by the name of the output file,{srcfps}
by your source frames per second, and-{encoding parameters}
the parameters you tell ffmpeg to output. You could also addminterpolate
filter to the filter stack to add some motion blur.To generate new frames based on motion, the Butterflow project can help : https://github.com/dthpham/butterflow
Features
Makes motion interpolated videos (increase a video's frame rate by rendering intermediate frames based on motion, uses a combination of pixel-warping and blending).
Makes smooth motion videos (simple blending between frames).
Leverages interpolated frames to make fluid slow motion videos.
这篇关于ffmpeg将一系列图像转换为视频 - 交叉渐变或每两帧之间的任何其他转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!