[Libav-user] Configuring mp4 muxer to not recalculate time_base to an absurd timescale value
Charles Cross
charles at openrov.com
Tue Jan 9 07:10:57 EET 2018
Hi Corey,
I also ran into the same issue upon moving to the 3.4 release. In my
application, I am muxing H264 Annex-B to mp4 from a custom AVIO input
context to a file output context.
I set the time_base value in the output AVStream to 1/90000, then stepped
through the code to write the header, some frames, and then the trailer.
Watching the time_base value in the debugger as I stepped through, I
noticed that the values change to the 1/15360 value after the invocation of
av_write_header(), which matches your findings. I am currently working
around the issue by rescaling each frame's PTS/DTS to the new 1/15360
timebase, rather than using the actual timebase associated with the stream
produced by the camera.
Would love to find out if there is a proper way to address this.
Cheers,
Charles
On Mon, Jan 8, 2018 at 8:48 PM, Corey Taylor <corey.taylor.fl at gmail.com>
wrote:
> >
> > if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
> > <snip>
> >
> > if (mov->video_track_timescale) {
> > track->timescale = mov->video_track_timescale;
> > } else {
> > track->timescale = st->time_base.den;
> > while(track->timescale < 10000)
> > track->timescale *= 2;
>
> This seems to be gated by FF_MOV_FLAG_RTP_HINT.
>
> if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
> /* Add hint tracks for each audio and video stream */
> for (i = 0; i < s->nb_streams; i++) {
> AVStream *st = s->streams[i];
> if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
> st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
> mov->nb_streams++;
> }
> }
> }
>
>
> However, I can't seem to disable it. The original code did not pass
> options to avformat_write_header() and didn't run into this.
>
> Are the track hints supposed to be created by default?
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180108/c3bd3fdc/attachment.html>
More information about the Libav-user
mailing list