Decrease delay during streaming and live streaming methods

偶尔善良 提交于 2019-12-05 08:05:30

问题


I am currently using an app that uses the method exemplified on libstreaming-example-1 (libstreaming) to stream the camera from an Android Device to an Ubuntu Server (using openCV and libVLC). This way, my Android device acts like a Server and waits for the Client (Ubuntu Server) to send the play signal over RTSP and then start the streaming over UDP.

The problem I am facing with the streaming is that I am getting a delay of approximately 1.1s during the transmission and I want to get it down to 150ms maximum.

I tried to implement the libstreaming-example-2 of libstreaming-examples, but I couldn't I don't have access to a detailed documentation and I couldn't figure out how to get the right signal to display the streaming on my server. Other than that, I was trying to see what I can do with the example 1 in order to get it down, but nothing new until now.

PS: I am using a LAN, so network/bandwidth is not the problem.

Here come the questions:

  • Which way is the best to get the lowest latency possible while streaming video from the camera?
  • How can I implement example-2?
  • Is example-2 method of streaming better to get the latency down to 150ms?
  • Is this latency related to the decompression of the video on the server side? (No frames are dropped, FPS: 30)

Thank you!


回答1:


had same issue as you with huge stream delay (around 1.5 - 1.6 sec)

My setup is Android device which streams its camera over RTSP using libStreaming, receiving side is Android device using libVlc as media player. Now I found a solution to decrease delay to 250-300 ms. It was achieved by setting up libVlc with following parameters.

 mLibvlc = new LibVLC();
    mLibvlc.setVout(LibVLC.VOUT_ANDROID_WINDOW);
    mLibvlc.setDevHardwareDecoder(LibVLC.DEV_HW_DECODER_AUTOMATIC);
    mLibvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DISABLED);
    mLibvlc.setNetworkCaching(150);
    mLibvlc.setFrameSkip(true);
    mLibvlc.setChroma("YV12");
    restartPlayer();

private void restartPlayer() {
    if (mLibvlc != null) {
        try {
            mLibvlc.destroy();
            mLibvlc.init(this);
        } catch (LibVlcException lve) {
            throw new IllegalStateException("LibVLC initialisation failed: " + LibVlcUtil.getErrorMsg());
        }
    }
}

You can play with setNetworkCaching(int networkCaching) to customize a bit delay

Please let me know if it was helpful for you or you found better solution with this or another environment.



来源:https://stackoverflow.com/questions/30901818/decrease-delay-during-streaming-and-live-streaming-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!