Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6184395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:31:47+00:00 2026-05-24T01:31:47+00:00

I need help regarding rendering of Bitmaps and displaying them as a video in

  • 0

I need help regarding rendering of Bitmaps and displaying them as a video in Android. Does someone know how to do it?

I am also attaching the code with this for your understanding..

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.os.Bundle;

public class Read extends Activity {
    /** Called when the activity is first created. */

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        File file = new File("C:/Users/amrit.pati/Desktop/downloads/H324mVideoEncInput.yuv");

       try {

            onPreviewFrame(getBytesFromFile(file));

        } catch (IOException e) {

            e.printStackTrace();
        }


    }

    public static byte[] getBytesFromFile(File file) throws IOException {

        InputStream is = new FileInputStream(file);

        long length = file.length();

        if (length > Integer.MAX_VALUE) {

        }

        byte[] bytes = new byte[(int)length];

        int offset = 0;

        int numRead = 0;

        while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {

            offset += numRead;
        }

        if (offset < bytes.length) {

            throw new IOException("Could not completely read file "+file.getName());
        }

        is.close();

        return bytes;
    }


    public void onPreviewFrame(byte[] data) {

          int width = 480;

          int height = 360;

          final int[] rgb = decodeYUV420SP(data, width, height);

          Bitmap bmp = Bitmap.createBitmap(rgb, width, height,Bitmap.Config.ARGB_8888);

    }

    public int[] decodeYUV420SP( byte[] yuv420sp, int width, int height) {   

        final int frameSize = width * height;   

        int rgb[]=new int[width*height];

        for (int j = 0, yp = 0; j < height; j++) {  

            int uvp = frameSize + (j >> 1) * width, u = 0, v = 0;

            for (int i = 0; i < width; i++, yp++) {

                int y = (0xff & ((int) yuv420sp[yp])) - 16;

                if (y < 0) y = 0;

                if ((i & 1) == 0) {

                    v = (0xff & yuv420sp[uvp++]) - 128;

                    u = (0xff & yuv420sp[uvp++]) - 128;   
                }   

                int y1192 = 1192 * y;

                int r = (y1192 + 1634 * v);

                int g = (y1192 - 833 * v - 400 * u);

                int b = (y1192 + 2066 * u);   

                if (r < 0) r = 0; else if (r > 262143) r = 262143;

                if (g < 0) g = 0; else if (g > 262143) g = 262143;

                if (b < 0) b = 0; else if (b > 262143) b = 262143;   

                rgb[yp] = 0xff000000 | ((r << 6) & 0xff0000) | ((g >> 2) & 0xff00) | ((b >> 10) & 0xff);   


            }

        }

        return rgb;   
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:31:48+00:00Added an answer on May 24, 2026 at 1:31 am

    Take a look at this question about using ffmpeg with android.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need ur help regarding web services in classic asp here is my code
I need a help regarding an issue in android... I have an application with
I need a little bit help regarding to android socket programming. I had made
I need help regarding DDA algorithm , i'm confused by the tutorial which i
I need some help regarding algorithm for randomness. So Problem is. There are 50
I need some help regarding the arrays in Perl This is the constructor I
I need help with a problem regarding data saved in a parent-children model table
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need little help regarding sharepoint solution set up in sharepoint. I created wspbuilder
I am a newbie in NSIS. I need some help regarding the MUI Components

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.