Get the fps with ffprobe
ffprobe -v error -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 sample.mp4
24/1
0/0
The fps in sample.mp4 is 24 frame per second.Why it says it is variable frame rate when to open it with shotcut?
It does use FFmpeg to get the fps, but ffprobe does not report if a file is variable frame rate. One might be able to infer from that, but there is other code I wrote that check the times for the first 20 frames:
pkt.dts,
(int) (pkt.pts - pkt.dts));
self->first_pts = best_pts(self, pkt.pts, pkt.dts);
}
av_packet_unref(&pkt);
}
av_seek_frame(context, -1, 0, AVSEEK_FLAG_BACKWARD);
return;
}
while (ret >= 0 && pkt_countdown-- > 0
&& (self->first_pts == AV_NOPTS_VALUE
|| (vfr_counter < VFR_THRESHOLD && vfr_countdown > 0))) {
ret = av_read_frame(context, &pkt);
if (ret >= 0 && pkt.stream_index == video_index) {
// Variable frame rate check
if (pkt.duration != AV_NOPTS_VALUE && pkt.duration != prev_pkt_duration) {
mlt_log_verbose(MLT_PRODUCER_SERVICE(self->parent),
"checking VFR: pkt.duration %" PRId64 "\n",
pkt.duration);
if (prev_pkt_duration != AV_NOPTS_VALUE)
Feel free to submit a pull request if you have something better.