Re: [FFmpeg-devel] Suggested Patch for timecode timebase calculation in mov.c
On Fri, Jan 23, 2015 at 06:44:56AM -0800, jon wrote: Hi Michael, That is great! I see what you are referring to in mov_read_timecode_track(). However the text of that comment seems contradictory to me based on what I have read in the QuickTime reference I sited about the tmcd counter flag. It seemed like prior to the patch I submitted mov_parse_stsd_data() was collecting the st-codec-time_base as if the counter flag was unset. That comment text comes from commit: 35da85562d2f731855b28d4ab3b9b0679730ebf7 Perhaps Clément Bœsch has a better understanding of the difference between timecode values when the counter flag is set and when it is not. My work was based on deciphering the samples I had at my disposal in conjunction with my interpretation of the reference pdf. From what I remember, all the samples I had were in frame number format even though the flag was not set. I haven't look at this stuff for a very long time though. [...] -- Clément B. pgpG6B0E2elRv.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Suggested Patch for timecode timebase calculation in mov.c
On Thu, Jan 22, 2015 at 09:09:53AM -0800, jon wrote: I never heard back about this and I think I have a new better are you subscribed to ffmpeg-devel ? solution now. I don't think the current mov.c timecode processing is handling the case where the timecode is in counter mode. Please read the following page 190 from: https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/qtff.pdf Specifically: Number of frames An 8-bit integer that contains the number of frames per second for the timecode format. If the time is a counter, this is the number of frames for each counter tick. I have sample media in counter mode if it helps. I tried to send that before as well, but I think it was too large. Please let me know how else I can help with this enhancement. Feel free to send clarification questions to me. yes, please provide a sample you can upload it via ftp see http://ffmpeg.org/bugreports.html any url that allows downloading from with wget works too [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Suggested Patch for timecode timebase calculation in mov.c
Hi ffmpeg developers. I am still new to attempting contributing here, so please let me know if there is a better approach for this. I am attaching a patch I would like to incorporate for calculating the stream time_base of the timecode data track in mov's. Please advise. Thanks! From 5ae0b5a9cf9c37e11d5a3fea05c80c66b7c00c3e Mon Sep 17 00:00:00 2001 From: Jon Morley j...@tweaksoftware.com Date: Tue, 9 Sep 2014 11:48:02 -0700 Subject: [PATCH] libavformat/mov.c: Set stream time_base from frameduration/timescale Use tmcd atom's timescale and frameduration to for stream time base instead of 1/framenum. For timecode streams that have an entry for each frame 1/framenum is less accurate than frameduration/timescale. --- libavformat/mov.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ae48c02..c300dd2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1530,8 +1530,10 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, tmcd_ctx-tmcd_flags = val; if (val 1) st-codec-flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; -st-codec-time_base.den = st-codec-extradata[16]; /* number of frame */ -st-codec-time_base.num = 1; +int timescale = AV_RB32(st-codec-extradata + 8); +int framedur = AV_RB32(st-codec-extradata + 12); +st-codec-time_base.den = timescale; +st-codec-time_base.num = framedur; if (size 30) { uint32_t len = AV_RB32(st-codec-extradata + 18); /* name atom length */ uint32_t format = AV_RB32(st-codec-extradata + 22); -- 1.8.5.2 (Apple Git-48) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Suggested Patch for timecode timebase calculation in mov.c
On Tue, Sep 09, 2014 at 12:01:23PM -0700, jon wrote: Hi ffmpeg developers. I am still new to attempting contributing here, so please let me know if there is a better approach for this. I am attaching a patch I would like to incorporate for calculating the stream time_base of the timecode data track in mov's. Please advise. Thanks! mov.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) 520754621cc38bff327ffd487d43d07c8f14925c timecode_time_base.patch From 5ae0b5a9cf9c37e11d5a3fea05c80c66b7c00c3e Mon Sep 17 00:00:00 2001 From: Jon Morley j...@tweaksoftware.com Date: Tue, 9 Sep 2014 11:48:02 -0700 Subject: [PATCH] libavformat/mov.c: Set stream time_base from frameduration/timescale Use tmcd atom's timescale and frameduration to for stream time base instead of 1/framenum. For timecode streams that have an entry for each frame 1/framenum is less accurate than frameduration/timescale. --- libavformat/mov.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ae48c02..c300dd2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1530,8 +1530,10 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, tmcd_ctx-tmcd_flags = val; if (val 1) st-codec-flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; -st-codec-time_base.den = st-codec-extradata[16]; /* number of frame */ -st-codec-time_base.num = 1; +int timescale = AV_RB32(st-codec-extradata + 8); +int framedur = AV_RB32(st-codec-extradata + 12); +st-codec-time_base.den = timescale; +st-codec-time_base.num = framedur; the intermediate variables look unneeded. But if you want to keep them, their declaration should be moved to the block start as some compilers dont like mixed declarations and statements. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel