Re: Is my AvgTimerPerFrame calculation correct?
- From: "Alessandro Angeli [MVP::DS/MF]" <nobody@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Jul 2006 23:55:56 +0200
El Bobo Libre wrote:
In the WMVIDEOINFOHEADER structure, the AvgTimePerFrame
is described as the "desired average time per frame in
100-ns units."
So, is supposed to mean the duration of each frame?
Yes.
If so, is this calculation correct for a 30 fps video
stream?
AvgTimePerFrame = 333333; // (1/30) * 10,000,000
Or, more precisely:
AvgTimePerFrame = 333667; // (1/29.97) * 10,000,000
It's correct.
Second (bonus) question:
If I am writing pre-compressed samples to the Writer
object (from a third-party codec,) how much of the
WMVIDEOINFOHEADER structure and the BITMAPINFOHEADER
sub-structure do I really need to fill-in? Are there any
members that I can/should omit?
You need to fill-in everything your third-party codec
requires. This usually means
VIDEOINFOHEADER::rcSource = (0,0)-(width,height)
VIDEOINFOHEADER::rcTarget = VIDEOINFOHEADER::rcSource
VIDEOINFOHEADER::AvgTimePerFrame
BITMAPINFOHEADER::biSize = sizeof(BITMAPINFOHEADER)
BITMAPINFOHEADER::biWidth = width
BITMAPINFOHEADER::biHeight = height
BITMAPINFOHEADER::biPlanes = 1
BITMAPINFOHEADER::biBitCount = depends on codec (usually 24
or 0)
BITMAPINFOHEADER::biCompression = codec's FOURCC
BITMAPINFOHEADER::biSizeImage = depends on codec (usually 0
or biWidth*biHeight*biBitCount/8)
Set everything else to 0.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// a dot angeli at psynet dot net
.
- Follow-Ups:
- Re: Is my AvgTimerPerFrame calculation correct?
- From: El Bobo Libre
- Re: Is my AvgTimerPerFrame calculation correct?
- Prev by Date: Re: How does the Writer NetworkSink deliver samples to client connecti
- Next by Date: Re: Is my AvgTimerPerFrame calculation correct?
- Previous by thread: Re: How does the Writer NetworkSink deliver samples to client connecti
- Next by thread: Re: Is my AvgTimerPerFrame calculation correct?
- Index(es):
Relevant Pages
|