Welcome, Guest
  • Author Topic: Setting bitrate in FMS/RED5  (Read 9007 times)

    Amir Bilal

    • Server what's that
    • *
    • Posts: 38
    • ABC at Work
      • View Profile
      • Vision to Reality
      • Email
    Setting bitrate in FMS/RED5
    « on: 03/06/08, 05:26 »
    Hi,


    I need to know a bit about recording streams using FMS/RED5.

    Whether we can have variable bit rate in FMS/RED5. E.g., the recording/streaming will be done at 128kpbs or 256kbps?

    Is there any way to set this in the server side code so that all the recordings being done are on the specified bit rate.

    You help would be much appriciated..

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Setting bitrate in FMS/RED5
    « Reply #1 on: 03/06/08, 20:03 »
    There are not settings to save the file with a specific bitrate .... because you're using a streaming server, not serving FLV trough HTTP (progressive downlod)
    So the streaming server can vary bitrate based on connection bandwidth ... anyway uploading videos saved at a specific bitrate allow you to change version served based on bandwidth metrics with much more quality

    Jorge

    nesimtunc

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    Re: Setting bitrate in FMS/RED5
    « Reply #2 on: 07/31/09, 01:28 »
    Hey,

    Your comment makes sense. It will be very nice that is based on client's bandwidth. But there must be some settings on client side something like "profile" when you broadcasting to a server.

    For example,

    I'm using 4 Mbps internet connection and it's not good qualilty at watching videos via FSM/Red5.


    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Setting bitrate in FMS/RED5
    « Reply #3 on: 07/31/09, 06:04 »
    I recall Red5 comes with some example for measuring client BW

    Jorge

    nesimtunc

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    Re: Setting bitrate in FMS/RED5
    « Reply #4 on: 07/31/09, 08:16 »
    I also tried this :

    package com.milgra;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;

    import org.red5.server.adapter.ApplicationAdapter;
    import org.red5.server.api.IBandwidthConfigure;
    import org.red5.server.api.IConnection;
    import org.red5.server.api.IScope;
    import org.red5.server.api.stream.IServerStream;
    import org.red5.server.api.stream.IStreamCapableConnection;
    import org.red5.server.api.stream.support.SimpleConnectionBWConfig;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;


    public class Application extends ApplicationAdapter{

       
       private IScope appScope;

       private IServerStream serverStream;

       /** {@inheritDoc} */
        @Override
       public boolean appStart(IScope app) {
          appScope = app;
          return true;
       }
       

       /** {@inheritDoc} */
       @Override
       public boolean appConnect(IConnection conn, Object[] params)
       {
          WriteLog("Red5First.appConnect " + conn.getClient().getId());
          
          measureBandwidth(conn);
          
          if (conn instanceof IStreamCapableConnection){
             IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
             SimpleConnectionBWConfig bwConfig = new  SimpleConnectionBWConfig();
             bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] = 1024 * 1024;
             bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] = 128 * 1024;
             bwConfig.setUpstreamBandwidth(4096);
             
             streamConn.setBandwidthConfigure(bwConfig);
             
             WriteLog("ayarlar setlendi");
          }
          return super.appConnect(conn, params);
       }
       
       /** {@inheritDoc} */
        @Override
       public void appDisconnect(IConnection conn) {
          if (appScope == conn.getScope() && serverStream != null) {
             serverStream.close();
          }
          super.appDisconnect(conn);
       }
       
       private void WriteLog(String msg)
       {
        try {
           String fileName = "C:\\out.txt";
               BufferedWriter out = new BufferedWriter(new FileWriter(fileName, true));
               out.write(msg);
               out.close();
           } catch (IOException e) {
           }
       }
    }



    I changed the value for a few times but no result. And why doesn't log anything...