hi,
I am trying stream video from android to network and receiving it on a
server that I had written in java.
I am capturing YUV data on onPreviewFrame method on Camera convert
with yuv in jpeg and sending it to the server where I convert this
data to image and displaying it.
Everything works fine but the problem is that there is a lot much
delay and size of images in the streaming process as I am sending the
data directly. Is there some way of encoding this YUV data to h263 or
h264 format so that I can minimize the delay and the size of images?
Also MediaRecorder have ability to record the video in the available
standard video format but it stores the video to a file on sdcard. Is
there any way of getting a stream from that video which is being
recorded so that I can stream it to the network? This will reduce my
efforts in conversion process.
here is my code for conversion.
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters parameters = camera.getParameters();
int format = parameters.getPreviewFormat();
//YUV formats require more conversion
if (format == ImageFormat.NV21 /*|| format ==
ImageFormat.YUY2 || format == ImageFormat.NV16*/)
{
int w = parameters.getPreviewSize().width;
int h = parameters.getPreviewSize().height;
// Get the YuV image
YuvImage yuv_image = new YuvImage(data, format, w, h,
null);
// Convert YuV to Jpeg
Rect rect = new Rect(0, 0, w, h);
ByteArrayOutputStream output_stream = new
ByteArrayOutputStream();
yuv_image.compressToJpeg(rect, 100, output_stream);
byte[] byt=output_stream.toByteArray();
and send these bytes to network. how to reduce the size of images in
KB and also delay?
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en