使用终端的 VLC 屏幕截图 [英] VLC screen capture using terminal

查看:25
本文介绍了使用终端的 VLC 屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将屏幕捕获为视频,发现 VLC 可能是最佳解决方案.我要做的是使用终端捕获特定的应用程序,然后也停止捕获.现在,我可以通过以下命令使用终端进行捕获:

I'm attempting to capture my screen as video and found VLC to probably be the best solution. What I have to do is capture a specific application using terminal and then stop the capture as well. Right now, I can capture using terminal with the following command:

/Applications/VLC.app/Contents/MacOS/VLC -I dummy screen:// --screen-fps=25 --quiet --sout "#transcode{vcodec=h264,vb072}:standard{access=file,mux=mp4,dst="Desktop/vlc-output-terminal.mp4"}"

太好了,它有效.问题是,如何使用终端退出录音?现在,我必须在终端上执行 Control+C 以退出它.我在网上看到了 vlc://quit,但我不确定如何使用该命令.

That's great, it works. The question is, how do I quit the recording using terminal? Right now, I'm having to do Control+C on the terminal to quit it. I've seen vlc://quit online, but I'm not sure how to use that command.

另外,有谁知道是否可以使用 VLC 捕获特定的应用程序,或者整个屏幕是唯一的选择吗?

Also, does anyone know if it's possible to capture a specific application using VLC or is the whole screen the only option?

推荐答案

如何录制时退出

Ctrl+C 使用信号 SIGINT 杀死进程(在本例中为 VLC).

How to NOT quit when recording

Ctrl+C kill process (in this case VLC) with signal SIGINT.

vlc://quit 选项在您捕获屏幕时不起作用,因为流是永无止境的源.


vlc://quit option will not work when you capture screen because stream is never-ending source.


您可以使用 TCP 套接字UNIX 套接字 连接到 VLC.

You can connect to your VLC using a TCP socket or a UNIX socket.

  • TCP 套接字

  • TCP socket

要能够使用 TCP 套接字(类似于 telnet 的连接)远程连接到您的 VLC,请使用 --rc-host your_host:port.然后,通过连接(使用 telnet 或 netcat)到给定端口上的主机,您将获得命令外壳.

To be able to remote connect to your VLC using a TCP socket (telnet-like connetion), use --rc-host your_host:port. Then, by connecting (using telnet or netcat) to the host on the given port, you will get the command shell.

  • UNIX 套接字

  • UNIX socket

    要使用 UNIX 套接字(本地套接字,这不适用于 Windows),请使用 --rc-unix/path/to/socket.然后可以使用此 UNIX 套接字传递命令.

    To use a UNIX socket (local socket, this does not work for Windows), use --rc-unix /path/to/socket. Commands can then be passed using this UNIX socket.

  • 要为 VLC 启用远程控制界面,您需要添加选项

    To enable remote control interface for VLC you will need to add options

    --extraintf rc --rc-quiet
    


    • TCP 套接字

    • TCP socket

    回声退出 |nc your_host 端口

    echo quit | nc your_host port

    UNIX 套接字

    回声退出 |nc -U/path/to/socket


    echo quit | nc -U /path/to/socket


    1. 执行 VLC

    1. Execute VLC

    vlc 
    screen:// --one-instance 
    -I dummy --dummy-quiet 
    --extraintf rc 
    --rc-host localhost:8082 
    --rc-quiet 
    --screen-follow-mouse 
    --screen-mouse-image="mouse_pointer.png" 
    --screen-left=0 --screen-top=0 --screen-width=800 --screen-height=600 
    --no-video :screen-fps=15 :screen-caching=300 
    --sout "#transcode{vcodec=h264,vb=800,fps=5,scale=1,acodec=none}:duplicate{dst=std{access=file,mux=mp4,dst='/Videos/screen.mp4'}}"

  • 正常关闭 VLC

  • Gracefully shutdown VLC

    echo quit | nc localhost 8082

    如果您没有 nc (netcat) 在您的计算机上.

    You can also use Python code below if you do not have nc (netcat) on your computer.

    import socket
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(('localhost', 8082))
    s.sendall('quit
    ')
    s.shutdown(socket.SHUT_WR)


  • 您无法选择要录制的应用程序,但可以指定子屏幕的坐标、宽度和高度.

    You can't select which application to record but you can specify coordinate, width and height of the subscreen.

    选项

    • --screen-top integer 子屏幕的上边缘坐标.默认值:0
    • --screen-left integer 子屏幕的左边缘坐标.默认值:0
    • --screen-width integer 子屏幕的宽度.默认值:<全屏宽度>
    • --screen-height integer 子屏幕的高度.默认值:<全屏高度>
    • --screen-top integer The top edge coordinate of the subscreen. Default value: 0
    • --screen-left integer The left edge coordinate of the subscreen. Default value: 0
    • --screen-width integer The width of the subscreen. Default value: <full screen width>
    • --screen-height integer The height of the subscreen. Default value: <full screen height>

    这篇关于使用终端的 VLC 屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆