[FFmpeg-devel] [PATCH] h264/aac in flv
Baptiste Coudurier
baptiste.coudurier
Tue May 6 11:13:01 CEST 2008
Michael Niedermayer wrote:
> 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.
Good point.
>> 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 ?
Because truncate_ts will make them positive :/
Attached patch may solve the issue.
>> + }
>> 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
Yes, patch updated.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: negative_truncate.patch
Type: text/x-diff
Size: 709 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080506/69cc3726/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h264_aac_flv_mux.patch
Type: text/x-diff
Size: 5461 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080506/69cc3726/attachment-0001.patch>
More information about the ffmpeg-devel
mailing list