Closed Rishat7c closed 5 years ago
I can't test that code so I only can recommend you: 1 - Increase bitrate. 2 - Make sure that your decoder is not the problem (If image deteriorate in preview with that code and with decoder only then it is decoder problem).
@pedroSG94,
I think line 625 method is not the problem but you can see my decoder example and find differences: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/encoder/src/main/java/com/pedro/encoder/input/decoder/VideoDecoder.java In line 378 the problem, could be that you are opening camera with low resolution?
@pedroSG94 Our decoders differ only in construction. You have a cyclical construction, but I do not have
Recorded a video. This video is broadcasted from the server in a video player. The video shows how after 10 seconds after the broadcast starts, quality loss begins :-(
@pedroSG94 and problems in lightOpenGlView can not be?
But your preview if working fine or loss quality too? If work lightOpenGlView is not the problem. I saw a similar thing in a device and the reason was an error in the h264 packetizer the problem is that the code is in my job and I'm in holidays a week also I can't confirm you that this will solve it 100%. But you can try do a stream with rtsp that hasnt this bug to confirm it. To do it replace srsflvmuser to rtspclient and the use is really similar. Use this classes to compare: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/rtmp/RtmpCamera1.java https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/rtsp/RtspCamera1.java
@pedroSG94 unfortunately our server does not support RTSP :-(
@pedroSG94 Upd. Are there any solutions to this problem? If you are free of course
Sorry for late response, try with this class: https://pastebin.com/knBzvEb6 Replace your SrsFlvMuxer class with that.
@pedroSG94 Unfortunately, nothing has changed. The image also continues to deteriorate :-(
I haven't more ideas :(
@pedroSG94 Added small changes to the code in MainActivity and partially rolled your libraries into ours and got the following
MainActivity.java ( https://pastebin.com/pVqhfPsv ) Connecting your library takes place on the lines: 194, 349 and 373
This look that your lightopenglview is not inflated yet. You set surfaceholder callback to other surface not to lightopenglview
@pedroSG94 If I understand you correctly, then the problem is in this function ( https://pastebin.com/hpqwtPxs ) but it is no different from the old
line 75 should be your lightopenglview I think
@pedroSG94 The old version differs only in that this connection occurs during a call Proof, previous working version ( https://pastebin.com/7pn1nBSQ )
i am facing the same problem
@Rishat7c I don't know where is the problem in the new code, I don't see anything bad and I can't debug your app because I don't have your camera to test so it is really difficult to debug you app. I only can tell you that your actual problem usually is throw when you try use an invalid surface (normally surface not created or already destroyed in this case or maybe still in use, I think this surface is the surface of openglview that is use in the view of this surfaceview not surface created from opengl).
@rkoshti Are you experiment this issue with my original code or did you modify it? If you modify it same that @Rishat7c, debug an implementation without a code example that can't be executed to emulate the problem is difficult. If not, post me: device model, API and media server to find more info about it.
i am experimenting in your sample code in opengl Rtmp .
Here is my configurations
public boolean prepareVideo() { if (onPreview) { stopPreview(); onPreview = true; } if (openGlViewBase == null) { cameraManager.prepareCamera(); return videoEncoder.prepareVideoEncoder(); } else { int orientation = (context.getResources().getConfiguration().orientation == 1) ? 90 : 0;
return videoEncoder.prepareVideoEncoder(1280, 720, 30, 1500 * 1024, orientation, false, 2,
FormatVideoEncoder.SURFACE);
/*return videoEncoder.prepareVideoEncoder(640, 480, 30, 1200 * 1024, orientation, false, 2,
FormatVideoEncoder.SURFACE);*/
}
}
/**
It works when i use this configurations
*return videoEncoder.prepareVideoEncoder(640, 480, 30, 1200 1024, orientation, false, 2, FormatVideoEncoder.SURFACE);**
But it loose video quality when i modify the resolution
*return videoEncoder.prepareVideoEncoder(1280, 720, 30, 1500 1024, orientation, false, 2, FormatVideoEncoder.SURFACE);**
I am testing in Moto g4 plus (7.1 android version), Tested in multiple devices but result is same.
I use part of the Pedro code, When the broadcast starts, after a while (seconds 5-10) the image starts to deteriorate, pixels appear :-(
I use the following parameters: bitRate - *1200 1024 iFrameInterval - 2 FPS - 30**
The source code of class rRTMP.java [https://pastebin.com/r3CWNXjY] (https://pastebin.com/r3CWNXjY)
in the main class I begin the translation as follows