[Libav-user] Erratic encoding issue: Crazy framerates.
fxtalgorn at yahoo.fr
Thu Sep 3 17:41:43 CEST 2015
Thanks for your reply.
I did check the timestamps and durations of packets.
It appears that respectives timestamps (original/encoded) are in different formats but consistent (incremental).
I set the timebase for encoded file to the same as the original (in_ctx->format_ctx is the original context).
o_codec_ctx->time_base.num = in_ctx->format_ctx->streams[in_ctx->video_stream_idx]->codec->time_base;
o_codec_ctx->time_base.den = in_ctx->format_ctx->streams[in_ctx->video_stream_idx]->codec->time_base;
I don't know if this is OK to duplicate a timebase from H264 to be used in a MP4 context.
Since it defines the frame rate only (not the ticks/frame) it should OK I guess.
What do you think ?
Le 3 sept. 2015 à 17:29, Robert Krüger <krueger at lesspain.de> a écrit :
> On Thu, Sep 3, 2015 at 10:23 AM, Talgorn François-Xavier <fxtalgorn-at-yahoo.fr at ffmpeg.org> wrote:
> Hi all,
> Thank you in advance for your help.
> I wrote a program that takes videos as input (H264), process filters on it and encode a modified video in MP4 (simple profile).
> Everything works fine but the fact that some videos are encoded with crazy frame rates, like 2500 or 24000 fps.
> I assume the problem is related to the way I manage timestamps. I tried tens of workarounds to no avail.
> Here is the resulting infos of both an example that fails and another that is OK.
> If I were you I would start by checking the timestamps and timebases of the encoded files that cause trouble by running ffprobe on them and output stream timebases and packet timestamps to see what's actually in them that's screwing up the fps. maybe you just used an incorrect timebase or something like that. One thing that many people overlook is to check whether your muxer has changed the time base after initialization. you have to deal with that case (and rescale your packet timestamps to that new timebase) and the mov/mp4 muxer does that under certain circumstances.
> Libav-user mailing list
> Libav-user at ffmpeg.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user