6

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.

  • Black according to what player(s)? Please show the complete console output for each ffmpeg command. – llogan Mar 11 '14 at 4:39
  • Following the docs, I also added -show_region 1 to the arguments. Still no luck. Something that stood out to me: Not even the region is shown on the display. If I run this on the main display :0.0, both works (I get video and see the region-border). If I run in on another screen (like with vncserver) neither works. – exhuma Apr 2 '16 at 14:25
5

I happened to have the same problem and found out: you have to specify the depth (16 in this case) so ffmpeg won't produce the black screen.

e.g.

Xvnc -geometry 1024x768 -depth 16 :10  <<---WORKS
Xvnc -geometry 1024x768 :10            <<---does NOT work, produce black screen.
  • 3
    16 seems to be the default (according to the Xvnc4 man-page). I have the same problem and tried both 16 and 24 as depth. Still have a black video. Do you still have the command you used for ffmpeg? – exhuma Apr 2 '16 at 14:02
2

I had the same issue. Seems like it had something to do with the version of ffmpeg available in the official Ubuntu packages (Kubuntu 15.04 in my case to be precise).

I downloaded the ffmpeg sources and with a bit of help of the docs I managed to get something running.

The build process takes a long time! And by default many features (x11grab among others) are disabled. I ended up with the following:

./configure \
    --prefix=/home/exhuma/.local \
    --enable-x11grab \
    --enable-gpl \
    --enable-libx264 \
    --enable-libmp3lame \
    --enable-nonfree

I now have both video and sound.

0

I don't know if you have fixed this bug but if you haven't let me help out because I ran into same issue. Here's a solution (I'm running on Fedora 30):

Your need to Configuring Xorg as the default GNOME session. On your terminal open your custom.conf by typing the this command sudo nano /etc/gdm/custom.conf and uncomment WaylandEnable=false if it's commented but must be set to false

Then, on the [daemon] section just under WaylandEnable=false add this line DefaultSession=gnome-xorg.desktop and save the file. Then try running your Screen Recorder program again. Congratulations.

However, if nano command is not working please try installing it by running the command sudo dnf install nano or sudo apt-get install nano which ever works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.