Important: Please read the Qt Code of Conduct -

QMediaContent videostream latency

  • Hello ,

    I'm working on a robot model project. The robot communicates with my PC via Wifi, and an IP cam provides the video stream for the end-user. However I'm facing now with an issue that the video stream on my PC has 2-3 seconds delay, which is quite annoying.

    My code snippet:

    video_ablak = new QVideoWidget(this);
    media_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
    video_ablak->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    stream = QNetworkRequest(QUrl("rtsp:// :network-caching=150"));
    //stream.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
    //stream.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);

    ipcamera = new QMediaContent(stream);

    In VLC media player I could achieve ~150-200 ms latency by reducing the network-caching to 150ms.


    I tried the same in the link of the IP camera, but it has no effect. Neither the "setAttribute" parts in comment.

    How could I reduce the network caching in Qt or how could I achive lower latency in the video stream?
    (I wouldn't like to use the libVLC, because I have already a working mediaplayer in my software)

Log in to reply