[Libav-user] avformat_open_input hangs on UDP stream

Jeff Fisher fisher.jeff at gmail.com
Thu Sep 5 19:35:27 CEST 2013


Hi everyone,

I have the following code snippet in a video display class:

bool VideoSourceNetwork::connectToStream(const QString &Address)
{
    avcodec_register_all();
    av_register_all();

    if (avformat_network_init() < 0)
        return false;

    m_pContextFormat = NULL;

    if (avformat_open_input(&m_pContextFormat, Address.toStdString().c_str(), NULL, NULL) < 0)
        return false;

    … etc …

    return true;
}

If I call that function with a local file path (e.g. "/root/video/test.mpg"), everything works great. If, however, I pass it a network address in (e.g. "udp://:1234"), avformat_open_input never returns. If I use VLC to connect to udp://:1234, I get a video stream in probably less than a second. Any ideas…?


Thanks in advance.



More information about the Libav-user mailing list