Search code examples
c++linuxlibvlc

Libvlc screen recording


I need to save my screen while program is working in linux. I have tried

string out = filepath;
stringstream cmd;

cmd << "cvlc -v screen:// '--sout=#transcode{vcodec=h264}:file{dst=" << out <<"} ' &"
system(cmd.str().c_str());

This command not works. What should i change in this command?


Solution

  • I solved that problem/ Here is working code:

    cvlc -I 'dummy' screen:// --screen-left=0 --screen-top=0 --screen-width=1280 --screen-height=960 --screen-fps=30 \
    --sout '#transcode{vcodec=mp2v, vb=800, scale=1, acodec=none}:file{mux=ts, dst=your_video_path_to_be_saved}'