我必须使用 FFmpeg 来检测视频中的镜头变化,还要保存检测到的镜头变化的时间戳和分数?我怎样才能用一个命令做到这一点?
EDIT
我直接跳到我的用例,因为它是直接使用 FFmpeg 解决的,不需要原始帧。
最佳答案
在阅读大量 Q/A 后,我遇到的最好和完美的解决方案:
只需使用以下命令:
ffmpeg inputvideo.mp4 -filter_complex "select='gt(scene,0.3)',metadata=print:file=time.txt" -vsync vfr img%03d.png
这将仅将相关信息保存在 time.txt 文件中,如下所示:
frame:0 pts:108859 pts_time:1.20954
lavfi.scene_score=0.436456
frame:1 pts:285285 pts_time:3.16983
lavfi.scene_score=0.444537
frame:2 pts:487987 pts_time:5.42208
lavfi.scene_score=0.494256
frame:3 pts:904654 pts_time:10.0517
lavfi.scene_score=0.462327
frame:4 pts:2533781 pts_time:28.1531
lavfi.scene_score=0.460413
frame:5 pts:2668916 pts_time:29.6546
lavfi.scene_score=0.432326
关于python - 获取保存在文本文件中的具有相应时间戳和场景评分的场景变化帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53720900/