windows-phone-8streamvideo-recordingfront-camera

How to record video using AudioVideoCptureDevice in WP8


Here its stated that I can record video using AudioVideoCaptureDevice but there is no sample or help provided.

I need to do the following things:
- record the video into a stream DONE
- display a thumbnail of video recorded (can be a frame captured while video recording) DONE
- replay the video recorded DONE
- change resolution and type of camera (front/back) DONE

How to achieve this? Are there any samples? I am unable to find them. Please help me.

DONE
- record the video into a stream
- replay the video recorded
- change resolution and type of camera (front/back)
- display a thumbnail of video recorded (can be a frame captured while video recording)

NEW PROBLEMS
- front camera video is mirror inverted. I am able to change this while recording using transform but the actual video is still mirrored.

UPDATE
- calculate the size of the recording video and display it. Its not working. Stream.Size is giving random values.

Any thoughts on solving these?


Solution

  • For the problem of Displaying a Thumbnail of the video recording...there is an event called PreviewFrameAvailable on the AudioVideoCaptureDevice. I think if you setup this event handler it will tell you when the data is available to get a preview (image/thumbnail) of the video.

    There are also 3 methods for grabbing a byte array of a preview image (GetPreviewBufferARGB, GetPreviewBufferY, GetPreviewBufferYCbCr). All three of these methods return a byte[] of the pixel data for the image in the corresponding format (ex: GetPreviewBufferARGB should return the raw bytes of a raw bitmap in ARGB format). After getting the byte array of the preview data you should be able to encode it as a PNG or JPEG or whatever compressed image format you prefer. Best of luck.