Jump to content

HTC Tornado Camera programming (directshow)


Guest thenext1

Recommended Posts

Guest thenext1

I've been trying to overcome the limitation for which one cannot record video more than 176x144 in size, with the integrated camera app.

Windows mobile 2005 comes with intrinsic support for camera-enabled devices, and there are some samples in the respective SDKs that exploit these functionalities.

In the smartphone sdk, there's CeCamera that uses the integrated capture dialog to record video.

I can configure the size, and actually managed to record a 352x288 video, but the problem is that it does with very slow framerate, and the output video looks rugged, with strange vertical lines.

Also compression takes a lot.

In the pocketpc sdk, there's CameraCapture that uses a different approach: it uses DirectShow to read from the camera, simply opennig the device "CAM1:" on the phone.

After a little adaptation to the smartphone platform, i tested it on my SP5m.

This way, the capturing framerate is very high, almost 30fps I can say, but there weren't integrated options (in the program) to set the capturing size and the output was a 176x144 ASF file.

Compression takes forever, however.

Ther question is as follows:

The source device ins a DirectShow filter. CameraCapture, in its initialization code, sets its property "VCapName" to the value "CAM1:".

I couldn't find documentation regarding to these properties ANYWHERE...

There must be some properties dealing with capture size, or capture framerate, for example VCapSize or VCapFPS...

Does someone know??

The question evem is more broader as this is a DirectShow matter, and not of strict Smartphone programming...

Many thanks!!

enrico

Link to comment
Share on other sites

Guest thenext1

I've gone a bit further with the CameraCapture example, after a brief directshow tutorial.

I managed to get it streaming at 320x240, but the frame rate is uncontrollable... it reports it can do 7 to 15 FPS, but it always does 30 no matter what I set ;) (at 176x144 it did 60 FPS!!!!!)

I think this is a limitation of the htc camera driver.

Also I can't change nothing about the compression details... all methods return "Not Implemented".

The output isn't so bad, all in all, but the image coming from the camera (or perhaps from the HTC driver) is already saw-edged, and the compression has a strange effect of leaving white pixels all around when there are sharp borders in the image.

Also encoding takes a lot :P

You'll find the two compiled examples in the attachment.

CameraCapture is the i've been talking of now. It was an PPC app, so please use the menu to start/stop video instead of the buttons. To exit push back or home. FIles are saved as "\storage card\video1.asf"

ceCamera2 is the other example, using the pre-built function.. it makes videos with much lower FPS but somewhat better encoding (saw-edges are present however). Files are saved as "\storage card\prova1.wmv" (no matter what you type in the program, and please don't type anything as I didn't test that ;) )

You can select the resolution, the SP5m supports 176x144, 320x240, 352x288.

To capture video you must also go into the menu and select Mode->Video only, and then Video types->Standard.

please let me know what do you think of these....

camera.zip

Link to comment
Share on other sites

Guest kaplanfx

I am very interested in your work here. I will test the camera apps when I get home from work. I have some prgramming experiance, however I don't have visual studio and the dev kit for win-mo so unfortunately I can't tinker around. What I was hopping is that you might be the person to figure out how to increase the shutter speed (f-stop?) on the camera in the HTC tornado. It could be slightly faster as it currently overexposes and causes motion blurring (and the camera is always moving as its hard to hold), so we could certainly shave some time of the shutter and still take reasonably lit picks.

-Kap

Link to comment
Share on other sites

Guest leethacker

Very interesting work. I will definitely test it. :-) Keep on with your work. I really hope we will get a decent video recording app. :-D

Link to comment
Share on other sites

  • 10 months later...
Guest bigmimmo
I've gone a bit further with the CameraCapture example, after a brief directshow tutorial.

I managed to get it streaming at 320x240, but the frame rate is uncontrollable... it reports it can do 7 to 15 FPS, but it always does 30 no matter what I set ;) (at 176x144 it did 60 FPS!!!!!)

I think this is a limitation of the htc camera driver.

Also I can't change nothing about the compression details... all methods return "Not Implemented".

The output isn't so bad, all in all, but the image coming from the camera (or perhaps from the HTC driver) is already saw-edged, and the compression has a strange effect of leaving white pixels all around when there are sharp borders in the image.

Also encoding takes a lot :D

You'll find the two compiled examples in the attachment.

CameraCapture is the i've been talking of now. It was an PPC app, so please use the menu to start/stop video instead of the buttons. To exit push back or home. FIles are saved as "\storage card\video1.asf"

ceCamera2 is the other example, using the pre-built function.. it makes videos with much lower FPS but somewhat better encoding (saw-edges are present however). Files are saved as "\storage card\prova1.wmv" (no matter what you type in the program, and please don't type anything as I didn't test that :( )

You can select the resolution, the SP5m supports 176x144, 320x240, 352x288.

To capture video you must also go into the menu and select Mode->Video only, and then Video types->Standard.

please let me know what do you think of these....

Hello any chance you could share a source for the changing of the resolution and framerate? I am using a HTC P3600 and when I use the camera capture sample i get a 160x120 video using very low frame rate...

Thanks

Domenico

Link to comment
Share on other sites

Guest doobie
Hello any chance you could share a source for the changing of the resolution and framerate? I am using a HTC P3600 and when I use the camera capture sample i get a 160x120 video using very low frame rate...

Thanks

Domenico

Hi Domenico,

I'm considering buying a Qtek 8500 but i've heard that some phones don't allow custom applications to be run on them. Have you experienced that, if so was it easy to unlock?

I've never developed for Windows Mobile, but in DirectShow on WinXP you can change resolution by creating your own subclass of CTransInPlaceFilter and changing this function:

HRESULT MyFilter::CheckInputType(const CMediaType *proposedType) {
if ((proposedType->majortype != MEDIATYPE_Video) || proposedType->subtype != MEDIASUBTYPE_RGB24 ||
proposedType->formattype != FORMAT_VideoInfo || (proposedType->cbFormat < sizeof( VIDEOINFOHEADER )) )
{
return VFW_E_TYPE_NOT_ACCEPTED;
}

BITMAPINFOHEADER bmiHeader;
if ( proposedType->formattype == FORMAT_VideoInfo ) {
bmiHeader = ((VIDEOINFOHEADER*)proposedType->pbFormat)->bmiHeader;
} else {
/* For some reason this might lead to errors, so header2 is no longer allowed. */
bmiHeader = ((VIDEOINFOHEADER2*)proposedType->pbFormat)->bmiHeader;
}

/* data must be uncompressed 3 channels, 8 bit per channel and no padding */
if ( bmiHeader.biSizeImage != abs( bmiHeader.biWidth * bmiHeader.biHeight * 3 ) ||
bmiHeader.biCompression != BI_RGB || bmiHeader.biBitCount != 24 ) {
return VFW_E_TYPE_NOT_ACCEPTED;
}

return S_OK;
}
[/codebox]

You can VFW_E_TYPE_NOT_ACCEPTED if bmiHeader.biWidth or bmiHeader.biHeight is not to your liking. The filter doesn't have to do anything, but you can but it between the camera and the encoder to control image type.

Link to comment
Share on other sites

  • 4 weeks later...
Guest bigmimmo
Hi Domenico,

I'm considering buying a Qtek 8500 but i've heard that some phones don't allow custom applications to be run on them. Have you experienced that, if so was it easy to unlock?

I've never developed for Windows Mobile, but in DirectShow on WinXP you can change resolution by creating your own subclass of CTransInPlaceFilter and changing this function:

HRESULT MyFilter::CheckInputType(const CMediaType *proposedType) {
if ((proposedType->majortype != MEDIATYPE_Video) || proposedType->subtype != MEDIASUBTYPE_RGB24 ||
proposedType->formattype != FORMAT_VideoInfo || (proposedType->cbFormat < sizeof( VIDEOINFOHEADER )) )
{
return VFW_E_TYPE_NOT_ACCEPTED;
}

BITMAPINFOHEADER bmiHeader;
if ( proposedType->formattype == FORMAT_VideoInfo ) {
bmiHeader = ((VIDEOINFOHEADER*)proposedType->pbFormat)->bmiHeader;
} else {
/* For some reason this might lead to errors, so header2 is no longer allowed. */
bmiHeader = ((VIDEOINFOHEADER2*)proposedType->pbFormat)->bmiHeader;
}

/* data must be uncompressed 3 channels, 8 bit per channel and no padding */
if ( bmiHeader.biSizeImage != abs( bmiHeader.biWidth * bmiHeader.biHeight * 3 ) ||
bmiHeader.biCompression != BI_RGB || bmiHeader.biBitCount != 24 ) {
return VFW_E_TYPE_NOT_ACCEPTED;
}

return S_OK;
}
[/codebox]

You can VFW_E_TYPE_NOT_ACCEPTED if bmiHeader.biWidth or bmiHeader.biHeight is not to your liking. The filter doesn't have to do anything, but you can but it between the camera and the encoder to control image type.

Hi, on the HTC P3600 there is no restriction on developing custom apps. On the other hand every phone has a different implementation of directshow,

resulting in a very unpredictable development process.

Thanks

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.