Open yxnyxnyxnyxn opened 8 years ago
The quality of the video is a product of its resolution and bitrate. At 176x144 there are 25k pixels, at 640 x 480 there are 300k pixels, or 12x as many. The bitrate is approximately how many bits the encoder has, per second, to encode the change in picture from frame to frame. So when the camera is static or the scene is nearly unchanging, like just someone's face moving, the encoder can use the bits to encode just the change in picture, which is small. When moving the entire camera around the room quickly then the entire picture is changing, and there will be more changes to encode, but only the same amount of bits to do so. When the picture is static, the encoder can refer to past frames as reference points, so it doesn't have to retransmit the entire picture, and can rely on the previous frames for the data of current pixels if they haven't changed. When the picture moves rapidly then all the pixels change, and it can't rely on past frames, so it has to send all the pixels again, but first at a lower quality, to make sure all the info about the picture can fit into the allotted bits.
There is a tradeoff between resolution and bitrate. Netflix has done some experiments, and you'll basically want to double the bitrate for 640x480. Be aware, there is a bug in this server's RTP Socket, so if you are on a bad connection and have a high bitrate, your phone might freeze.
http://techblog.netflix.com/2015/12/per-title-encode-optimization.html
Thank you very much for the answer, it's very helpful for me. As you suggest, I have tried the bitrate with following options: 1.VideoQuality(640,480,30,6000000); 1000000 = 500000 * 2, the quality seems unclear too 2.VideoQuality(640,480,30,6000000); 6000000 = 500000 * 12, the quality seems good, but there is a big delay on client, about 6sec. And the delay increase as the play time increase, I doubt there are to much buffer in the client or server. There are alse many packets missed in this configuration.
Best regards, John
Perhaps a middle solution is called for. http://developer.android.com/guide/appendix/media-formats.html at the bottom lists the formats guaranteed to be supported on devices. For h264, the standard quality is 480x360 @500kbps Try 480x360 at 1000kbps. I wouldn't go above 1500kbps though, I've found that will cause lag on even good devices, regardless of network quality.
It might just be your device's camera too. Some old devices tend to blur with movement no matter the settings. Spitballing, if your camera is struggling to focus, maybe that could be a problem?
If the picture is only unclear when the entire camera is moving, hopefully that won't happen too often.
Thank you very much for your quick response. I didn't see the encoder information for h264, is it hard-coded or soft-coded by default? Could I switch the hard/soft codec method in the code?
Best regards, John
I didn't mean to confuse you. You're probably already using h264. Looking at example 3, in session builder it's the line setVideoEncoder( SessionBuilder.VIDEO_H264)
On Thu, Mar 10, 2016 at 9:53 PM, yxnyxnyxnyxn notifications@github.com wrote:
Thank you very much for your quick response. I didn't see the encoder information for h264, is it hard-coded or soft-coded by default? Could I switch the hard/soft codec method in the code?
Best regards, John
— Reply to this email directly or view it on GitHub https://github.com/fyhertz/libstreaming/issues/181#issuecomment-195207633 .
Yes, it is. Now I'm using h264. But I'm not sure which encoder(hardcode or softcode) of h264 I used. I didn't see that by "adb logcat" on the server side. Is there any switch betwwen hardcode and softcode? And how to check which mode(hardcode or softcode of H264) I am using?
I'm sorry always trouble you.
Best regards, John
Don't worry about it. I don't think it's possible to use a "software encoder" for video. At least, there's none packaged with android or this library. All the encoders for h264 are hardware accelerated. Sometimes there are multiple ones though, based on the hardware. So you may see a google encoder listed, and also a qualcomm encoder, etc. The encoder debugger class tries to go through them and see which are producing valid output, so that is the place to look if you're curious, but I don't think that will help your situation.
Got it, I will try the combinations of resolution and bitrate to find a best way. thanks for your patient explanation again.
Best regards, John
Hi, I met another problem when debugging libstreaming Example1, following is the step: 1.server: launch libstreaming server(example1) 2.client: connect server with ffplay 3.server: press button "home", server display gui is hidden After doing that, Connection of client is closed, and I have to display the server gui and then create a new session from client, could I keep the connection when hidding server GUI?
Thank you very much
Best regards, John
Hi,
I have launched the server with Nexu5 and use ffplay&Vlc as client to connect it, it connects successfully. I modified configuration like this: VideoQuality(176,144,20,500000) -> VideoQuality(640,480,30,500000)
Thank you very much.
Best regards. John