Skip to content

Commit

Permalink
update fps and dur calc
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-astra-video committed Jul 3, 2024
1 parent 4089421 commit 579d8ab
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ffmpeg/extras.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ int lpms_get_codec_info(char *fname, pcodec_info out)
out->width = ic->streams[vstream]->codecpar->width;
out->height = ic->streams[vstream]->codecpar->height;

AVRational frame_rate = av_guess_frame_rate(ic,ic->streams[vstream],NULL);
out->fps = (frame_rate.num && frame_rate.den ? av_q2d(frame_rate) : 0);
out->dur = (double)ic->streams[vstream]->nb_frames / out->fps;
out->fps = av_q2d(ic->streams[vstream]->avg_frame_rate);
out->dur = ic->duration / AV_TIME_BASE;
} else {
// Indicate failure to extract video codec from given container
out->video_codec[0] = 0;
Expand Down

0 comments on commit 579d8ab

Please sign in to comment.