How to record a specific window using ffmpeg?

前端 未结 6 807
说谎
说谎 2021-02-18 18:41

I use ffmpeg to record a window using this code:

ffmpeg.exe
-f dshow 
-y 
-i video=\"screen-capture-recorder\":audio=\"virtual-audio-capturer\":audio=\"Microphon         


        
6条回答
  •  终归单人心
    2021-02-18 19:02

    I used this to record the prompt

    ffmpeg -rtbufsize 1500M -f dshow -i audio="Microfono (8- Logitech USB Headset)" -f gdigrab -framerate 30 -draw_mouse 1 -i title="Prompt dei comandi" -pix_fmt yuv420p -profile:v baseline -y output\output3_xp.mp4
    pause
    

    But it works only with 100x20 (colxrow) fo the prompt or other divisible screen size, otherwise it gives me an error, this:

    [libx264 @ 0000027c7ed66200] width not divisible by 2 (269x432)
    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    Conversion failed!
    

    P.S.: I have this problem also with other windows that has not even width or height. I created a window with tkinter in Python and I get the error, then I gave the window some geometry (300x500) and it worked...

    Strangely, the mouse is a little offset...

提交回复
热议问题