Frequently Asked Questions

Adjusting Image and Video Quality / Latency for Mobile Streaming

 
QUESTION:

How do I adjust the quality of the video?  If I’m using a 3G or 4G mobile network with iOS and Android, what are the best settings to use?

I’m concerned that it may disconnect.  Is there a way to resume streaming if this happens?

What if I need low-latency?

 

ANSWER: 

Manually Setting the Bitrate and Resolution:

Please experiment with different settings to see what work best. 

iOS:

Resolution (in tests.plist):
<key>GlobalProperties</key>  
    <dict>
        <key>camera_width</key>
        <integer>640</integer>
        <key>camera_height</key>
        <integer>360</integer>
        <true/>
    </dict>

Note: The iOS camera is configured to use pre-set ratios so the camera will give you the closest resolution to what you have requested. The exact resolutions are as follows:

  • 352×288
  • 640X480
  • 1280×720
  • 1920×1080
 
Bandwidth (in tests.plist):
<key>GlobalProperties</key>  
    <dict>
        <key>bitrate</key>
    <integer>750</integer>
    </dict> 

 

Android:

Resolution (in test.xml):
<Testbed>  
    <Properties>
        <camera_width>640</camera_width>
        <camera_height>360</camera_height>
    </Properties>
    <Tests>

Note: As mentioned above in the note for iOS, the camera might use pre-set ratios. However, Android devices have a little more variety with their hardware so there may be different results between models.

Bitrate (in test.xml):
<Testbed>  
    <Properties>
        <bitrate>750</bitrate>
    </Properties>
    <Tests>We'd recommend trying to set the max bitrate to 400kbps - it goes in increments of 200kbs. Ramp it up and down during your testing to see what works best for you. You could ramp that kbps up to 800kbps if you wanted but your 3g customers might have issues with the stream.

For more on recommended resolution and bitrate settings, please refer to this FAQ.

Please note: mobile devices may not be able to handle a high bitrate and resolution as they do not have the processing power of larger machines.

For 4G and 3G: We’d recommend trying to set the max bitrate to 400kbps (426 x 240 resolution)- it goes in increments of 200kbs. Ramp it up and down during your testing to see what works best for you. You could ramp that kbps up to 800kbps if you wanted but your 3g customers might have issues with the stream. 

 

Low Latency:

The Red5 Pro server was built around providing the lowest latency possible. Please take a look at the buffer_time setting in iOS, or Android. The lower the number the lower the latency.  However, if the buffer is too low, it can affect the smoothness of a stream, especially for VOD applications.

 

Adaptive Bitrate for the Publisher:

For the mobile bitrate, we’d recommend using our adaptive bitrate feature. It’s sort of a balancing act because if you have users on 3g and the bitrate is set too high it could impact the stream for them.

Please note that you can only set the bitrate (or implement adaptive bitrate) in the publisher, not the subscriber.

 

Use Auto-Reconnect:

After a certain threshold, the server automatically disconnects the stream.  If you put a reconnect timer on the publisher of 4-5 seconds that should give it enough time to clean up the stream.  As long as the publisher is still broadcasting, the subscriber will automatically resubscribe to the stream.

To enable Auto-reconnect, please see our examples for Android and iOS.

 

For more information on balancing quality and latency, please see our blog post.