你好,我在使用ffmpeg时遇到了一些问题。我们需要找到视频中场景变化检测的时间码。请使用以下命令:
ffmpeg -i inputVideo.mp4 -f image2 -vf "select=gt(scene\,.5)" -vsync vfr thumb%04d.png
它会从场景变化检测中创建图像。我不知道如何将时间码添加到文本文件中。感谢您提前的帮助!
P.S. 对于我的糟糕的英语表示抱歉。
你好,我在使用ffmpeg时遇到了一些问题。我们需要找到视频中场景变化检测的时间码。请使用以下命令:
ffmpeg -i inputVideo.mp4 -f image2 -vf "select=gt(scene\,.5)" -vsync vfr thumb%04d.png
它会从场景变化检测中创建图像。我不知道如何将时间码添加到文本文件中。感谢您提前的帮助!
P.S. 对于我的糟糕的英语表示抱歉。
这个想法是使用ffprobe
和Libavfilter输入虚拟设备(lavfi)。
你可以这样在控制台中列出时间戳:
ffprobe -show_frames -print_format compact -f lavfi \
"movie=test.mp4,select=gt(scene\,.8)" | egrep -o "pkt_pts_time=[0-9.]+"
其中.8
是场景检测的阈值。
-print_format
还支持CSV、JSON、XML格式,这样可以更方便地将数据导入其他程序中。
ffmpeg inputvideo.mp4 -filter_complex "select='gt(scene,0.3)',metadata=print:file=time.txt" -vsync vfr img%03d.png
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
帧是从起始位置检测到的镜头变化的序列号。此外,根据您的用例适当选择阈值(这里为0.3),以获得正确的输出。