Got black screen when recording screen from xvfb by ffmpeg x11grab device
- by shawnzhu
I'm trying to record video from a firefox run by xvfb-run but it always output nothing in the video file except black screen.
Here's what I did:
start a firefox, open google.com:
$ xvfb-run firefox https://google.com
Then it will use the default display server number 99. I can see the display information by command xdpyinfo -display :99.
A screenshot works very well by command:
$ xwd -root -silent -display :99.0 | xwdtopnm |pnmtojpeg > screen.jpg
Start using ffmpeg to record a video:
$ ffmpeg -f x11grab -i :99.0 out.mpg
When I play the video file out.mpg, there's black screen all the time.
Is there any parameter I missed?
Updates
I made progress that the video works instead of black screen only by this command:
$ ffmpeg -y -r 30 -g 300 -f x11grab -s 1024x768 -i :99 -vcodec qtrle out.mov
Notice it requires the screen resolution matches by specify more options to xvfb-run:
$ xvfb-run -s "-screen 0 1224x768x16" -a firefox http://google.com
But I still want to get more feedbacks and answers here.