Revision d2845b75 ffmpeg.c

View differences:

ffmpeg.c
212 212
static int nb_frames_drop = 0;
213 213
static int input_sync;
214 214
static uint64_t limit_filesize = 0; //
215
static int force_fps = 0;
215 216

  
216 217
static int pgmyuv_compatibility_hack=0;
217 218
static float dts_delta_threshold = 10;
......
3041 3042

  
3042 3043
        set_context_opts(video_enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3043 3044

  
3045
        if (codec && codec->supported_framerates && !force_fps)
3046
            fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
3044 3047
        video_enc->time_base.den = fps.num;
3045 3048
        video_enc->time_base.num = fps.den;
3046
        if(codec && codec->supported_framerates){
3047
            const AVRational *p= codec->supported_framerates;
3048
            const AVRational *best=NULL;
3049
            AVRational best_error= (AVRational){INT_MAX, 1};
3050
            for(; p->den!=0; p++){
3051
                AVRational error= av_sub_q(fps, *p);
3052
                if(error.num <0) error.num *= -1;
3053
                if(av_cmp_q(error, best_error) < 0){
3054
                    best_error= error;
3055
                    best= p;
3056
                }
3057
            }
3058
            video_enc->time_base.den= best->num;
3059
            video_enc->time_base.num= best->den;
3060
        }
3061 3049

  
3062 3050
        video_enc->width = frame_width + frame_padright + frame_padleft;
3063 3051
        video_enc->height = frame_height + frame_padtop + frame_padbottom;
......
3862 3850
    { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
3863 3851
    { "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" },
3864 3852
    { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
3853
    { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" },
3865 3854

  
3866 3855
    /* audio options */
3867 3856
    { "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },

Also available in: Unified diff