• Announcements

    • Reminder - MoDaCo position on illegal content   07/30/15

      ILLEGAL CONTENT I'd like to just reaffirm MoDaCo's position regarding piracy and illegal content in the light of some recent questions / postings. Posts will be censored by myself or my moderation team if the contain or link to: Illegal / pirated / cracked software or sites that host such softwareNintendo emulators / ROMs or sites hosting them (in light of Nintendo's legal stance)CUSTOM ROMS You may discuss and post links to custom device ROMs on MoDaCo, provided the following rules are adhered to: ROMs must not contain any illegal 3rd party software (this includes trial versions included without permission)ROMs must give full credit to the original authorISSUES If you have any issues with this policy, please contact PaulOBrien directly via PM.
    • Reminder: Selling items on the forum directly is not allowed   07/30/15

      Please note that selling items on the forum directly is not allowed by the forum rules. There is a forum for eBay auctions whereby you can list the items on eBay and link to them there. This is the ONLY forum for this type of activity. You may also advertise links to the eBay forum in your signature. Please note that selling directly in contravention of these rules will result in a warning / suspension / ban.
Sign in to follow this  
Followers 0

HTC Tornado Camera programming (directshow)

7 posts in this topic

Posted

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

0

Share this post


Link to post
Share on other sites

Posted

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

0

Share this post


Link to post
Share on other sites

Posted

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

0

Share this post


Link to post
Share on other sites

Posted

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

0

Share this post


Link to post
Share on other sites

Posted

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

0

Share this post


Link to post
Share on other sites

Posted

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.

0

Share this post


Link to post
Share on other sites

Posted

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

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2015. MoDaCo uses IntelliTxt technology.