使用 FFmpeg 循环显示特定帧速率的视频图像
Display images on video at specific framerate with loop using FFmpeg
我有一个 mp4 视频路径和一组图像(00.png、01.png...170.png)。这些图像具有 alpha(透明背景)。我想在特定时间 (00:05-1:35) 以 15 的帧速率循环显示我的视频上的这些图像作为叠加层。意思是所有的图片都显示一次,如果没有超过规定的时间,会重新显示。
For example, assume that I've a set of 3 images(00.png, 01.png, 02.png) with 4 framerate and I want to display them only during 00:00-00:02 so:
the images that will be displayed at 00:00-00:01 will be: 00, 01, 02, 00.
the images that will be displayed at 00:01-00:02 will be: 01, 02, 00, 01.
我尝试过使用它,但它什么也没做(只是尝试了 1 张图片作为开始)。
final String[] cmd = {"-f","-i",output_mp4,"-framerate", "15", "-loop", "1", "-i",image1,"-filter_complex","overlay=shortest=1", newOutput};
FFmpeg.execute(cmd);
有什么方法可以得到我想要的吗?
有一个 'select' 选项或许可以提供帮助:
https://video.stackexchange.com/questions/19873/extract-specific-video-frames
用 setpts then use overlay with enable
option 偏移图像时间戳。
ffmpeg -i input -framerate 15 -loop 1 -i %d.png -filter_complex "[1]setpts=PTS+5/TB[fg];[0][fg]overlay=enable='between(t,5,95)':shortest=1" output
我有一个 mp4 视频路径和一组图像(00.png、01.png...170.png)。这些图像具有 alpha(透明背景)。我想在特定时间 (00:05-1:35) 以 15 的帧速率循环显示我的视频上的这些图像作为叠加层。意思是所有的图片都显示一次,如果没有超过规定的时间,会重新显示。
For example, assume that I've a set of 3 images(00.png, 01.png, 02.png) with 4 framerate and I want to display them only during 00:00-00:02 so:
the images that will be displayed at 00:00-00:01 will be: 00, 01, 02, 00.
the images that will be displayed at 00:01-00:02 will be: 01, 02, 00, 01.
我尝试过使用它,但它什么也没做(只是尝试了 1 张图片作为开始)。
final String[] cmd = {"-f","-i",output_mp4,"-framerate", "15", "-loop", "1", "-i",image1,"-filter_complex","overlay=shortest=1", newOutput};
FFmpeg.execute(cmd);
有什么方法可以得到我想要的吗?
有一个 'select' 选项或许可以提供帮助:
https://video.stackexchange.com/questions/19873/extract-specific-video-frames
用 setpts then use overlay with enable
option 偏移图像时间戳。
ffmpeg -i input -framerate 15 -loop 1 -i %d.png -filter_complex "[1]setpts=PTS+5/TB[fg];[0][fg]overlay=enable='between(t,5,95)':shortest=1" output