fyhertz / libstreaming

A solution for streaming H.264, H.263, AMR, AAC using RTP on Android
Apache License 2.0
3.47k stars 1.07k forks source link

Can not stream with resolution if greater than 320x240 MediaRecorder(12959): start failed: -2147483648 #283

Open Sky-Zheng opened 5 years ago

Sky-Zheng commented 5 years ago

I use libstreaming for a server, and play in vlc, but find it can work at 320x240, but can not work when resolution greater than 320x240,

this is the error info 01-10 14:52:27.258: I/H264Stream(12959): configure mMode:1 mQuality:640x480 px, 20 fps, 500 kbps 01-10 14:52:27.258: D/MP4Config(12959): PPS: aM4BqDXI 01-10 14:52:27.258: D/MP4Config(12959): SPS: Z0LAKY1oCgPaAeEQjUA= 01-10 14:52:27.258: I/MediaStream(12959): start :1 01-10 14:52:27.259: D/VideoStream(12959): Video encoded using the MediaRecorder API 01-10 14:52:27.259: I/MediaStream(12959): createSockets sPipeApi:2 01-10 14:52:27.259: I/MediaStream(12959): createSockets parcelFileDescriptors createPipe version = Lollipop 01-10 14:52:27.441: I/VideoStream(12959): openCamera 01-10 14:52:27.432: W/Thread-7(12959): type=1400 audit(0.0:3191): avc: denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=15573 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:camera_prop:s0 tclass=file permissive=0 01-10 14:52:27.443: E/libc(12959): Access denied finding property "camera.hal1.packagelist" 01-10 14:52:27.516: D/VideoStream(12959): Unlocking camera 01-10 14:52:27.522: I/VideoStream(12959): mMediaRecorder set mVideoEncoder:2 mRequestedQuality.resX:640 mRequestedQuality.resY:480 mRequestedQuality.framerate:20 mRequestedQuality.bitrate:500000 01-10 14:52:27.522: I/VideoStream(12959): encodeWithMediaRecorder sPipeApi:2 01-10 14:52:27.522: I/MediaRecorderJNI(12959): prepare: surface=0xce083800 01-10 14:52:27.691: E/MediaRecorder(12959): start failed: -2147483648 01-10 14:52:27.691: I/VideoStream(12959): encodeWithMediaRecorder error:java.lang.RuntimeException: start failed. 01-10 14:52:27.692: I/Server@MainActivity(12959): RtspServer onError:1 e:net.majorkernelpanic.streaming.exceptions.ConfNotSupportedException: start failed. 01-10 14:52:27.692: E/RtspServer(12959): start failed. 01-10 14:52:27.692: W/System.err(12959): net.majorkernelpanic.streaming.exceptions.ConfNotSupportedException: start failed. 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.video.VideoStream.encodeWithMediaRecorder(VideoStream.java:394) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.MediaStream.start(MediaStream.java:278) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.video.VideoStream.start(VideoStream.java:282) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.video.H264Stream.start(H264Stream.java:96) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.Session.syncStart(Session.java:448) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.rtsp.RtspServer$WorkerThread.processRequest(RtspServer.java:535) 01-10 14:52:27.693: W/System.err(12959): at net.majorkernelpanic.streaming.rtsp.RtspServer$WorkerThread.run(RtspServer.java:411) 01-10 14:52:27.694: D/RtspServer(12959): RTSP/1.0 500 Internal Server Error 01-10 14:52:27.694: D/RtspServer(12959): Server: MajorKernelPanic RTSP Server 01-10 14:52:27.694: D/RtspServer(12959): Cseq: 4 01-10 14:52:27.694: D/RtspServer(12959): Content-Length: 0 01-10 14:52:27.810: I/MediaStream(12959): stop :1 01-10 14:52:27.810: I/VideoStream(12959): startPreview 01-10 14:52:27.814: I/MediaStream(12959): stop :1 01-10 14:52:27.814: I/VideoStream(12959): destroyCamera 01-10 14:52:27.815: D/VideoStream(12959): Locking camera 01-10 14:52:27.815: E/VideoStream(12959): reconnect failed 01-10 14:52:27.817: I/RtspServer(12959): Client disconnected

yitongUp commented 5 years ago

Hi, have you solved this problem?

manu3b1 commented 4 years ago

Got the same issue. In the full log, I can see:

E MPEG4Writer: cannot seek mFd: Illegal seek (29) 7

So, I guess the new MPEG4Writer is no more compliant with pipe FD. See: https://stackoverflow.com/questions/34317655/mediarecorder-start-failed-2147483648

neilyoung commented 3 years ago

I'm sure I'm way to late to the party, but I think the reason for this "no more than 320 x 240" is here

https://github.com/fyhertz/libstreaming/blob/3a78d2219a4cf5bc972cdc59a8f84349fda277c6/src/net/majorkernelpanic/streaming/video/H264Stream.java#L125

I commented out the fallback and was able to stream at higher rates.

princechrix1 commented 3 years ago

Hi my name is Prince am an African, I'm writing to you requesting for help, I'm really interested in Coding and I like it! I have a dream of helping my country and my friends technologically! But I'm really facing hard times which may lead to improper planning of my future due to lack PC (computer) I wanted to request you a computer I assure you that I will work hard in order to show you that you didn't make a mistake of helping.

On Monday, March 1, 2021, neilyoung @.***> wrote:

I'm sure I'm way to late to the party, but I think the reason for this "no more than 320 x 240" is here

https://github.com/fyhertz/libstreaming/blob/ 3a78d2219a4cf5bc972cdc59a8f84349fda277c6/src/net/ majorkernelpanic/streaming/video/H264Stream.java#L125

I commented out the fallback and was able to stream at higher rates.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fyhertz/libstreaming/issues/283#issuecomment-788239175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASDZYIEO53OM3HCAFNWWLALTBPYQ3ANCNFSM4GPKTJSA .