本文介绍了减少流式传输和实时流式传输方法期间的延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用的应用程序使用的是 libstreaming-example-1 ( libstreaming )将摄像机从Android设备流式传输到Ubuntu服务器(使用 openCV libVLC ).这样,我的Android设备就像服务器一样,等待客户端(Ubuntu服务器)通过发送播放信号RTSP ,然后通过UDP启动流传输.

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.

流式传输所面临的问题是,在传输过程中出现了大约 1.1s 的延迟,并且我希望将其降低到最大150ms .

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.

我尝试实现libstreaming-examples的 libstreaming-example-2 ,但是我无法获得详细的文档,也无法弄清楚如何获取正确的信号以在我的服务器上显示流.除此之外,我试图查看示例1可以做什么以降低它,但到目前为止没有什么新鲜事物.

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:我正在使用LAN,所以网络/带宽不是问题.

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

以下是问题:

  • 哪种方法是最好的方法,可以在尽可能短的时间内获得最低的延迟从相机流视频?
  • 如何实现示例2?
  • 是否是更好的流传输示例2方法,以将延迟降低到150毫秒?
  • 此延迟是否与以下视频的解压缩有关?服务器端? (不丢帧,FPS:30)
  • Which way is the best to get the lowest latency possible whilestreaming video from the camera?
  • How can I implement example-2?
  • Is example-2 method of streaming better to get the latency down to150ms?
  • Is this latency related to the decompression of the video onthe server side? (No frames are dropped, FPS: 30)

谢谢!

推荐答案

与您遇到的问题相同,流延迟很大(大约1.5-1.6秒)

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

我的设置是使用libStreaming在RTSP上流式传输其相机的Android设备,接收端是使用libVlc作为媒体播放器的Android设备.现在,我找到了一种将延迟降低到250-300毫秒的解决方案.这是通过使用以下参数设置libVlc来实现的.

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());
        }
    }
}

您可以使用setNetworkCaching(int networkCaching)来自定义位延迟

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.

这篇关于减少流式传输和实时流式传输方法期间的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 00:46
查看更多