Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Timecode location in avi file

452 views
Skip to first unread message

aaron_...@hotmail.com

unread,
Apr 22, 2007, 3:43:23 PM4/22/07
to comp.os.ms-windows.programmer.multimedia
Hi,

I am trying to edit an avi file.
I need to know exactly where the timecode struct is located in the avi
file.
The avi is based on a sequence of images and is not a captured avi.

Do you also know where can I download a sample file that has a
timecode?

Thanks,
Aaron

Michel Roujansky - DirectShow Consultant and Trainer

unread,
Apr 22, 2007, 5:33:33 PM4/22/07
to
On Apr 22, 9:43 pm, aaron_komi...@hotmail.com wrote:
> I need to know exactly where the timecode struct is located in the avi
> file.

There is no timecode in an AVI file.... It asumes a constant framerate
specified in the header. See the OpenDML AVI File Format Extensions
document for description of the header format :
http://www.the-labs.com/Video/odmlff2-avidef.pdf

> Do you also know where can I download a sample file that has a
> timecode?

Doesn't exist. If you want avi files :
http://www.google.com/search?hl=en&q=avi+sample

Alessandro Angeli

unread,
Apr 22, 2007, 5:43:53 PM4/22/07
to
From: "aaron_...@hotmail.com"

> I am trying to edit an avi file.
> I need to know exactly where the timecode struct is
> located in the avi file.
> The avi is based on a sequence of images and is not a
> captured avi.

AVI files do not include presentation timestamps of any kind
nor they offer a standard facility to include SMPTE
timecodes. If you want the former: start_time = frame_index
* time_per_frame, stop_tim = start_time + time_per_frame,
since AVIs have a fixed frame rate. If your file contains
the latter, then you need to find out what custom estension
to the AVI syntax the file creator used.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Johan Stäck

unread,
Apr 23, 2007, 3:48:19 AM4/23/07
to
Alessandro Angeli skrev:

> From: "aaron_...@hotmail.com"
>
>> I am trying to edit an avi file.
>> I need to know exactly where the timecode struct is
>> located in the avi file.
>> The avi is based on a sequence of images and is not a
>> captured avi.
>
> AVI files do not include presentation timestamps of any kind
> nor they offer a standard facility to include SMPTE
> timecodes. If you want the former: start_time = frame_index
> * time_per_frame, stop_tim = start_time + time_per_frame,
> since AVIs have a fixed frame rate. If your file contains
> the latter, then you need to find out what custom estension
> to the AVI syntax the file creator used.
>
>
In the special case of an AVI file with DV frames there will be a
timecode to retrieve...

/J

aaron_...@hotmail.com

unread,
Apr 23, 2007, 5:54:49 AM4/23/07
to

> AVI files do not include presentation timestamps of any kind
> nor they offer a standard facility to include SMPTE
> timecodes. If you want the former: start_time = frame_index
> * time_per_frame, stop_tim = start_time + time_per_frame,
> since AVIs have a fixed frame rate. If your file contains
> the latter, then you need to find out what custom estension
> to the AVI syntax the file creator used.


Thanks for your reply.

Maybe you can help me in another way.
I am creating an avi (I don't mind using other file formats such as
wmv if necessary)
from jpg 2000 files.
My end user wants to be able to refer to a frame directly using an
editing application like premier. I thought the way was to add
timecode to the file, but from your answers it seems impossible.
I am using Morgen as my decoder, I am not limited to avi1 or to any
video format.
Any help will be greatly appreciated.

Alessandro Angeli

unread,
Apr 23, 2007, 3:11:32 PM4/23/07
to
From: "Johan Stäck"

> In the special case of an AVI file with DV frames there
> will be a timecode to retrieve...

I suppose that depends on what you define as AVI files
(IMHO, type-1 are not even AVIs and with type-2 the DV
metadata is in the data streams and not in the RIFF/AVI
structures).

Alessandro Angeli

unread,
Apr 23, 2007, 3:13:52 PM4/23/07
to
From: "aaron_...@hotmail.com"

> Maybe you can help me in another way.
> I am creating an avi (I don't mind using other file
> formats such as wmv if necessary)
> from jpg 2000 files.
> My end user wants to be able to refer to a frame directly
> using an editing application like premier. I thought the
> way was to add timecode to the file, but from your
> answers it seems impossible.
> I am using Morgen as my decoder, I am not limited to avi1
> or to any video format.
> Any help will be greatly appreciated.

The index in AVI files is frame-based, so any AVI editor
that uses the index (more or less every one of them) will be
able to precisely seek by frame index or frame timestamp.
Just remember to include an index in your AVI even though it
is optional.

Johan Stäck

unread,
Apr 24, 2007, 7:29:05 AM4/24/07
to
Alessandro Angeli skrev:

> From: "Johan Stäck"
>
>> In the special case of an AVI file with DV frames there
>> will be a timecode to retrieve...
>
> I suppose that depends on what you define as AVI files
> (IMHO, type-1 are not even AVIs and with type-2 the DV
> metadata is in the data streams and not in the RIFF/AVI
> structures).
>
This is how I understand it:

Both type 1 & 2 are valid AVI files.
Type 1 contains only the video (DV)stream.
The DV frames contain in themself both video,audio and metadata.

For type 2, the audio portion of the DV frames is extracted and added to
the AVI as a proper audio stream.
In effect, the audio information is duplicated.
The DV frames are left intact.

So for both type 1 and 2 there will be metadata including timecode that
can be extracted from the DV frames.

/Johan

Mark Raishbrook

unread,
Apr 24, 2007, 1:08:03 PM4/24/07
to
> My end user wants to be able to refer to a frame directly using an
> editing application like premier. I thought the way was to add
> timecode to the file, but from your answers it seems impossible.

ASF (WMV) files can contain embedded TC data via use of the timecode index
object. Retrieving it is pretty simple. Have a look at
http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx for
more info.

Alessandro Angeli

unread,
Apr 24, 2007, 4:01:26 PM4/24/07
to
From: "Johan Stäck"

> Both type 1 & 2 are valid AVI files.

That is what I don't agree with. Type-1 files in my opinion
are not valid AVI files. A valid AVI file must conform to
either the AVI1.0 or AVI2.0/OpenDML specs and type-1 DV
"AVIs" do not, since they define the new 'iavs' stream type
and the new DVINFO stream format structure, hence an AVI
parser that conforms to the AVI specs will not successfully
parse type-1 DV files.

> So for both type 1 and 2 there will be metadata including
> timecode that can be extracted from the DV frames.

However, the metadata is in the DV data stream and not in
the AVI structures, so an AVI parser (even one that
understands the DV extensions) will not be able to extract
the metadata from the file just by looking at the AVI data
structures but it will need to actually understand at least
the bitstream syntax of the DV stream. This is the same as
extracting the IBP sequence of MPEG-4 video streams from an
AVI file: you need to actually understand the MPEG-4
bitstream syntax and understanding the AVI syntax is not
enough. This differs from metadata stored in the system
stream itself, which only requires you to parse the system
stream (the RIFF/AVI layer in this case).

Johan Stäck

unread,
Apr 25, 2007, 1:49:37 PM4/25/07
to
Alessandro Angeli skrev:

> From: "Johan Stäck"
>
>> Both type 1 & 2 are valid AVI files.
>
> That is what I don't agree with. Type-1 files in my opinion
> are not valid AVI files.
Well, Microsoft once defined the original AVI format.
Later they defined two ways of storing DV data in AVI files.

Since Ms "owns" the format, if they call it AVI, it is...
At least that is my way of looking upon it.
But this is of course a matter of opinion..

/J

>

Dave August

unread,
Apr 25, 2007, 2:45:57 PM4/25/07
to
Yep...

Micro$oft calls bugs, "features" all the time.. we just have to deal with
it...

The problem here is that people at M$ never think about things very deeply,
they just react...

The DIVX boys started to make M$ look foolish so M$ quickly came up with a
"We have MPEG-4 too" solution...

--.- Dave


"Johan Stäck" <jo...@stack.se> wrote in message
news:%23MbBZI2...@TK2MSFTNGP02.phx.gbl...

Alessandro Angeli

unread,
Apr 25, 2007, 3:20:43 PM4/25/07
to
From: "Dave August"

> Micro$oft calls bugs, "features" all the time.. we just
> have to deal with it...

Often.

> The problem here is that people at M$ never think about
> things very deeply, they just react...

Sometimes.

> The DIVX boys started to make M$ look foolish so M$
> quickly came up with a "We have MPEG-4 too" solution...

Never happened. Microsoft was one of the original developers
of MPEG-4.2 long before DivX. The sample codec source code
that shipped with the draft versions of MPEG-4.2 was
Microsoft's. Among the first working implementations of the
final drafts of MPEG-4.2 were Microsoft's, a.k.a.
MS-MPEG4v1/2/3, part WindowsMedia4. The first DivX codec was
Microsoft's as well, since DivX3 was just a (cleverly)
hacked MS-MPEG4v3 DLL. More or less at the same time when
DivXNetworks launched its not-yet-MPEG-4.2-compliant DivX4
codec using the OpenDivX source code in a closed-source
fashion (something I always thought of as a shady move),
Microsoft released its ISO-MPEG4v1 codec and shortly
afterwards dropped support for MPEG-4.2 altogether because
of the MPEG-4 licensing and brewed its own formats and never
looked back at MPEG-4, at least as of today.

0 new messages