将 ffmpeg 与 xvfb 一起使用会呈现屏幕的裁剪版本 [英] Using ffmpeg with xvfb renders a cropped version of the screen
问题描述
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
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.
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?
I have compiled ffmpeg from source just this morning, running v2.8.git
The arguments that come after -i
control the output, not the input.
To set the source resolution use -video_size
with the xdpyinfo
output before the -i
. For the framerate use -framerate
.
The format for the x11grab
input is [hostname]: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
Check the docs and the guide: https://trac.ffmpeg.org/wiki/Capture/Desktop
这篇关于将 ffmpeg 与 xvfb 一起使用会呈现屏幕的裁剪版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!