将ffmpeg与xvfb一起使用可渲染屏幕的裁剪版本 [英] Using ffmpeg with xvfb renders a cropped version of the screen

查看:183
本文介绍了将ffmpeg与xvfb一起使用可渲染屏幕的裁剪版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下命令来渲染在虚拟帧缓冲区内运行的chrome浏览器的视频(使用 xvfb ):

I'm using the following command to render a video of a chrome browser running inside a virtual frame buffer (using xvfb):

ffmpeg -f x11grab -i :5 -s `DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 30 tests.mpg

当我省略 DISPLAY =:5 xdpyinfo |grep'dimensions:'| awk'{print $ 2}',它将以大约 1024x768 呈现,因此我调用xdpyinfo来获取显示的分辨率并告诉ffmpeg.

When I omit the DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}', it will render at about 1024x768, so I invoked xdpyinfo to get the resolution of the display and tell ffmpeg about it.

但是当我使用该命令时,它显示的裁切区域相同,只有拉伸才能适合我给ffmpeg的分辨率.

But when I use the command, it shows the same cropped area, only stretched to fit the resolution I gave ffmpeg.

我希望能够记录整个虚拟帧缓冲区而不会裁剪.有办法吗?

I would like to be able to record the whole virtual frame buffer without cropping or stretching. Is there a way to do so?

我今天早上才从源代码编译ffmpeg,运行 v2.8.git

I have compiled ffmpeg from source just this morning, running v2.8.git

推荐答案

之后 -i 出现的参数控制输出,而不是输入.

The arguments that come after -i control the output, not the input.

要设置源分辨率,请在 -i 之前的 xdpyinfo 输出中使用 -video_size .对于帧速率,请使用 -framerate .

To set the source resolution use -video_size with the xdpyinfo output before the -i. For the framerate use -framerate.

x11grab 输入的格式为 [主机名]:display_number.screen_number [+ x_offset,y_offset] .

ffmpeg -video_size `DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -framerate 30 -f x11grab -i :5.0+0,0 output.mpg

检查文档和指南: https://trac.ffmpeg.org/wiki/Capture/桌面

这篇关于将ffmpeg与xvfb一起使用可渲染屏幕的裁剪版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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