vlc传输_如何使用VLC将桌面记录为文件或通过Internet流式传输

vlc传输

vlc传输

vlc screencast header

VLC is full of powerful features, including the ability to record your desktop. VLC is great for quick captures, although it doesn’t necessarily have the more advanced features of a dedicated screencasting application.

VLC充满了强大的功能,包括录制桌面的功能。 VLC非常适合快速捕获,尽管它不一定具有专用截屏应用程序的更高级功能。

We’ve already covered transcoding (saving media to a file) with VLC and streaming with VLC. To record your desktop to a file or stream it, perform the normal transcoding or streaming process with your desktop as the capture device.

我们已经介绍了使用VLC进行转码(将媒体保存到文件中)和使用VLC进行流传输的内容 。 要将桌面记录到文件或对其进行流处理,请以桌面作为捕获设备执行正常的转码或流处理。

将桌面记录到文件 (Recording Your Desktop to a File)

To capture and record a video of your desktop to a file, click the Media menu in VLC and select Convert / Save.

要将桌面视频捕获并录制到文件中,请在VLC中单击“媒体”菜单,然后选择“转换/保存”。

image

Click the Capture Device tab and select Desktop from the Capture mode box.

单击捕获设备选项卡,然后从捕获模式框中选择桌面。

image

The default frame rate is one frame per second, which won’t appear very smooth. You’ll probably want to increase the frame rate. After you’re happy with the frame rate, click the Convert / Save button.

默认的帧速率是每秒一帧,看起来不会很平滑。 您可能需要提高帧速率。 对帧速率满意后,单击“转换/保存”按钮。

image

Set a destination file in the Destination section. You can enable the Display the output checkbox to display the contents of your desktop in the VLC window while recording, but this isn’t necessary.

在“目标”部分中设置目标文件。 您可以启用“ 显示输出”复选框以在录制时在VLC窗口中显示桌面的内容,但这不是必需的。

To adjust the resolution and video codec, click the edit button to the right of the Profile box. You can also select a profile from the profile box and use it as-is, without editing it.

要调整分辨率和视频编解码器,请单击“配置文件”框右侧的“编辑”按钮。 您也可以从配置文件框中选择一个配置文件,并按原样使用它,而无需对其进行编辑。

image

Change the resolution by clicking over to the Video codec tab and using the options in the Resolution section. For example, you can use half your desktop’s resolution by typing 0.5 into the Scale box.

通过单击视频编解码器选项卡并使用“分辨率”部分中的选项来更改分辨率。 例如,通过在“比例”框中键入0.5,可以使用桌面分辨率的一半。

image

After specifying your options, click the Save button and click the Start button.

指定选项后,单击“保存”按钮,然后单击“开始”按钮。

image

VLC will inform you that it’s “streaming” your desktop to a file. Use your computer normally and VLC will record your desktop. When you’re done, click the Stop button.

VLC将通知您它正在将桌面“流式传输”到文件。 正常使用计算机,VLC会记录您的桌面。 完成后,单击“停止”按钮。

image

Open your saved file to view the video of your desktop. You can send this file to others, upload it to YouTube, or do whatever else you like with it.

打开保存的文件以查看桌面视频。 您可以将此文件发送给其他人,将其上传到YouTube或进行其他操作。

image

实时流式传输桌面 (Live-Streaming Your Desktop)

To stream your desktop over the network instead of recording it to a file, click the Stream option instead of the Convert / Save option in the Media menu.

要通过网络流式传输桌面而不是将其记录到文件中,请单击“流”选项,而不是“媒体”菜单中的“转换/保存”选项。

image

Select the Desktop capture mode on the Capture Device tab, select your desired framerate, and click the Stream button.

在“捕获设备”选项卡上选择“桌面”捕获模式,选择所需的帧速率,然后单击“流”按钮。

image

In the Destination Setup section, select a streaming method from the dropdown box and click Add. You can also control transcoding and other options from here. Consult our guide to streaming with VLC for more information on connecting to the stream from another computer.

在“目标设置”部分中,从下拉框中选择一种流传输方法,然后单击“添加”。 您还可以从此处控制转码和其他选项。 有关从另一台计算机连接到流的更多信息,请查阅我们的VLC流指南

image

Click the Stream button and you may be prompted to give VLC access through your firewall. Depending on your streaming method, you may also need to forward ports if you want to stream over the Internet. For example, if you add the HTTP streaming method, you’ll see that it uses port 8080 by default. Check out our guide to port-forwarding for more information on forwarding ports.

单击“流”按钮,系统可能会提示您通过防火墙授予VLC访问权限。 根据流的方法,如果要通过Internet流,则可能还需要转发端口。 例如,如果添加HTTP流方法,则默认情况下它将使用端口8080。 查阅我们的端口转发指南,以获取有关转发端口的更多信息。

image

使视频更流畅并减少带宽使用。 (Making Video Smoother & Reducing Bandwidth Usage.)

For smoother video, you can also try lowering your screen’s resolution. Removing your desktop background and using a flat color may also result in less bandwidth usage if you’re streaming the video.

为了获得更流畅的视频,您还可以尝试降低屏幕的分辨率。 如果要流式传输视频,则删除桌面背景并使用纯色也可能会减少带宽使用。

Don’t forget the settings in VLC – transcoding the video so that it’s smaller will reduce bandwidth. You can also increase the frames per second VLC captures from your desktop to make the video smoother, although this will make your video file larger and increase bandwidth usage if you’re streaming.

不要忘记VLC中的设置-对视频进行转码以使其更小将减少带宽。 您还可以提高桌面VLC捕获的每秒帧数,以使视频更流畅,尽管这将使视频文件更大并在流式传输时增加带宽使用率。

翻译自: https://www.howtogeek.com/120202/how-to-record-your-desktop-to-a-file-or-stream-it-over-the-internet-with-vlc/

vlc传输

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`libvlc_video_set_callbacks` 是一个 libvlc 库函数,用于设置视频帧回调函数。该函数需要传入三个参数: 1. `opaque`: 一个 void 指针,用于向回调函数传递自定义数据。可以为 NULL。 2. `lock`: 一个函数指针,用于锁定视频帧的内存地址,以便后续读取或写入。该函数需要返回一个指向视频帧数据的指针,或者 NULL 表示无法锁定内存。函数原型为 `void *(*lock)(void *opaque, void **planes)` 3. `unlock`: 一个函数指针,用于解锁视频帧的内存地址,以便其他程序或线程可以继续访问该内存地址。函数原型为 `void (*unlock)(void *opaque, void *picture, void *const *planes)` 4. `display`: 一个函数指针,用于显示视频帧。函数原型为 `void (*display)(void *opaque, void *picture)` 使用该函数的步骤如下: 1. 定义一个结构体来存储视频帧回调函数所需的自定义数据。 2. 实现锁定函数、解锁函数和显示函数,并将它们传递给 `libvlc_video_set_callbacks` 函数。 3. 播放视频并等待回调函数被调用。 以下是一个示例代码: ```c typedef struct { unsigned char* pixels; size_t pitch; } FrameData; void* lock(void* opaque, void** planes) { FrameData* frameData = (FrameData*)opaque; *planes = frameData->pixels; return NULL; } void unlock(void* opaque, void* picture, void* const* planes) { // do nothing } void display(void* opaque, void* picture) { FrameData* frameData = (FrameData*)opaque; // render the frame using the frame data } int main(int argc, char* argv[]) { libvlc_instance_t* vlcInstance = libvlc_new(argc, argv); libvlc_media_t* media = libvlc_media_new_path(vlcInstance, "path/to/video.mp4"); libvlc_media_player_t* mediaPlayer = libvlc_media_player_new_from_media(media); FrameData frameData = {0}; frameData.pixels = malloc(width * height * 4); frameData.pitch = width * 4; libvlc_video_set_callbacks(mediaPlayer, lock, unlock, display, &frameData); libvlc_media_player_play(mediaPlayer); // wait for the video to finish libvlc_media_player_release(mediaPlayer); libvlc_release(vlcInstance); free(frameData.pixels); return 0; } ``` 在这个示例中,我们定义了一个名为 `FrameData` 的结构体,用于存储视频帧的像素数据和步长。然后,我们实现了锁定函数、解锁函数和显示函数,并将它们传递给 `libvlc_video_set_callbacks` 函数。最后,我们播放视频并等待回调函数被调用。在回调函数中,我们使用 `FrameData` 结构体中的数据来渲染视频帧。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值