[英]FFmpeg export frames listed in file (including duplicates)
Problem问题
I have a list of frames that I want to extract from some video file.我有一个要从某个视频文件中提取的帧列表。 The list might look like this:
该列表可能如下所示:
1,6,6,10,15,20,20,25,25,50
In reality there are thousands of frames.实际上有成千上万的帧。
How do I extract these frames into images or video in efficient way?如何以有效的方式将这些帧提取到图像或视频中?
What I have tried我试过的
select=eq(\\n,1)+eq(\\n,6)+...
but the problem is that I cannot export duplicates this way.select=eq(\\n,1)+eq(\\n,6)+...
但问题是我不能以这种方式导出重复项。 Also I am not sure about the performance.cv.VideoCapture
functionality to read frame by frame and save the ones I need.cv.VideoCapture
功能逐帧读取并保存我需要的那些。 The problem is that before the extraction, I need to change framerate of the video to some constant framerate (very important).bash script: bash脚本:
#!/bin/bash
LST=(1 6 6 10)
TOT=${#LST[*]}
for (( i=0; i<=$(( $TOT -1 )); i++ )); do
ffmpeg -i "input 1.mkv" -filter:v "select='eq(n,${LST[$i]})'" -vsync vfr "/tmp/img_${i}_${LST[$i]}.jpg"
done
it is not fast, but works ☺它不快,但有效 ☺
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.