RTSP & QML



  • Hey !
    I am recovering and displaying a video from an IP camera using a QML sourcecode.
    I'm using a basic mediaplayer
    But here is my problem. For now I am directly linked to my camera, but, in the end, my camera will send the video to a kind of controller. This controller will send me under UDP packet a lot of information, including the camera video.
    I also know that, the controller can "recognize" the video, and put an "ID Video" on all UDP packets corresponding to the camera before sending me.
    How should I modify my code to focus on these UDP packet and display the video on my computer ?

    Here is my first code :
    RTSP.qml :

    import QtQuick 2.0
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import QtQuick.Controls.Material 2.0
    import QtQuick.Controls.Universal 2.0
    import Fluid.Controls 1.0
    import QtMultimedia 5.5
    import QtQuick.Window 2.0
    import QtQuick 2.7
    
    import "elements"
    
    
    Tab {
    
         //visible: true
        //visibility: maximised
        title: "RTSP Stream"
    
        SwipeView{
            id: swipeview
            anchors.fill: parent
            currentIndex: tabBar.currentIndex
    
            Page{
               MediaPlayer{
                    id: mediaplayer
                    source: "rtsp://192.168.1.206/axis-media/media.amp"
                }
                VideoOutput{
                    anchors.fill: parent
                    source: mediaplayer
                }
                Text{
                    id:msgPage1
                    anchors.centerIn: parent
                    font.pointSize: 32
                    text: qsTr("RTSP Launch")
                }
                MouseArea{
                    id: playArea
                    anchors.fill: parent
                    onClicked: {
                        if(msgPage1.visible){
                        print("initi stream")
                        msgPage1.visible = false
                        mediaplayer.play()
                        }
                        else{
                            print("para stream")
                            mediaplayer.stop()
                            msgPage1.visible = true
                        }
                    }
                }
            }
    
            }
        }
    

    main.qml :

    RowLayout
                {
                    spacing: 0
                    anchors.fill: parent
                    LeftStatusStack {
                        id: leftStatusStack
                        anchors.top : parent.top
                    }
                    Rectangle
                    {
                        color: Material.primary
                        Layout.fillHeight: true
                        width:theme.horizontalSepWidth
                    }
    ...
    RTSP{
                            id: rtspTab
                            objectName: "rtspTab"
                            visible: true
                        }
    
    

    I dont put all the main because I think you dont need it but there is a lot of module (all working)

    So to sum up : The video arrive with a lot of other UDP packet, video packet contains a identificator, I just want to display that video, how can I modify my code ? :)

    Thanks for help ;)


  • Lifetime Qt Champion

    Hi,

    It's a bit vague. What will that controller be ? Won't it just add data to the video stream ?
    You make it sound like it's going to interleave information so generate new frames between video frames.



  • Hi @SGaist ,

    sorry for the time of response
    Actually, it will add data yes. Most of the data will be video stream but not all.That's why I need to recover only video data and, as I explain, I know that these video data have an identificator (something like 0x0019 )


  • Lifetime Qt Champion

    What I meant is, is the stream altered or can you still view it on e.g. VLC ?



  • @SGaist the stream is not altered, I want to recover exactly the same video that the camera send



  • @Chanchan said in RTSP & QML:

    the stream is not altered

    somehow contradicts

    video arrive with a lot of other UDP packet

    please answer @SGaist question regarding what happens if you use i.e. VLC to connect to your server output, can you view the video? I bet not...



  • no, as I said, I recover a lot of UDP packets, but only one type is interesting for me : video ones. And that I want is to detect these packet and display them in a video module



  • I didnt try with VLC but I used Gstreamer and yes I can display it



  • @Chanchan said in RTSP & QML:

    I used Gstreamer and yes I can display it

    Mmm, strange. So somehow Gstreamer is smart enough to drop the non-video related UDP packets?


  • Lifetime Qt Champion

    So my guess is that device is just adding meta data to your video stream so it should play the same especially if GStreamer is able to show it.


  • Banned

    This post is deleted!


  • sorry for the response time again, ok I will search in this way then, thanks for answering :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.