[英]FFMPEG - extract two consecutive frames
我需要使用 FFMPEG 隨機選擇時間(例如 0:10)並將兩個連續幀保存為 PNG。
如何將幀保存為 PNG:
ffmpeg.exe -ss 0:10 -y -i test.avi -vcodec png -vframes 1 -an -f rawvideo test.png
如何提取有關視頻文件的信息:
ffprobe -v error -select_streams v:0 -show_entries stream=duration,avg_frame_rate -of default=nw=1:nk=0 test.avi
輸出:
avg_frame_rate=120/1
duration=59.808333
題
如何確定下一幀? 幀率 120/1 表示每秒 120 幀?
編輯
可能的解決方案 - 我是否正確地提取幀時間 +(1/120 = 0.00833333) 可以解決我的問題?:
-ss 0:10
-ss 0:10.00833333
它是否能准確保證下一幀? 還有其他方法嗎?
使用圖像序列復用器
ffmpeg -ss 0:10 -y -i test.avi -vframes 2 -vsync 0 -an -f image2 test%d.png
這將輸出 test1.png 和 test2.png,幀是連續的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.