[英]Per second frame count using ffmpeg
我需要計算攝像機每秒捕獲的視頻中的幀數。 我還沒有找到使用 ffmpeg 或 ffprobe(或其他東西)到 output 每秒幀數的解決方案(由於捕獲機制無法保證保持恆定的幀率,需要驗證)。
到目前為止,我需要分別運行 ffmpeg 和 ffprobe。 首先,我運行 ffmpeg 來修剪視頻:
ffmpeg -ss 00:00:00 -to <desired time in seconds> -i <in_video> -c copy <out_video>
然后,我運行 ffprobe 來計算片段中的幀數:
ffprobe -v error -select_streams v:0 -count_frames -show_entries stream=nb_read_frames -print_format csv <out_video>
是否有一個命令 output 視頻中每一秒的幀數?
跑步
ffmpeg -report -i <in_video> -an -vf select='if(eq(n,0),1,floor(t)-floor(prev_selected_t))' -f null -
在生成的報告中,搜索select:1.000000
那會讓你得到表格的行
[Parsed_select_0 @ 000001f413152540] n:270.000000 pts:138240.000000 t:9.000000 key:0 interlace_type:P pict_type:P scene:nan -> select:1.000000 select_out:0
t
是時間戳, n
是幀索引。 檢查每個連續t
的幀索引。 不同之處在於該 1 秒間隔的幀數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.