[FFmpeg-devel] [PATCH] h264/aac in flv
Michael Niedermayer
michaelni
Mon May 5 16:58:23 CEST 2008
On Mon, May 05, 2008 at 04:01:35PM +0200, Baptiste Coudurier wrote:
> Baptiste Coudurier wrote:
> > Hi guys,
> >
> > $subject, 2 patches, I'll commit pts/dts renaming seperately.
> >
> > Specs: http://www.adobe.com/devnet/flv/
> >
>
> Muxer dts delay update, this is simpler I think.
[...]
> @@ -305,18 +349,35 @@
> put_byte(pb, FLV_TAG_TYPE_AUDIO);
> }
>
> + if (enc->codec_id == CODEC_ID_H264) {
> + if (ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size) < 0)
> + return -1;
> + assert(pkt->size);
> + size = pkt->size;
> + if (!flv->delay && (int)pkt->dts < 0)
> + flv->delay = (1LL<<32) - pkt->dts;
> + ts = (int)pkt->dts + flv->delay; // XXX first dts is negative
> + } else
> + ts = pkt->pts;
If you add a constant to all timestamps of one stream but not to the
timestamps of the other streams then there would be a slight AV sync error.
> put_be24(pb,size + flags_size);
> - put_be24(pb,pkt->pts);
> - put_byte(pb,pkt->pts >> 24);
> + put_be24(pb,ts);
> + put_byte(pb,ts >> 24);
> put_be24(pb,flv->reserved);
> put_byte(pb,flags);
> if (enc->codec_id == CODEC_ID_VP6)
> put_byte(pb,0);
> if (enc->codec_id == CODEC_ID_VP6F)
> put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
> + else if (enc->codec_id == CODEC_ID_AAC)
> + put_byte(pb,1); // AAC raw
> + else if (enc->codec_id == CODEC_ID_H264) {
> + put_byte(pb,1); // AVC NALU
> + put_be24(pb,pkt->pts - (int)pkt->dts);
why the cast ?
> + }
> put_buffer(pb, pkt->data, size);
> put_be32(pb,size+flags_size+11); // previous tag size
> - flv->duration = pkt->pts + pkt->duration;
> + if (pkt->pts + pkt->duration > flv->duration)
> + flv->duration = pkt->pts + pkt->duration;
FFMAX
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080505/678ba70b/attachment.pgp>
More information about the ffmpeg-devel
mailing list