Skip to main content
April 28, 2011
Answered

Can't get good quality audio/video.

  • April 28, 2011
  • 2 replies
  • 2945 views

I'm creating a video chat application, and no matter what combination of Camera/Microphone/NetStream properties and functions I use, I cannot get high quality video/audio. I get occasional audio latency, pixelated video, occasional frozen video and the degree of each depends on the combination of properties/functions I set/call.

Others such as TokBox, TinyChat, Chat Roulette, etc. have achieved great video/audio quality with FMS, what is the secret? At least point me in the right direction, because right now I'm not impressed with FMS ability to provide a good video/audio experience.

BTW, I'm using a P2P mesh using a group specifier, not NetStream.DIRECT_CONNECTIONS.

Thanks in advance!

    This topic has been closed for replies.
    Correct answer Nikhil_Kalyan

    We connect to FMS using NetConnection:

    netConnection.connect(server, userID);

    where the server is something like this:

    rtmfp://OUR_IP_ADDRESS/ChatApp

    We connect to the NetGroup like this:

    groupSpecifier = new GroupSpecifier(groupID);
    groupSpecifier.multicastEnabled = true;
    groupSpecifier.postingEnabled = true;
    groupSpecifier.serverChannelEnabled = true;

    netGroup = new NetGroup(netConnection, groupSpecifier);

    And we connect to the NetStream like this:

    netStream = new NetStream(netConnection, groupSpecifier.groupspecWithAuthorizations());

    I read somewhere that DIRECT_CONNECTIONS was better than mesh, but maybe it was an older article. So mesh is the way to go?

    If I am experiencing audio latency and video freezing for a second or two, what other optimizations are possible?


    So, in your case , the application on FMS is 'ChatApp' that you are connecting to. You can find it under /opt/adobe/fms/applications directory or /mnt/applications or wherever the applications directory is mapped to. The mapping can be found in fms.ini file under the conf folder with the variable VHOSTS.APPSDIR

    The rest of the code snippet is how we make the P2P mesh, and it looks ok to me.

    We can safely assume P2P is the way to go. DIRECT CONNECTIONS is 1.0 of P2P (in my opinion).


    For more optimizations, you need to make sure the following :

    No packet loss in your network : since the P2P is on UDP, careful observation of your network traffic is required

    Do not use Queues

    Reduce OutChunkSize (this can be found in server.xml), and you can always read the comments above each tag to get a description about its function.

    Use optimal bitrates for audio and video that your network supports

    Reduce the buffer length on the client side (ideally 0 or 0.1) so that it starts playback instantly without any delay and reducing latency

    These are some of the points that i can quickly think of !

    Thank you !

    2 replies

    Nikhil_Kalyan
    Participating Frequently
    April 29, 2011

    Hi,

    Thanks for trying out P2P !

    The video/audio quality cannot be improved other than what you feed to FMS but, you mentioned observing latency issues and video pixelation etc, are you using FMS in its default configuration after installation ? You may want to try and disable aggregate messages or totally disable the queues on the FMS that reduce latency, especially for live video chat applications.

    I am not sure of your complete scenario, but is it a group chat ? P2P has its advantages coming into high effect with more peers (you might as well know this) and hence if you have just one-one chat, P2P is UDP and hence you might have packet loss.

    What codecs are you using ? You might also want to switch to Speex for audio as it is 'specialized' in good delivery.

    Hope it helps a little.

    Thank you ! 

    April 29, 2011

    You mention that if Flash Player is used for encoding you cannot achieve very high qaulity as of now, just wondering how else the encoding would happen, as users of this video chat app would be broadcasting via their web cams. In that case does FP handle the encoding, and what else are my options other than FP?

    I think we are using FMS in its default configuration after installation (we use the Amazon Web Services FMS).

    How can I "disable aggregate messages or totally disable the queues on the FMS that reduce latency, especially for live video chat applications". I'm very interested in hearing more about that.

    Typically there will be up to 8-12 people in the group video chat room, with video pod size of about 147x110 px.

    We are using Speex for audio currently.

    Hoping more info might move us forward.

    Thanks very much.

    Nikhil_Kalyan
    Participating Frequently
    April 29, 2011

    When we talk of Flash Player having not much of high quality for encoding, it does not in any way point to the capabilities of the flash player For me, FP is just awesome.

    We just want to bring to notice the avaialbility of encoders that are specialized in their work, and which support more video codecs (like H264 encoding) which is as of now not available on FP (though , we might definitely expect it sometime soon).

    Anyways for your usecase, FP has to do the work. External encoders are awesome for other live usecases (one -to-many).

    Coming to the FMS configuraiton :

    You have a conf folder under the fms installation directory where all the configuration xml files are located for FMS (under sub directories as well).

    Any settings done here are application to all the applications that you make on FMS. Find application.xml in this conf directory and search for queue tag. Disable the queue.

    <Application>

                   

                    <!-- Live queuing and aggregate messages are turned off the multicast  -->

                    <!-- sample application to enhance the performance and flow of messages -->

                    <!-- delivered to multicast streams. Setting the queue to "true" can        -->

                    <!-- cause delay in the multicast playback.                                                            -->

                    <StreamManager>

                                    <Live>

                                                    <Queue enabled="false">

                                                                    <AggregateMessages enabled="false">

                                                                    </AggregateMessages>

                                                    </Queue>

                                    </Live>

                    </StreamManager>

                    <Client>

                                    <AggregateMessages enabled="false"></AggregateMessages>

                    </Client>

    ...

    You can as well take a look at the other tags in various XML configuration files.

    April 28, 2011

    Not much activity in the forum today, but can anyone comment on this?

    Participating Frequently
    April 29, 2011

    I do not think FMS is at fault when you talk of quality of video or audio - it all depends on how its encoded. If source itself is not of high quality there is nothing FMS can do about it. Also if Flash Player is used for encoding you cannot achieve very high qaulity as of now but having said that it can do decent quailty if your source is good enough.