[Ffmpeg-devel] [PATCH] x264 avc encoding, movenc avcC, ctts

Michael Niedermayer michaelni
Sun Feb 19 21:23:07 CET 2006


Hi

On Sun, Feb 19, 2006 at 06:23:55PM +0100, Baptiste COUDURIER wrote:
[...]
> @@ -580,6 +633,9 @@ static int mov_write_stbl_tag(ByteIOCont
>      if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
>          track->hasKeyframes)
>          mov_write_stss_tag(pb, track);
> +    if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
> +        track->enc->codec_id == CODEC_ID_H264) /* MPEG4 too ? */
> +        mov_write_ctts_tag(pb, track);

yes, every codec which supports b frames needs CTTS
also the CODEC_TYPE_VIDEO check is redundant CODEC_ID_H264 is always video


[...]
> +    entries_pos = url_ftell(pb);
> +    put_be32(pb, 0); /* entry count */

i would prefer if this is written without seeking around, (non seekable stuff
like streams ...)


> +    last_cts = track->cluster[0][0].cts;
> +    for (i=0; i<track->entry; i++) {
> +        int cl = i / MOV_INDEX_CLUSTER_SIZE;
> +        int id = i % MOV_INDEX_CLUSTER_SIZE;
> +        if (track->cluster[cl][id].cts == last_cts)
> +            current_count++; /* compress */
> +        else {
> +            put_be32(pb, current_count);
> +            put_be32(pb, last_cts);
> +            current_count = 1;
> +            last_cts = track->cluster[cl][id].cts;
> +            entries++;
> +        }
> +    }

isnt this missing the last entry?


[...]
> +        if (pkt->dts > pkt->pts) { /* first packet has weird dts */
> +            av_log(s, AV_LOG_ERROR, "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 = av_rescale(pkt->pts - pkt->dts, enc->time_base.num, pkt->duration); /* enc->time_base.num will be trk->sampleDuration */

this looks wrong, what does the pkt->duration do in there?

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list