Qt开发: Qt5使用VLC库推流-- 共享桌面

        此文章是做一个小例子,在Qt5环境下,通过vlc将桌面共享出去,也就是将桌面推流

Qt5如何使用vlc在这里就不讲了,可以看博客:http://blog.csdn.net/taoerit/article/details/76871116


直接上代码:

      libvlc_instance_t *vlc;
 
  
      const char *sout = "#transcode{vcodec=h264,fps=25,venc=x264{preset=ultrafast,"\
           "profile=baseline,tune=zerolatency},vb=512,"                              \
           "acodec=mpga,ab=64,channels=2}"                                           \
           ":duplicate{dst=display,dst=standard{access=udp,mux=ts,dst=192.168.88.53:1234}}";
 
  
       const char *media_name = "my media";
 
  
       const char *url;
 
  
       url = "screen://";
       vlc = libvlc_new(0, NULL);
       libvlc_vlm_add_broadcast(vlc, media_name, url, sout, 0, NULL, true, false);
       libvlc_vlm_play_media(vlc, media_name);
 
  
       QThread::sleep(10000);
 
  
       libvlc_vlm_stop_media(vlc, media_name);
       libvlc_vlm_release(vlc);
 
  
 
  
效果图:
vlc播放器打开流: udp://@:1234
 
  
 
  

Qt开发: Qt5使用VLC库推流-- 共享桌面_第1张图片



雷神的三个关于vlc的例子


最简单的基于libVLC的视频播放器
http://blog.csdn.net/leixiaohua1020/article/details/42363079


最简单的基于libVLC的视频播放器(图形界面版)
http://blog.csdn.net/leixiaohua1020/article/details/42363593


最简单的基于libVLC的推流器 
http://blog.csdn.net/leixiaohua1020/article/details/42363701



你可能感兴趣的:(Qt,VLC,流媒体,Qt开发总结)