|
|
I'm trying to create a WMV video from a sequence of images.
My code does the following:
1) Sets the Video input's subtype to WMMEDIASUBTYPE_RGB8 2) Finds the RGB8 format on that input 3) Sets the width, height, and size on that bitmap header 4) Sets that input's type to the format type 5) Sets the output file name 6) Calls BeginWriting 7) Allocates a sample 6) Gets and fills the sample buffer (this API seems to have an error, it says pdwBuffer, but it is of type BYTE*) 8) Sets the buffer length 9) Calls write sample 10) Repeats 7 to 9 for each frame 11) Calls EndWriting
The problem I'm having is that WriteSample or EndWriting fails, both with HR == NS_E_INVALID_DATA (C00D002F).
I've noticed that if I use a sample time of (frameIndex * 16 * 1000) for 60 fps, the WriteSample call fails relatively quickly. Is that frame rate just not supported?
If I pass (frameIndex * 100) for sample time, EndWriting falls.
Any ideas what I am doing wrong? Do you need more information?
Thanks!
|
|
Brandon Bloom wrote:
[Quoted Text] > Any ideas what I am doing wrong? Do you need more information? >
Do you precede your image data with the video image header?
|
|
|
[Quoted Text] > Do you precede your image data with the video image header?
Good call! I was not doing that. But the same issue occurs now that I do.
I've increased the size of my sample buffers by sizeof(WMT_VIDEOIMAGE_SAMPLE2), cast the pBuffer to WMT_VIDEOIMAGE_SAMPLE2*, fill in the values and then write in my values offset by the size of the structure.
Unfortunately, I am still seeing the exact same failure and error code.
|
|
Brandon Bloom wrote:
[Quoted Text] > Good call! I was not doing that. But the same issue occurs now that I do.
I was bit by this when I started with the SDK <g>
> Unfortunately, I am still seeing the exact same failure and error code.
Some kind of data validation is failing. Make sure your image size is calculated properly (taking into account the DWORD rounding up ).
If you are sure all your values are correct, you could try stepping into the WriteSample() code and see where the error is returned. It's not quick or easy, but you should be able to find that spot and figure out what kind of data the code is validating.
..a
p.s. I had to do this when developing code that writes custom-compressed video samples. The docs talked about using a new GUID. They failed to mention that the first DWORD (FOURCC, basically) is the new one. The rest of the GUID had to be known to the WMF.
That's the GUID. { 0x00000000, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 } } ;
|
|
|