Questions tagged [mediamuxer]

Android class : "MediaMuxer facilitates muxing elementary streams."

Android class : "MediaMuxer facilitates muxing elementary streams." https://developer.android.com/reference/android/media/MediaMuxer

172 questions
3
votes
1 answer

How to fix corrupted video (green frames) after muxing using MediaMuxer and MediaCodec

I am trying to encode an mp4 video from an array of NalUnits where each unit is a frame represented by byte[] that is saved from an rtp packet from an rtsp stream. I am encoding 451 frames at a 30fps where the first frame data is the spp and pps…
Charles Semaan
  • 304
  • 2
  • 13
3
votes
1 answer

Android Camera2 + MediaCodec + MediaMuxer using persistent surface?

I'm writing a video camera app. When I open my capture activity I would like to configure a camera capture session that starts a preview, and when the user later presses the record button it should start recording video using MediaCodec + MediaMuxer…
3
votes
1 answer

How to repair Corrupted Mp4 file generated by MediaMuxer?

I used MediaMuxer and MediaCodec to generate a mp4 video. The video is playble after I call mMediaMuxer.stop() However, when the user quit the app before I get the change to call the stop() method, I am left with a big mp4 file that is not…
TSR
  • 17,242
  • 27
  • 93
  • 197
3
votes
0 answers

Using AudioPlaybackCapture API in MediaRecorder

I use media recorder to record the screen and I'm wondering if I could use the AudioPlaybackCapture API to stream the system audio in? I know mediarecorder is a high level API and MediaMuxer would give me more controls but the app already uses a lot…
Vijai
  • 1,067
  • 2
  • 11
  • 25
3
votes
3 answers

Why the "MediaCodec CodecException" in "queueInputBuffer" only happen on Android API 29?

Basic Info targetSdkVersion 28 Goal: The objective of the class is to resize a video before sending to my server. Problem: The app crashes only on API 29, whether with real devices or using AVD. For example, the code works fine on Pixel 2 API 28,…
3
votes
1 answer

Android Media Muxer Not Working [Android/Java]

Media Muxer Media Muxer Not Working In Lolipop Testing on Android Emulator Api 22 (Lolipop) here is my code for muxing audio and video file public void muxer(File videoFile, File audioFile, long dowloadId) { String outputFile = ""; String…
Ashvin solanki
  • 4,802
  • 3
  • 25
  • 65
3
votes
0 answers

Add watermark to encoded video in grafiak

I have created a sample using grafika code where I am creating the video from camera feeds. In grafika sample there is a method to drawExtra while passing data to muxer which add dots in vidoe. I want to add water mark in place of this at left…
3
votes
1 answer

Which AVC profile/level will be set in Android MediaCodec if we don't set this value manually?

In Android ACodec.cpp setupAVCEncoderParameters, it reads profile and level from msg(msg->findInt32("profile", &profile)/msg->findInt32("level", &level)), the msg appears to be coming from format in MediaCodec.configure(). So, I think we can set…
mewo1234
  • 311
  • 3
  • 10
3
votes
1 answer

Android merging mp4 and aac file using mediamuxer mediacodec and mediaextractor (without mp4parser)

I am recording an audio, then trying to merge aac audio and mp4 video file(muted, without audio), and share the merged mp4 file. The sharing of merged mp4 file works in Samsung J2 and Xiaomi, but the mp4 file doesnot play in Lenovo, Micromax and…
3
votes
1 answer

Android Mediamuxer moov atom

I am recording device screen using Mediacodec and Mediamuxer api everything is fine. Now I want to stream this file while recording, but cant until muxer is stopped and moov atom is written at the end of file. So my question is it even possible…
ingsaurabh
  • 15,249
  • 7
  • 52
  • 81
3
votes
1 answer

Add second audio track to MediaMuxer

I have a video file .mp4 - video track only. I'm using MediaExtractor and MediaMuxer to add audio file. this Works good. On the processed file i want to add another audio track. So i'm using again MediaExtractor and MediaMuxer to kind of copy the…
Raziza O
  • 1,560
  • 1
  • 17
  • 37
3
votes
1 answer

android - setting presentation time of mediacodec

I used bellow code to encode raw data to h264 in order to create video and it's encoded very well but video is playing too fast. It seems that there is a problem with presentation time. when record starts I set the value of "tstart" and for each…
Sajad Norouzi
  • 1,790
  • 2
  • 17
  • 26
3
votes
0 answers

MediaMuxer and MediaExtractor to extract video from mp4

I try to extract video from mp4 and mix with others audios,here is the video part: MediaFormat videoFormat = null; MediaMuxer mp4Muxer = createMediaMuxer(); MediaExtractor mp4Extractor = createMediaExtractor(); for (int i = 0; i <…
Darcy
  • 61
  • 4
3
votes
2 answers

Extract Audio from Mp4 and Save to Sd Card (MediaExtractor)

I have a mp4 video file in my sd card. I would like to extract the audio from the video and then save the extracted audio as a separate file on the sd card using MediaExtractor Api. Here is the code I've tried: MediaExtractor extractor = new…
3
votes
1 answer

sync audio and video with mediacodec and mediamuxer

Hi in How to provide both audio data and video data to MediaMux it says that in order to sync audio and video you have to "calculate the number of audio samples that should play for each frame of video", how would be the formula? could you give me…
1 2
3
11 12