用于关键帧识别的ffprobe和ffmpeg之间的结果不一致

用于关键帧识别的ffprobe和ffmpeg之间的结果不一致,ffmpeg,video-processing,ffprobe,Ffmpeg,Video Processing,Ffprobe,试图在一组视频上识别关键帧的缩略图和时间戳,我从ffmpeg和ffprobe中得到了不同的结果 以1分钟长的视频为例: youtube dl-f'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'https://www.youtube.com/watch?v=BHlAlN3z4ss'--输出“test.mp4” 1/I提取缩略图并在图像上写入提取缩略图的时间戳: ffmpeg -i test.mp4 -q:v 2 -vf select="eq(pict_typ

试图在一组视频上识别关键帧的缩略图和时间戳,我从
ffmpeg
ffprobe
中得到了不同的结果

以1分钟长的视频为例:

youtube dl-f'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'
https://www.youtube.com/watch?v=BHlAlN3z4ss'--输出“test.mp4”
1/I提取缩略图并在图像上写入提取缩略图的时间戳:

ffmpeg -i test.mp4 -q:v 2 -vf select="eq(pict_type\,PICT_TYPE_I)","drawtext=fontfile=/path/to/Arial.ttf:fontsize=45:fontcolor=yellow:box=1:boxcolor=black:x=(W-tw)/2:y=H-th-10:text='Time\: %{pts\:hms}'" -vsync 0 thumbs/preview%05d.jpg
2/I提取并保存所有关键帧的时间戳:

ffprobe -v error -skip_frame nokey -show_entries frame=pkt_pts_time -select_streams v -of csv=p=0 test.mp4 | sort -n > keyframes_timestamps.txt
3/比较结果,我发现
ffprobe
找到了29个关键帧,而
ffmpeg
只找到了32个关键帧。手动比较,我们可以看到,``ffprobe`没有检测到特定的关键帧,而大多数关键帧非常相似

ffprobe_ts  ffmpeg_ts
0.000000    00:00:00.00
5.366667    00:00:05.367
7.200000    00:00:07.200
8.666667    00:00:08.667
10.100000   00:00:10.100
11.500000   00:00:11.500
14.233333   00:00:14.233
15.333333   00:00:15.333
17.366667   00:00:17.367
NO_TS       00:00:18.833
20.800000   00:00:20.800
24.533333   00:00:24.533
25.700000   00:00:25.700
26.033333   00:00:26.033
在较大的视频中,这种情况发生在大约少于5%的关键帧上

我找不到解释,有人有线索吗?或者关于我应该进一步询问的地方/内容的建议


谢谢你的帮助

并非所有I帧都是关键帧<代码>-跳过帧nokey将跳过非KF I帧。

哦,谢谢,成功了!因此,使用这个ffmpeg命令,我得到了与ffprobe相同的结果:
ffmpeg-skip_-frame'nokey'-I test.mp4-q:v2-vf“drawtext=fontfile=/path/to/Arial.ttf:fontsize=45:fontcolor=yellow:box=1:boxcolor=black:x=(W-tw)/2:y=H-th-10:text='Time\\%{pts \:hms}''-vsync 0 thumbs/preview%05d.jpg