[FFmpeg-devel] [RFC][PATCH] ticks_per_frame / timebase
Baptiste Coudurier
baptiste.coudurier
Fri Feb 27 00:20:42 CET 2009
Michael Niedermayer wrote:
> On Thu, Feb 26, 2009 at 02:46:36PM -0800, Baptiste Coudurier wrote:
>> Michael Niedermayer wrote:
>>> On Thu, Feb 26, 2009 at 02:18:41PM -0800, Baptiste Coudurier wrote:
>>>> Hi guys,
>>>>
>>>> Michael Niedermayer wrote:
>>>>> On Thu, Feb 26, 2009 at 10:05:28PM +0100, Ivan Schreter wrote:
>>>>>> Michael Niedermayer wrote:
>>>>>>> [...]
>>>>>>> also i think the reset of the sei vars should be in
>>>>>>> decode_nal_units()
>>>>>>> ...
>>>>>>> if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){
>>>>>>> h->current_slice = 0;
>>>>>>> if (!s->first_field)
>>>>>>> s->current_picture_ptr= NULL;
>>>>>>> <-----------------------here
>>>>>>> }
>>>>>>>
>>>>>>> the reason is that just reseting at the end of a pic is "risky" if that
>>>>>>> end
>>>>>>> isnt reached
>>>>>>>
>>>>>>>
>>>>>> Like in the attached patch?
>>>>> yes, patch ok
>>>>>
>>>>> btw, if you want a svn write account, (and agree to the devel/svn policy
>>>>> and split patches a little more, this one should be
>>>>> factorizing the code and then seperately adding the new call)
>>>>> then send diego b. some username & password gpg encrypted
>>>>>
>>>> Applied both patches:
>>>>
>>>> ffmpeg -i h264.mp4 -vcodec copy test.mov
>>>>
>>>> Seems stream 1 codec frame rate differs from container frame rate: 12.50
>>>> (25/2) -> 25.00 (25/1)
>>>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'H264.mp4':
>>>> Duration: 00:00:02.18, start: 0.000000, bitrate: 2245 kb/s
>>>> Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16
>>>> Stream #0.1(eng): Video: h264, yuv420p, 720x576, 25 tbr, 25 tbn, 25 tbc
>>>> File 'test.mov' already exists. Overwrite ? [y/N] y
>>>> Output #0, mov, to 'test.mov':
>>>> Stream #0.0(eng): Video: libx264, yuv420p, 720x576, q=2-31, 90k tbn,
>>>> 25 tbc
>>>> Stream #0.1(eng): Audio: libfaac, 44100 Hz, stereo, s16, 64 kb/s
>>>>
>>>> Is this supposed to report 12.50 ?
>>> no, ive droped the hunk that messed with the printing in ffmpeg.c locally
>>> is the nonsense it prints the only problem? or are there other problems?
>>>
>> It seems ok, however it does not do the same for MPEG-2 when I stream copy:
>>
>> Seems stream 0 codec frame rate differs from container frame rate: 25.00
>> (50/2) -> 25.00 (25/1)
>> Input #0, mpeg, from 'PubMatrix.mpg':
>> Duration: 00:00:24.26, start: 0.220000, bitrate: 11888 kb/s
>> Stream #0.0[0x1e0]: Video: mpeg2video, yuv422p, 720x608 [PAR 1:1 DAR
>> 45:38], 11386 kb/s, 25 tbr, 90k tbn, 50 tbc
>> Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
>> File 'test.mov' already exists. Overwrite ? [y/N] y
>> Output #0, mov, to 'test.mov':
>> Stream #0.0: Video: mpeg2video, yuv422p, 720x608 [PAR 1:1 DAR
>> 45:38], q=2-31, 11386 kb/s, 90k tbn, 50 tbc
>> Stream #0.1: Audio: libfaac, 48000 Hz, stereo, s16, 64 kb/s
>> Stream mapping:
>> Stream #0.0 -> #0.0
>> Stream #0.1 -> #0.1
>>
>> In this case pkt->duration is 2 and timebase.den is 50, with H.264
>> pkt->duration is 1 and timebase.den is 25, is this normal ? Can't we get
>> 1 and 1/25 with MPEG-2 too ?
>
> yes, the following hunk does that:
> @@ -1750,9 +1751,10 @@
> codec->bit_rate = icodec->bit_rate;
> codec->extradata= icodec->extradata;
> codec->extradata_size= icodec->extradata_size;
> - if(av_q2d(icodec->time_base) > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000)
> + if(av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
> codec->time_base = icodec->time_base;
> - else
> + codec->time_base.num *= icodec->ticks_per_frame;
> + }else
> codec->time_base = ist->st->time_base;
> switch(codec->codec_type) {
> case CODEC_TYPE_AUDIO:
>
>
> more issues left before i can commit it?
Nice.
Please gimme 5 mins, I'm testing TS with H.264 and MPEG-2.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel
mailing list