[FFmpeg-devel] [PATCH] avformat: offset fps calculation by one to include 60.00 fps

Michael Niedermayer michaelni at gmx.at
Thu Jun 21 11:50:46 CEST 2012


On Thu, Jun 21, 2012 at 09:43:22AM +0200, Hendrik Leppkes wrote:
> Hi,
> 
> attached patch moves the fps calculation window slightly to include
> 60.00fps as a possible candidate for the fps, and instead don't consider 0
> fps as a valid option.
> 60.00 fps is quite common for example when using a screen recorder on a PC
> to capture a video game (eg. Fraps). Before this patch, the FPS guessing
> code would end up on 59.94 as the closest match, instead of the true 60.00.
> 
> This was the easiest solution to include 60.00fps into the calculation,
> instead the range could be extended by one to include both 0 fps and 60
> fps, but since 0 fps didn't seem all that useful to me, i opted to go with
> the more simple approach.
> 
> Feedback welcome.
> 
> - Hendrik

>  utils.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 9fb5d0a72a84e6a7bc9e052370fa3d6c2cf38828  avformat-offset-fps-calculation-by-one.patch
> From 4544a779ec8745af5af3c2f5e6f54232ee4f1191 Mon Sep 17 00:00:00 2001
> From: Hendrik Leppkes <h.leppkes at gmail.com>
> Date: Mon, 9 Apr 2012 18:54:42 +0200
> Subject: [PATCH] avformat: offset fps calculation by one to include 60.00 fps
> 
> Instead, skip 0 fps, it doesn't make any sense anyway.
> ---
>  libavformat/utils.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index fc3708a..09625a8 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2479,7 +2479,7 @@ static void compute_chapters_end(AVFormatContext *s)
>  }
>  
>  static int get_std_framerate(int i){
> -    if(i<60*12) return i*1001;
> +    if(i<60*12) return (i+1)*1001;

the smallest "i" value used is 1 not 0 so this would loose the lowest
non 0 framerate


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120621/d2ddc734/attachment.asc>


More information about the ffmpeg-devel mailing list