Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML video element could not read from resource

QML video element could not read from resource

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bluestreak
    wrote on last edited by
    #1

    I am trying to stream two different videos into my QML application. The first, is NTSC, and I get through /dev/video1 and I can see it being successfully displayed in VLC.
    @
    Video {
    id: camera1
    autoLoad: true
    playing: true
    source: "/dev/video1"
    onStarted: {
    camera1.play()
    }
    }
    @
    When I try to make a video element with it, I get the error "Could not read from resource."

    The other is an RTSP stream, which occasionally outputs video, but often crashes the application.
    @
    Video {
    id: cameraChoice
    autoLoad: true
    playing: true
    source: "rtsp://172.31.0.200/stream1"
    onStarted: {
    cameraChoice.play()
    }
    }
    @
    Sometimes it works, and outputs the video it is given. Other times, it will crash and report "The program has unexpectedly finished." This happens both after a mere half second of the program running, and after successfully starting and then switching to a view that contains the video if the application has been running for less than 5 seconds.

    In addition, even if you do wait and get to it with video displaying, when you switch to a new view, the video remains there for over a second while the tab content behind it changes, before it finally disappears.

    Searching around, I could find no information on why the NTSC connection through video could not be read. In the case of the RTSP stream, I found a report of a bug with RTSP crashing https://bugreports.qt-project.org/browse/QTBUG-21501

    I tried to follow the suggestions of the bug report as below, changing graphics and using a QGL widget, however neither worked.
    @
    int main(int argc, char *argv[])
    {

    QApplication a(argc, argv);
    
    // Use a raster graphics system
    QApplication::setGraphicsSystem("raster"); // You can also try "opengl" here
    
    MainWindow w;
    w.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    w.setViewport(new QGLWidget);
    
    w.setSource(QUrl::fromLocalFile(contentPath + "/main.qml"));
    w.show();
    return a.exec();
    

    }
    @

    Does anyone know whether these two problems are both tied to the video widget, and how to fix them so that I can get video to be read and displayed consistenly?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aabc
      wrote on last edited by
      #2

      Don't you need to add port to the rtsp source ?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved