2

I am trying to implement live video streaming with wowza but i have problem with video quality. I am using rtmp.

When I use this code it works fine

mSession = SessionBuilder.getInstance()
            .setContext(getApplicationContext())
            .setAudioEncoder(SessionBuilder.AUDIO_AAC)
            .setAudioQuality(new AudioQuality(8000, 16000))             
            .setVideoEncoder(SessionBuilder.VIDEO_H264)
            .setSurfaceView(mSurfaceView).setPreviewOrientation(0)
            .setCallback(this).build();

video resolution what I got here is 172 x 144 but when I try to set other resolution etc.

mSession = SessionBuilder.getInstance()
            .setContext(getApplicationContext())
            .setAudioEncoder(SessionBuilder.AUDIO_AAC)
            .setAudioQuality(new AudioQuality(8000, 16000))             
            .setVideoEncoder(SessionBuilder.VIDEO_H264)
            .setVideoQuality(new VideoQuality(320,240,20,500000))
            .setSurfaceView(mSurfaceView).setPreviewOrientation(0)
            .setCallback(this).build();

it's not working on some devices(green screen on web side) etc when I try to shot with Samsung galasy s3.

So how to set quality for all devices or I need to set different quality for different devices?

Thanks.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
Predrag Kecman
  • 123
  • 2
  • 6
  • Yes, when you set **VideoQuality** with explicit width and height, you must check that this size is supported by your device. While **320x240** is a very common video size, there are some popular phone cameras that don't support it. To add insult to injury, some of them (e.g. Galaxy Nexus, also built by Samsung) claim that 320x240 video resolution is supported, when you ask `getSupportedPreviewSizes()`. – Alex Cohn Dec 10 '14 at 13:57
  • When I get resolutions from getSupportedPreviewSizes() and try with some of them it's said that they are not supported, etc 800, 480 – Predrag Kecman Mar 30 '15 at 11:38
  • Too bad. Does 720x480 work for you? – Alex Cohn Mar 30 '15 at 12:21
  • 1
    I need to use getSupportedVideoSizes(), it gives me supported sizes for video, and then works. tnx for everything. – Predrag Kecman Mar 30 '15 at 13:29
  • I could not check on a live S3, but at least some variants of this device [return **null** for `getSupportedVideoSizes()`](http://stackoverflow.com/a/19355229/192373). The approach of [libstreaming](https://github.com/fyhertz/libstreaming) is more robust: they attempt different settings, and store locally which sizes succeed. – Alex Cohn Mar 31 '15 at 07:26
  • 1
    Problem is when I use getSupportedPreviewSizes() I got resolutions that are not supported and when I hit play it said "the following settings are not supported on this phone" and after that when I pick supported resolutions it said getParameters failed(empty parameters). Not sure why after not supported resolutions I can't start supported resolution. – Predrag Kecman Mar 31 '15 at 08:53
  • Ouch this hurts. So you must close camera and reopen it to set another resolution? Or maybe store the parameters you got originally, and not go through `getParameters()` again? – Alex Cohn Mar 31 '15 at 09:01
  • I used example 3 from your link and I got that error https://github.com/fyhertz/libstreaming. And in they example they didn't call getParameters(). And they don't close camera or reopen it. I don't see that in their code. – Predrag Kecman Mar 31 '15 at 09:10
  • No, I did not imply that libstreaming will fix it for you. And the idea to not call `getParameters()` to avoid a crash there was by no means inspired by them. It's a pity they crash; I am not sure what went wrong. I only provided this link because they use the clever idea of adjusting the default values through trial-and-error, but only once, and this painful process must not be repeated at every invocation of the task. – Alex Cohn Mar 31 '15 at 10:56

0 Answers0