Giter VIP home page Giter VIP logo

audiovideorecordingsample's People

Contributors

saki4510t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

audiovideorecordingsample's Issues

Recording in square shape

Is there a way to record a video in square shape using openGL, without distorting the image? Please help! Thank you!

Recording Audio Video data separately

Hi, I am trying to use the library to record audio and video streams into separate files and merge them afterwards. I have tried using to MediaMuxerWrapper for each encoder. However, in some devices there is a synchronization problem between the audio and video which, I think, is caused by frame drops in case of Video encoder. Can anyone hep me with the problem?

Thanks.

java.util.concurrent.TimeoutException: android.media.MediaMuxer.finalize() timed out after 10 seconds

stopRecording error:

java.util.concurrent.TimeoutException: android.media.MediaMuxer.finalize() timed out after 10 seconds
at android.media.MediaMuxer.nativeRelease(Native Method)
at android.media.MediaMuxer.finalize(MediaMuxer.java:240)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170)
at java.lang.Thread.run(Thread.java:841)

Adapt the encoding package to screen record

Hi there

Your code its the first one i found which seems to working flawlessly while recording audio and video with MediaCodec, but i tried to convert the MediaVideoEncoder to capture screen and for that i used small bits of code from https://github.com/yrom/ScreenRecorder but when i try to record it will only record for a second and then stops no matter i long i leave it recording.

What i did was strip the RenderHandler from the MediaVideoEncoder since it doesnt seem i need it and pass MediaProjection object to the MediaVideoEncoder constructor and then i just add this to the end of MediaVideoEncoder prepare method:

mVirtualDisplay = mMediaProjection.createVirtualDisplay(TAG + "-display",
mWidth, mHeight, mDpi, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC,
mSurface, null, null);

From what i understand the mSurface receives input from display after this method, it works and i capture the screen for just a 1 second then it stops any idea what i might be missing?

Thank you for your time

Fatal Exception: java.lang.IllegalStateException

Fatal Exception: java.lang.IllegalStateException
at android.media.MediaCodec.getFormatNative(MediaCodec.java)
at android.media.MediaCodec.getOutputFormat(MediaCodec.java:2515)
at com.BattleAppLLC.BattleApp.view.squarevideo.encoder.MediaEncoder.drain(MediaEncoder.java:303)
at com.BattleAppLLC.BattleApp.view.squarevideo.encoder.MediaEncoder.run(MediaEncoder.java:129)
at java.lang.Thread.run(Thread.java:818)

screen shot 2017-01-19 at 3 52 49 pm

I want to add PreviewCallback

hello saki, thanks for your passion.
I have a question.
I want to add PreviewCallback in CameraGLView.

The following is what I have tried :

in CameraGLView.java
screen shot 2015-07-21 at 12 59 37 pm

Callback is working well.
But if i try to record, happened crash with this message.

07-21 13:02:23.193 19753-19764/com.serenegiant.mediaaudiotest E/AndroidRuntime﹕ FATAL EXCEPTION: FinalizerWatchdogDaemon
Process: com.serenegiant.mediaaudiotest, PID: 19753
java.util.concurrent.TimeoutException: android.media.MediaMuxer.finalize() timed out after 10 seconds
at android.media.MediaMuxer.nativeRelease(Native Method)
at android.media.MediaMuxer.finalize(MediaMuxer.java:240)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170)
at java.lang.Thread.run(Thread.java:841)

can you help me?
sorry for my bad english, thank you.

Supported MIME Types for Video Encoder

I want to use h264 Mime type for Video Encoder, I tried using video/h264 but it resulted into an error.
Adding the list of string supported in value of MIME_TYPE would be very helpful.

Camera is very Dark and sometimes bink white and normal

Hello, Thanks for making Camera Implementation easy. I am using this but on some devices, camera preview is very dark and sometimes blink and become white-normal(While Recording as well).
Devices I have used
Moto G4 Plus, Moto G2, Samsung Galaxy - Working Fine
Mi A1 and Mi Note 4 - Problem of Dark view and blinking.

How can I change the video width and height.

I want to change the video width and height.The default out put of video file is 720x1280. I want to change it to 1280x720.But If I change the width and height in below line of code it stretches the video.
MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, 1280, 720);

setVideoSize() in CameraGLView Class call twice first time width=1280 and height=720 and second time width=720 and height=1280.

How can I switch the camera?

How can I switch the camera from front to back and back to front with this code?
I have used lot of code to switch camera but always I am getting crash with, when I change the camera id at runtime.

The information of the recorded video is not correct .

when i recorded a video , i opened it in my computer with MediaInfo but the number of information is unknown ,just with these information,and it cant player,but in the phone:

Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (isom/mp42)
File size : 1.02 MiB
IsTruncated : Yes

I want to know how to deal with it ?
thanks!

Audio is unsync recording in high resolution in slow devices

I'm using a Samsung Galaxy tab A 8" 2019.
I set resolution to 1600x900 and seems that the first video frames of the recording are like in slow motion. I have even see if async encoder could fix it, but no it seems it has something related with how OpenGL renders it. Is there anyway to fix this?

Here there is a interesting discussion about this issue. https://stackoverflow.com/questions/39171949/android-mediacodec-eglswapbuffer-blocking-gpu-in-asynchronous-mode

Thanks!

pause the recording

Hi,First, thank you for your share.How should I do if I want to pause the recording.

Font textures disappear, caused by glDeleteTextures on main thread

Hello Saki!
Thanks for the excellent library!
However on the One Plus One phone i discovered that the font textures in the app disappear after pause/resume (changing app).
Like this

I think the problem is that glDeleteTextures is called in the main thread.
CameraSurfaceRenderer.onSurfaceDestroyed is called in the main thread.

Changing its code solves the problem:
This way it is good:

	public void onSurfaceDestroyed() {
		if (DEBUG) Log.v(TAG, "onSurfaceDestroyed:");

		GLSurfaceView parent = mWeakParent.get();
		parent.queueEvent(new Runnable() {
			@Override
			public void run() {
				if (mDrawer != null) {
					mDrawer.release();
					mDrawer = null;
				}

				if (mSTexture != null) {
					mSTexture.release();
					mSTexture = null;
				}

				GLDrawer2D.deleteTex(hTex);
			}
		});
	}

The error no longer happens however i am not sure that this is the best solution.
I would appriciate your kind help.

Best regards
Tamás

Video Preview fullscreen in landscape stretched

Hi saki,
Thanks for your last response.
I am looking to make video preview fullscreen in landscape.
Then I set aspect ratio

        mCameraView.setAspectRatio(display.getmWidth()/ display.getmHeight());

It takes only half of screen.
But then I removed setAspectRatio, camera preview is stretched.
Thanks in advice.

I am getting a lag in few phone

I am using your code to record video. It is working fine of few phone. But i am getting lag in few phones like lenovo k8 plus/ pixel 2

Modified code to switch camera, but when using back camera saved video is flipped

Hi Saki

I've been playing around with your project and I must say it's impressive. Since I'm using Xamarin I've 'translated' your code to C#, but all is working fine now. Muxing video and audio is working nicely on my test device.

So I've added some code to be able to switch the camera (front/back) and it's working. I stop the preview in the CameraHandler and restart it afterwards.

When playing a movie recorded by the back camera, the image is flipped. This is not the case with a front camera recording (preview = recorded orientation)

Any ideas are welcome !

Thanks
Benoit

Crop frame before encoding it

Hi Saki,

First, thank you for your share. I would like to know if there is a way to crop/manipulate each frame before encoding it.

Output video blemished

I am currently trying to get your code to work in my app.
However it seems like your code has some errors and does not output the videos the way they should be. The video is kind of skipping frames and cut apart and therefor useless because it is hardly blemished. Did you experience this behavior as well?

java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)

When doing a recording on the Samsung S4 with OS5.0.1. I got this crash log

11-18 07:53:25.045 18723-20104/com.serenegiant.audiovideosample E/ACodec: signalError(omxError 0x80001009, internalError -2147483648)
11-18 07:53:25.055 18723-20103/com.serenegiant.audiovideosample E/MediaCodec: Codec reported err 0x80001009, actionCode 0, while in state 6
11-18 07:53:25.055 18723-20093/com.serenegiant.audiovideosample E/AndroidRuntime: FATAL EXCEPTION: MediaVideoEncoder
java.lang.IllegalStateException
at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1033)
at com.serenegiant.audiovideosample.encoder.MediaEncoder.drain(MediaEncoder.java:301)
at com.serenegiant.audiovideosample.encoder.MediaEncoder.run(MediaEncoder.java:155)
at java.lang.Thread.run(Thread.java:818)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.