libvlc stream part of screen

后端 未结 1 1405
执念已碎
执念已碎 2020-12-30 15:22

I want to stream a part of screen using vlc library. I wrote a small example:

#include 
#include 

#include 
         


        
1条回答
  •  伪装坚强ぢ
    2020-12-30 16:17

    I found solution.

    #include 
    #include 
    
    #include 
    
    
    int main(int argc, char**argv)
    {
        // the array with parameters
        const char* params[] = {"screen-top=0", 
                                "screen-left=0",
                                "screen-width=640", 
                                "screen-height=480", 
                                "screen-fps=10"}; 
        libvlc_instance_t * inst = libvlc_new(argc, argv);
        libvlc_vlm_add_broadcast(inst, "mybroad",
                "screen://", 
                "#transcode{vcodec=h264,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ts,dst=:7777/}",
                5, params, // <= 5 == sizeof(params) == count of parameters
                1, 0);
        libvlc_vlm_play_media(inst, "mybroad");
        std::cout << "ready" << std::endl;
        int i;
        std::cin >> i;
        return 0;
    }
    

    0 讨论(0)
提交回复
热议问题