mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
videoio: fixed MSMF writer fps handling
This commit is contained in:
parent
f15e885baf
commit
585593e9fc
@ -1566,7 +1566,7 @@ bool CvVideoWriter_MSMF::open( const cv::String& filename, int fourcc,
|
||||
SUCCEEDED(mediaTypeOut->SetUINT32(MF_MT_AVG_BITRATE, bitRate)) &&
|
||||
SUCCEEDED(mediaTypeOut->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive)) &&
|
||||
SUCCEEDED(MFSetAttributeSize(mediaTypeOut.Get(), MF_MT_FRAME_SIZE, videoWidth, videoHeight)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeOut.Get(), MF_MT_FRAME_RATE, (UINT32)fps, 1)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeOut.Get(), MF_MT_FRAME_RATE, (UINT32)(fps * 1000), 1000)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeOut.Get(), MF_MT_PIXEL_ASPECT_RATIO, 1, 1)) &&
|
||||
// Set the input media type.
|
||||
SUCCEEDED(MFCreateMediaType(&mediaTypeIn)) &&
|
||||
@ -1575,7 +1575,7 @@ bool CvVideoWriter_MSMF::open( const cv::String& filename, int fourcc,
|
||||
SUCCEEDED(mediaTypeIn->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive)) &&
|
||||
SUCCEEDED(mediaTypeIn->SetUINT32(MF_MT_DEFAULT_STRIDE, 4 * videoWidth)) && //Assume BGR32 input
|
||||
SUCCEEDED(MFSetAttributeSize(mediaTypeIn.Get(), MF_MT_FRAME_SIZE, videoWidth, videoHeight)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeIn.Get(), MF_MT_FRAME_RATE, (UINT32)fps, 1)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeIn.Get(), MF_MT_FRAME_RATE, (UINT32)(fps * 1000), 1000)) &&
|
||||
SUCCEEDED(MFSetAttributeRatio(mediaTypeIn.Get(), MF_MT_PIXEL_ASPECT_RATIO, 1, 1)) &&
|
||||
// Set sink writer parameters
|
||||
SUCCEEDED(MFCreateAttributes(&spAttr, 10)) &&
|
||||
@ -1596,7 +1596,7 @@ bool CvVideoWriter_MSMF::open( const cv::String& filename, int fourcc,
|
||||
{
|
||||
initiated = true;
|
||||
rtStart = 0;
|
||||
MFFrameRateToAverageTimePerFrame((UINT32)fps, 1, &rtDuration);
|
||||
MFFrameRateToAverageTimePerFrame((UINT32)(fps * 1000), 1000, &rtDuration);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user