python - 获取保存在文本文件中的具有相应时间戳和场景评分的场景变化帧

标签 python video ffmpeg

我必须使用 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/

相关文章:

python - 使文本看起来像是在 Python Shell 中输入的

ios - 如何确定 iOS8 中视频 PHAsset 磁盘上的文件大小

audio - 使用 ffmpeg 从 28 分钟的视频中复制 5 秒

video - H.264 级别,适用于 1920x1080 60 视频

python PyQT : How to call a GUI function from a worker thread?

python - 如何在 Django REST Framework 中创建多个模型实例而无需重复的可写嵌套序列化程序?

python - 树莓派 Crontab 脚本错误

video - 在仍然使用arduino的同时捕获实时视频

ffmpeg - 如何使用 avconv 将 MP4 文件转换为 MPEG?

python - CNN 凯拉斯 : How many weights will be trained?