Hello,
This seems like an issue I faced with my own attempt at transcoding video
and a fix was suggested by a member of this mailing list (thanks James).
You need to set the AVPacket duration field, otherwise this issue is
present. This would mean adding something in the lines of the
following line of code before your av_interleaved_write_frame is called:
// for example, if 25 FPS, and time_base is 12800, then packet.duration =
12800 / 25 = 512
output_packet.duration =
format_context->streams[stream_index]->time_base.den /
format_context->streams[stream_index]->time_base.num /
format_context->streams[stream_index]->avg_frame_rate.num *
format_context->streams[stream_index]->avg_frame_rate.den;
/* mux encoded frame */
ret = av_interleaved_write_frame(format_context, output_packet);
Hope this helps!
Vas
On Fri, Jul 10, 2020 at 9:19 PM Tuukka Pasanen <[email protected]>
wrote:
> Hello,
>
> I noticed that example code 'doc/examples/transcoding.c' produces in
> correct FPS if it's used with MP4 container. Encoded video type doesn't
> seem to be the case as I tested H264 and MPEG4 and both were nearly
> identical.
>
> With sort videos it's not much just something like 21,85 fps with 24 fps
> video but longer ones can be something like 0.05 fps.
>
> That it what ffprobe dump and when you play them they are really lagging
> as they go so slow. Packets seems to be correct and it neither wise not
> broken.
>
> I don't know if this just feature or is this as bug. With ffmpeg same
> source file produces correct file with correct fps.
>
> Sincerely,
>
> Tuukka
>
> _______________________________________________
> Libav-user mailing list
> [email protected]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [email protected] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".