QML播放本地视频或网络摄像头视频

 (1)利用定时器,通过采集图像的方式

 Image{

       id:img

       Timer{

           id:timer

           interval:300

           repeat:true

           //triggeredOnStart:true

           running:true

           onTriggered:{

                    img.source=""

                    img.source="http://admin:[email protected]/auto.jpg"

           }

     }

   

    Image{

       id:img

       source:"file:/E:/claudia.png"

    }

备注:利用img.source=""刷新窗口,需要时间,所以设置的定时器时间要大于300ms,可验证。利用定时器的方法不能保证“视          频”的流畅度的问题

(2)通过视频播放的功能,需要利用DirectShow解码器LAVFilter.exe (下载安装即可,无需关联Qt/Qml)

MediaPlayer{

       id:player

       source:"rtsp://admin:[email protected]:554/22"

       //source:"file:/E:/1.mp4"

       autoPlay:true

    }

    VideoOutput{

       anchors.fill:parent

       source:player

}

备注:利用LAVFilter解码器,类似于一种播放器,播放器调用网络摄像头的URL命令是利用rtsp形式的命令~,一直卡在HTTP形式的命令。


猜你喜欢

转载自blog.csdn.net/zhaol_90/article/details/79006646