[Libav-user] Erratic encoding issue: Crazy framerates.
fxtalgorn at yahoo.fr
Fri Sep 4 09:13:53 CEST 2015
I noticed some differences between the way I do and the muxing.c example.
Furthermore, I copy timebase from source to destination which is wrong as you say.
I'm gonna give a try to the way muxing.c does.
Thanks a lot for your help!
Le 3 sept. 2015 à 18:23, Robert Krüger <krueger at lesspain.de> a écrit :
> On Thu, Sep 3, 2015 at 5:41 PM, Talgorn François-Xavier <fxtalgorn-at-yahoo.fr at ffmpeg.org>wrote:
> Hi Krueger,
> 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.
> no, it does not. mov/mp4 don't have a concept like frame rate.
> The encoder gives you packets that have timestamps that are based on what you gave the encoder as timebase. The muxer has the freedom to change that timebase in avformat_write_header and if it does, the packets you get from the encoder have incorrect timestamps, if you don't rescale them to the timebase of the AVStream modified by the muxer. Check the example muxing.c in the docs. You have to do what's done there (see line 83). If you don't, what you describe (incorrect frame rate) may very well be the result.
> Libav-user mailing list
> Libav-user at ffmpeg.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user