[PATCH] get rid of AVFrac
Hello, since it is marked as deprecated... Does the attached path look correct to you? And would this need a version increment? Greetings, Reimar D?ffinger
Hi On Fri, Oct 13, 2006 at 01:22:06AM +0200, Reimar D?ffinger wrote:
Hello, since it is marked as deprecated... Does the attached path look correct to you?
/libavformat/libavformat.a(utils.o): In function `av_write_header': /home/michael/ffmpeg-svn/trunk/libavformat/utils.c:2193: undefined reference to `av_frac_init'
And would this need a version increment?
did anyone use the av frac stuff? if yes then yes a version increment is needed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In the past you could go to a library and read, borrow or copy any book Today you'd get arrested for mere telling someone where the library is
Hello, On Fri, Oct 13, 2006 at 01:18:10PM +0200, Michael Niedermayer wrote:
On Fri, Oct 13, 2006 at 01:22:06AM +0200, Reimar D?ffinger wrote:
Hello, since it is marked as deprecated... Does the attached path look correct to you?
/libavformat/libavformat.a(utils.o): In function `av_write_header': /home/michael/ffmpeg-svn/trunk/libavformat/utils.c:2193: undefined reference to `av_frac_init'
Fixed.
And would this need a version increment?
did anyone use the av frac stuff? if yes then yes a version increment is needed
Well, that exactly is the question... I have no idea if someone might have used it. Attached patch would change the version number. Of course such a version change just because of this seems a bit "overkill" to me, but the alternative would be an ifdef mess like done on other occasions. I don't like that much, but if that is preferred I could come up with a patch for that way as well. I also though about only removing the uses of AVFrac but not the functions, but I think that would not help because it still would change the AVFormatContext (or wouldn't this require a version increment?). Greetings, Reimar D?ffinger
On Friday, 13 October 2006 at 14:48, Reimar D?ffinger wrote:
Index: libavformat/avformat.h =================================================================== --- libavformat/avformat.h (revision 6681) +++ libavformat/avformat.h (working copy) @@ -25,8 +25,8 @@ extern "C" { #endif
-#define LIBAVFORMAT_VERSION_INT ((50<<16)+(6<<8)+0) -#define LIBAVFORMAT_VERSION 50.6.0 +#define LIBAVFORMAT_VERSION_INT ((51<<16)+(6<<8)+0) +#define LIBAVFORMAT_VERSION 51.6.0
IIUC this is 50.6.0 as in major.minor.revision, so going from 50 to 51 should mean starting with minor=0 again, i.e. 51.0.0. Am I right? Regards, R. -- MPlayer developer and RPMs maintainer: http://rpm.greysector.net/mplayer/ There should be a science of discontent. People need hard times and oppression to develop psychic muscles. -- from "Collected Sayings of Muad'Dib" by the Princess Irulan
Hello, On Fri, Oct 13, 2006 at 08:28:46PM +0200, Dominik 'Rathann' Mierzejewski wrote:
On Friday, 13 October 2006 at 14:48, Reimar D?ffinger wrote:
Index: libavformat/avformat.h =================================================================== --- libavformat/avformat.h (revision 6681) +++ libavformat/avformat.h (working copy) @@ -25,8 +25,8 @@ extern "C" { #endif
-#define LIBAVFORMAT_VERSION_INT ((50<<16)+(6<<8)+0) -#define LIBAVFORMAT_VERSION 50.6.0 +#define LIBAVFORMAT_VERSION_INT ((51<<16)+(6<<8)+0) +#define LIBAVFORMAT_VERSION 51.6.0
IIUC this is 50.6.0 as in major.minor.revision, so going from 50 to 51 should mean starting with minor=0 again, i.e. 51.0.0. Am I right?
Of course, I fixed it locally so it will be correct should we decide to go with this version. Greetings, Reimar D?ffinger
Hi On Fri, Oct 13, 2006 at 02:48:06PM +0200, Reimar D?ffinger wrote: [...]
And would this need a version increment?
did anyone use the av frac stuff? if yes then yes a version increment is needed
Well, that exactly is the question... I have no idea if someone might have used it. Attached patch would change the version number. Of course such a version change just because of this seems a bit "overkill" to me, but the alternative would be an ifdef mess like done on other occasions. I don't like that much, but if that is preferred I could come up with a patch for that way as well. I also though about only removing the uses of AVFrac but not the functions, but I think that would not help because it still would change the AVFormatContext (or wouldn't this require a version increment?).
[...]
@@ -2193,7 +2189,6 @@ if (den != AV_NOPTS_VALUE) { if (den <= 0) return AVERROR_INVALIDDATA; - av_frac_init(&st->pts, 0, 0, den); } } return 0; @@ -2221,7 +2216,7 @@ if((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay){ pkt->dts= // pkt->pts= st->cur_dts; - pkt->pts= st->pts.val; + pkt->pts= st->pts; }
//calculate dts from pts @@ -2246,7 +2241,7 @@
// av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts2:%lld dts2:%lld\n", pkt->pts, pkt->dts); st->cur_dts= pkt->dts; - st->pts.val= pkt->dts; + st->pts= pkt->dts;
/* update pts */ switch (st->codec->codec_type) { @@ -2255,12 +2250,12 @@
/* HACK/FIXME, we skip the initial 0-size packets as they are most likely equal to the encoder delay, but it would be better if we had the real timestamps from the encoder */ - if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) { - av_frac_add(&st->pts, (int64_t)st->time_base.den * frame_size); + if (frame_size >= 0 && (pkt->size || st->pts)) { + st->pts += (int64_t)st->time_base.den * frame_size;
this doesnt look correct ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In the past you could go to a library and read, borrow or copy any book Today you'd get arrested for mere telling someone where the library is
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ...
Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints. Greetings, Reimar D?ffinger
Hi On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ...
Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints.
ok, so lets see what the code does or is supposed to do (note iam not the author of that code...) first the AVStream->pts AVFrac was "set" to 0, (the AV_NOPTS_VALUE from your patch ismore correct though yes) next if we encode a packet which has a dts then AVFrac is set to that after each packet we update AVFrac depending on the _codec_ timebase or samplerate and framesize for audio if now a packet has no known dts then we use the value from AVFrac for it so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something) your code does: st->pts= pkt->dts; -> both AVPacket->dts and AVStream->pts must be in the same timebase (AVStream->timebase) but st->pts += (int64_t)st->time_base.den * st->codec->time_base.num; for 1 frame which should be st->pts += 1*codec_timebase/container_timebase IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In the past you could go to a library and read, borrow or copy any book Today you'd get arrested for mere telling someone where the library is
Hi Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ... Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints.
[...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side. However ffmpeg.c does not compile anymore, and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA checking for life_signs in -lkenny... no
Hi On Sat, Dec 16, 2006 at 01:29:48AM +0100, Baptiste Coudurier wrote:
Hi
Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ... Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints.
[...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side.
However ffmpeg.c does not compile anymore,
that is a problem, patch rejected :)
and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong.
yes cur_dts and st->pts represent the same thing IIRC ... the difference is that st->pts is exact and cur_dts is not, using the later will cause terrible AV-desync under the correct circumstances, think about a container timebase of 1/1000 and 30fps video, the duration of one frame is 33.333... in the container timebase, if you repeatly add 33 you will be off by 0.6 seconds per minute ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin
Hi Michael Niedermayer wrote:
Hi
On Sat, Dec 16, 2006 at 01:29:48AM +0100, Baptiste Coudurier wrote:
Hi
Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ... Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints. [...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side.
However ffmpeg.c does not compile anymore,
that is a problem, patch rejected :)
Hehe, yes, but is the patch the good approach (get rid of AVFrac and drop support for missing dts or pts on the encoder side), and therefore ffmpeg.c must be updated, or should we keep st->pts ? If the latter, I would that say AVFrac is not that useless since ffmpeg.c uses it, and it is exact.
and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong.
yes cur_dts and st->pts represent the same thing IIRC ... the difference is that st->pts is exact and cur_dts is not, using the later will cause terrible AV-desync under the correct circumstances, think about a container timebase of 1/1000 and 30fps video, the duration of one frame is 33.333... in the container timebase, if you repeatly add 33 you will be off by 0.6 seconds per minute ...
I see. Now if st->pts is changed to int64_t and uses av_rescale_q from codec timebase to stream timebase, is it less exact than AVFrac ? -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA SMARTJOG S.A. http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA Phone: +33 1 49966312
Hi On Mon, Dec 18, 2006 at 11:40:00AM +0100, Baptiste Coudurier wrote:
Hi
Michael Niedermayer wrote:
Hi
On Sat, Dec 16, 2006 at 01:29:48AM +0100, Baptiste Coudurier wrote:
Hi
Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...]
this doesnt look correct ... Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints. [...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side.
However ffmpeg.c does not compile anymore,
that is a problem, patch rejected :)
Hehe, yes, but is the patch the good approach (get rid of AVFrac and drop support for missing dts or pts on the encoder side), and therefore ffmpeg.c must be updated, or should we keep st->pts ?
If the latter, I would that say AVFrac is not that useless since ffmpeg.c uses it, and it is exact.
and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong.
yes cur_dts and st->pts represent the same thing IIRC ... the difference is that st->pts is exact and cur_dts is not, using the later will cause terrible AV-desync under the correct circumstances, think about a container timebase of 1/1000 and 30fps video, the duration of one frame is 33.333... in the container timebase, if you repeatly add 33 you will be off by 0.6 seconds per minute ...
I see. Now if st->pts is changed to int64_t and uses av_rescale_q from codec timebase to stream timebase, is it less exact than AVFrac ?
that might work ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates
Hi Michael Niedermayer wrote:
Hi
On Mon, Dec 18, 2006 at 11:40:00AM +0100, Baptiste Coudurier wrote:
Hi
Michael Niedermayer wrote:
Hi
Hi
Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
Hello, On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: [...] > this doesnt look correct ... Hmm.. well, no idea what exactly the old code does and how. Here is another try, it's the best I can do without further hints. [...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side.
However ffmpeg.c does not compile anymore,
On Sat, Dec 16, 2006 at 01:29:48AM +0100, Baptiste Coudurier wrote: that is a problem, patch rejected :) Hehe, yes, but is the patch the good approach (get rid of AVFrac and drop support for missing dts or pts on the encoder side), and therefore ffmpeg.c must be updated, or should we keep st->pts ?
If the latter, I would that say AVFrac is not that useless since ffmpeg.c uses it, and it is exact.
and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong. yes cur_dts and st->pts represent the same thing IIRC ... the difference is that st->pts is exact and cur_dts is not, using the later will cause terrible AV-desync under the correct circumstances, think about a container timebase of 1/1000 and 30fps video, the duration of one frame is 33.333... in the container timebase, if you repeatly add 33 you will be off by 0.6 seconds per minute ...
I see. Now if st->pts is changed to int64_t and uses av_rescale_q from codec timebase to stream timebase, is it less exact than AVFrac ?
that might work ...
Ok, here is a new attempt. I quickly checked values of pts.val and new pts values, they were equal, also with -vsync 0 -r 40. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA SMARTJOG S.A. http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA Phone: +33 1 49966312
Baptiste Coudurier a ?crit :
Hi
Michael Niedermayer wrote:
Hi
Hi
Michael Niedermayer wrote:
Hi
Hi
Michael Niedermayer a ?crit :
Hi
On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote: > Hello, > On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote: > [...] >> this doesnt look correct ... > Hmm.. well, no idea what exactly the old code does and how. > Here is another try, it's the best I can do without further hints. [...]
so what the code does is it simply fills in missing timestamps on the encoding side and it does so without rounding errors assuming constant framerate and a few other things allthough the usefullness of the whole is questionable (the user app should set the timestamps and not leave it to lav* to guess something)
[...]
IMHO drop "support" for missing dts on the encoder side completely it makes no sense at all, its like sending emails with no To: field
Here is an updated patch which drop support for missing pts or dts on the encoder side.
However ffmpeg.c does not compile anymore,
On Sat, Dec 16, 2006 at 01:29:48AM +0100, Baptiste Coudurier wrote: that is a problem, patch rejected :) Hehe, yes, but is the patch the good approach (get rid of AVFrac and drop support for missing dts or pts on the encoder side), and therefore ffmpeg.c must be updated, or should we keep st->pts ?
If the latter, I would that say AVFrac is not that useless since ffmpeg.c uses it, and it is exact.
and Im not sure to know exactly what ffmpeg.c does, could st->pts be updated to use rescaled st->cur_dts ? Seems that cur_dts would only be 1 frame less that st->pts.val in that case, maybe Im wrong. yes cur_dts and st->pts represent the same thing IIRC ... the difference is that st->pts is exact and cur_dts is not, using the later will cause terrible AV-desync under the correct circumstances, think about a container timebase of 1/1000 and 30fps video, the duration of one frame is 33.333... in the container timebase, if you repeatly add 33 you will be off by 0.6 seconds per minute ...
I see. Now if st->pts is changed to int64_t and uses av_rescale_q from codec timebase to stream timebase, is it less exact than AVFrac ?
On Mon, Dec 18, 2006 at 11:40:00AM +0100, Baptiste Coudurier wrote: that might work ...
Ok, here is a new attempt. I quickly checked values of pts.val and new pts values, they were equal, also with -vsync 0 -r 40.
Checked again, and regression tests fails for asf, ts, mpg. video pts are equal, audio differs: asf: old: av_write_frame: index 1, pts2:1097 dts2:1097 av_write_frame: index 1, pts2:1123 dts2:1123 av_write_frame: index 1, pts2:1149 dts2:1149 new: av_write_frame: index 1, pts2:1092 dts2:1092 av_write_frame: index 1, pts2:1118 dts2:1118 av_write_frame: index 1, pts2:1144 dts2:1144 diff seems to increase while encoding, like you were fearing. ts: old: av_write_frame: index 1, pts2:84637 dts2:84637 av_write_frame: index 0, pts2:86400 dts2:82800 av_write_frame: index 1, pts2:86988 dts2:86988 av_write_frame: index 1, pts2:89339 dts2:89339 new: av_write_frame: index 1, pts2:84636 dts2:84636 av_write_frame: index 0, pts2:86400 dts2:82800 av_write_frame: index 1, pts2:86987 dts2:86987 av_write_frame: index 1, pts2:89338 dts2:89338 So what do you think ? It seems not safe to use int64_t, or my code is wrong. Do we drop pts generation ? Do we keep AVFrac ? -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA checking for life_signs in -lkenny... no
participants (4)
-
baptiste.coudurier@smartjog.com -
dominik@rangers.eu.org -
michaelni@gmx.at -
Reimar.Doeffinger@stud.uni-karlsruhe.de