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 9079453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:50:25+00:00 2026-06-16T19:50:25+00:00

I would like to record user interaction in a video that people can then

  • 0

I would like to record user interaction in a video that people can then upload to their social media sites.

For example, the Talking Tom Cat android app has a little camcorder icon. The user can press the camcorder icon, then interact with the app, press the icon to stop the recording and then the video is processed/converted ready for upload.

I think I can use setDrawingCacheEnabled(true) to save images but don’t know how to add audio or make a video.

Update: After further reading I think I will need to use the NDK and ffmpeg. I prefer not to do this, but, if there are no other options, does anyone know how to do this?

Does anyone know how to do this in Android?

Relevant links…

Android Screen capturing or make video from images

how to record screen video as like Talking Tomcat application does in iphone?

  • 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-06-16T19:50:26+00:00Added an answer on June 16, 2026 at 7:50 pm

    Use the MediaCodec API with CONFIGURE_FLAG_ENCODE to set it up as an encoder. No ffmpeg required 🙂

    You’ve already found how to grab the screen in the other question you linked to, now you just need to feed each captured frame to MediaCodec, setting the appropriate format flags, timestamp, etc.

    EDIT: Sample code for this was hard to find, but here it is, hat tip to Martin Storsjö. Quick API walkthrough:

    MediaFormat inputFormat = MediaFormat.createVideoFormat("video/avc", width, height);
    inputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
    inputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
    inputFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
    inputFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 75);
    inputFormat.setInteger("stride", stride);
    inputFormat.setInteger("slice-height", sliceHeight);
    
    encoder = MediaCodec.createByCodecName("OMX.TI.DUCATI1.VIDEO.H264E"); // need to find name in media codec list, it is chipset-specific
    
    encoder.configure(inputFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
    encoder.start();
    encoderInputBuffers = encoder.getInputBuffers();
    encoderOutputBuffers = encoder.getOutputBuffers();
    
    byte[] inputFrame = new byte[frameSize];
    
    while ( ... have data ... ) {
        int inputBufIndex = encoder.dequeueInputBuffer(timeout);
    
        if (inputBufIndex >= 0) {
            ByteBuffer inputBuf = encoderInputBuffers[inputBufIndex];
            inputBuf.clear();
    
            // HERE: fill in input frame in correct color format, taking strides into account
            // This is an example for I420
            for (int i = 0; i < width; i++) {
                for (int j = 0; j < height; j++) {
                    inputFrame[ i * stride + j ] = ...; // Y[i][j]
                    inputFrame[ i * stride/2 + j/2 + stride * sliceHeight ] = ...; // U[i][j]
                    inputFrame[ i * stride/2 + j/2 + stride * sliceHeight * 5/4 ] = ...; // V[i][j]
                }
            }
    
            inputBuf.put(inputFrame);
    
            encoder.queueInputBuffer(
                inputBufIndex,
                0 /* offset */,
                sampleSize,
                presentationTimeUs,
                0);
        }
    
        int outputBufIndex = encoder.dequeueOutputBuffer(info, timeout);
    
        if (outputBufIndex >= 0) {
            ByteBuffer outputBuf = encoderOutputBuffers[outputBufIndex];
    
            // HERE: read get the encoded data
    
            encoder.releaseOutputBuffer(
                outputBufIndex, 
                false);
        }
        else {
            // Handle change of buffers, format, etc
        }
    }
    

    There are also some open issues.

    EDIT: You’d feed the data in as a byte buffer in one of the supported pixel formats, for example I420 or NV12. There is unfortunately no perfect way of determining which formats would work on a particular device; however it is typical for the same formats you can get from the camera to work with the encoder.

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

Sidebar

Related Questions

I would like to know how I can record a video in MATLAB with
I have an automation system and I would like to record user logins and
I would like to know how do I declare a record, that has some
I would like to create a list of records. I can add one record
I have found the way to copy the record that I would like, but
I would like to know if there's a good ORM that can automate some
I would like to show a countdown when the user hits the record button
I would like to record every time a registered user clicks a link and
I would like a way to determine if a User record is new or
I would like to record audio to know the noise level. I do not

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.