[FFmpeg-devel] [PATCH 04/25] fftools/ffmpeg_enc: always use video frame durations when available

James Almer jamrial at gmail.com
Wed Apr 19 23:42:24 EEST 2023


On 4/19/2023 4:52 PM, Anton Khirnov wrote:
> diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
> index e3dc858bc3..9aaec277f1 100644
> --- a/fftools/ffmpeg_enc.c
> +++ b/fftools/ffmpeg_enc.c
> @@ -1005,24 +1005,17 @@ static void do_video_out(OutputFile *of,
>       AVRational frame_rate;
>       int64_t nb_frames, nb_frames_prev, i;
>       double duration = 0;
> -    InputStream *ist = ost->ist;
>       AVFilterContext *filter = ost->filter->filter;
>   
> -    frame_rate = av_buffersink_get_frame_rate(filter);
> -    if (frame_rate.num > 0 && frame_rate.den > 0)
> -        duration = 1/(av_q2d(frame_rate) * av_q2d(enc->time_base));
> +    if (next_picture)
> +        duration = lrintf(next_picture->duration * av_q2d(next_picture->time_base) / av_q2d(enc->time_base));

llrint(). You're passing it a double argument, and long int is 32 bits 
on Windows.


More information about the ffmpeg-devel mailing list