[Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts (original) (raw)
Michael Niedermayer michaelni
Sun Feb 19 23:37:19 CET 2006
- Previous message: [Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts
- Next message: [Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi
On Sun, Feb 19, 2006 at 10:02:40PM +0100, Baptiste COUDURIER wrote:
Michael Niedermayer wrote: > Hi > > On Sun, Feb 19, 2006 at 06:23:55PM +0100, Baptiste COUDURIER wrote: > [...] >> @@ -580,6 +633,9 @@ static int movwritestbltag(ByteIOCont >> if (track->enc->codectype == CODECTYPEVIDEO && >> track->hasKeyframes) >> movwritestsstag(pb, track); >> + if (track->enc->codectype == CODECTYPEVIDEO && >> + track->enc->codecid == CODECIDH264) /* MPEG4 too ? */ >> + movwritecttstag(pb, track); > > yes, every codec which supports b frames needs CTTS > also the CODECTYPEVIDEO check is redundant CODECIDH264 is always video
All right, then I will check for B frames instead.
just add it for mpeg4 and h264
[...]
> [...] >> + if (pkt->dts > pkt->pts) { /* first packet has weird dts */ >> + avlog(s, AVLOGERROR, "weird, dts %lld, pts %lld\n", pkt->dts, pkt->pts); >> + pkt->dts = pkt->pts - pkt->duration; /* first cts to 1 */ >> + } > > this looks like a bug somewhere else ... > > >> + trk->cluster[cl][id].cts = avrescale(pkt->pts - pkt->dts, enc->timebase.num, pkt->duration); /* enc->timebase.num will be trk->sampleDuration */ > > this looks wrong, what does the pkt->duration do in there? > > [...] >
Difference between pts and dts is pkt->duration scaled, I admit that I don't know that much pts/dts system in ffmpeg.
no this is wrong pts-dts does not need to be a multiple of pkt->duration
the correct code IMHO is trk->cluster[cl][id].cts= (pkt->pts - pkt->dts) * enc->time_base.num; though i didnt check the spec ...
also note that mov_write_stts_tag() is totally wrong, it must store the dts not blindly assume they are all equally spaced
[...]
Michael
- Previous message: [Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts
- Next message: [Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]