Welcome, Guest! Log In | Create Account

Faq

From xvidcap

Jump to: navigation, search

#top

Contents

Xvidcap FAQ

#general

General Questions

What is xvidcap?

Xvidcap is a tool that can capture movement on an X11 display. It works in two distinct modes: It can capture to single frames (like a number of jpeg images) or it can encode the captured frames to a video on-line.
It is intended to be a standards-based alternative to tools like Lotus ScreenCam for UNIX platforms. On-line encoding is done through FFMPEG and also allows for audio grabbing on OSS compatible systems.

Can I capture the mouse pointer?

Yes ... provided some prerequisites are met.
X11 alone doesn't appear to support a generic way to determine the shape of the current mouse pointer. To achieve that, there is the Xfixes extension. If that is present during build-time and when you run xvidcap, you will get your mouse pointer in the right position and shape. If the Xfixes extension is not available, the only thing xvidcap can do in order to capture mouse movement to video is to determine the position of the mouse at the time a frame is captured and paint a dummy mouse pointer arrow to the corresponding position in every frame. That will still allow you to see a mouse pointer in the resulting video. However, if your application changes the shape of the mouse pointer (like e.g. Gimp does ist for most tools), you will not get those changed shapes in the video. You will always get the standard dummy mouse pointer.

Can I record audio along with the video?

Yes.
Since 1.1.2 you can, provided you have (a) an OSS compatible system and (b) FFMPEG libraries that have audio capture support compiled in (which is normally the case if you use the version of ffmpeg bundled in xvidcap).
As far as (a) is concerned, I know that Linux systems are usually OSS compatible and Solaris systems are not. I'm not sure about the other platforms that have been reported to run xvidcap (like HP-UX for one). Feel free to comment about your experiences on other platforms.
About (b): 1.1.2 will assume you have OSS, if you use pre-existing libavcodec and libavformat libraries. More recent versions check for the audio_init() function to determine the real status of audio support. If you use FFMPEG as included with xvidcap, the build system will determine the correct status from the included ffmpeg source tree.

You're saying FFMPEG needs OSS for audio capture. Will ALSA work, too?

I've found it to work fine on all of my machines. ALSA provides OSS compatibility which worked out-of-the box for me.
For more information on ALSA's OSS emulation, see here.

Recording sound does not work (or it only works for the microphone, not application output)

It does!
The thing is: This is completely depending on your mixer settings!
What typically causes problems here is that alsa starts all volume controls set to zero. Desktop environments typically set the controls to sane or user-defined values on startup for playback. For recording that often needs to be done manually by the user. How this can be done depends on the platform and desktop system you're on, or even the audio hardware you're using.
Here's an example for alsamixergui:
- bump up "Mic"
- activate "Mic" as an input source (red dots instead of white dots)
- select "Mic Boost (+20db)" (light green instead of white speaker symbols)

For the gnome volume control there are two sample screenshots here:
http://www.jarre-de-the.net/computing/volume1.png
http://www.jarre-de-the.net/computing/volume2.png

The proven strategy for testing this is using the most simple audio recording application available to eliminate errors in the configuration of the more complex applications (read: xvidcap). For example using rec and play from the sox application:

rec -d /dev/dsp test.wav

Then talk into the microphone or capture the output of the application you're trying to record, hit CTRL-C and play the recorded audio file.

play test.wav

Are there plans to port xvidcap to Windows?

No.
Well, not that I wouldn't think such a port worthwhile, but it's so far at the end of the priority list that it will probably never happen, unless a skilled Windows programmer wants to join the project for explicitly that reason.
After all, there are available tools for Windows, albeit typically not for free, like: Lotus ScreenCam, Camtasia, etc.

Will xvidcap work on a Mac, or are there plans to port it?

I have not received any reports that it does work on a Mac. Remember, though, that the best thing it could do is capture from X11. I am not at all sure it would allow you to capture Aqua applications.
Will there be a port? Prolly not before somebody buys me a MacBook ;)

Why does Windows Media Player play my captured videos upside down?

This seems to be an issue in Windows Media Player 6 and apparently fixed in version 7 ... so in typical Windows manner: Please upgrade

Can xvidcap capture OpenGL accelerated graphics?

It may, that can depend on a lot of parameters. At the end of the day, you will have to try.
For me glxgears works, but you need to disable the use of Xdamage on the general tab of the preferences dialog. There may be cases where OpenGL acceleration needs to be disabled. (For me, I suspect it works because I'm using a compositing window manager and AIGLX as an OpenGL enabled X server with indirect rendering.

Does xvidcap work with fullscreen applications, such as games like Cube?

It depends on exactly how the graphics are drawn to the screen. It is not the fullscreen quality or the gaming nature of the application that could make it impossible for xvidcap. There have been reports that X-Wing Alliance through WINE e. g. works just fine. Problems typically arise around hardware acceleration like OpenGL. Those often need to be disabled to allow xvidcap to caputre the display. See above.

Is xvidcap able of capturing a running video?

Yes.
However, you need to disable hardware acceleration on your graphics adapter. Many video players make use of hardware acceleration. In such a case the individual frames of the video are not actually rendered/drawn within X11 memory. The rendering is delegated to the (faster) hardware of the graphics adapter. Xvidcap needs to capture the rendered image. Because there is no way for xvidcap to get it once it's on the graphics adapter, you absolutely need to disable hardware acceleration.
For mplayer e.g. you would use a command line like:

mplayer -vo x11

For RealPlayer go to "Extras->Preferences". There on the "Hardware" tab deslect "Use XVideo" (i. e. remove the check!).
One other thing you may need to disable is the use of Xdamage in xvidcap. Video players will normally not take the pain of painting in ways Xdamage recognizes (and it wouldn't normally make sense to.) But since they don't, xvidcap cannot rely on Xdamage to detect changes. Therefore, if you're on a platform that defaults to using Xdamage, disable it on the general tab of the preferences dialog.

Does xvidcap get the array of pixels from the xserver or off the video card's buffer?

xvidcap cannot at this point in time make use of hardware acceleration!
xvidcap can only get a frame from the X server either using plain X11 calls or Xshm (with shared memory, which requires client and server to be on the same machine).
The thing is that once the actual bitmap is on the frame buffer, I don't know how to get it at all, or even in a portable fashion. I've heard that AGP should offer ways, but then AGP slots don't seem to be the fashion anymore these days, anyway.
If you know how to get at a bitmap once it's rendered by the frame buffer and are confident that getting at it won't eat all the performance gain, DO TEACH ME!

back to top


#building

Building

After building xvidcap says "FFMPEG encoding not supported"

This means you didn't correcly build FFMPEG support into xvidcap. Read the INSTALL file and note that configure without any parameters will try to build libraries for libavcodec and libavformat from the bundled version. Keep an eye on the output generated by configure. If you see any of the following lines after configure has built the prerequisite libraries, the libraries have not successfully been built:

checking for av_rescale in -lavutil... (static?) ... no
checking for sws_scale in -lswscale... (static?) ... no
checking for avcodec_encode_video in -lavcodec... (static?) ... no
checking for av_write_header in -lavformat... (static?) ... no
checking for avcodec_decode_audio in -lavcodec... (static?) ... no

The build complains about being unable to findcommon.h

This is due to a bug in the build system for versions 1.1.2 or lower, please upgrade.
The workaround for the afflicted versions is: Remove all symlinks in the ffmpeg directory before trying a build with dynamically linked libavcodec/-format.

Why am I getting error about an "undefined reference to `pow'"?

This should only be happening with way old versions, please upgrade.
On some systems, to link to libpng you also need to link to libm. That should be guessed correctly for most systems by configure, but if you're getting this error, the following call to configure should help:

LDFLAGS="-lm" ./configure

back to top


#install

Installation

Why do you not provide packages for distribution XYZ?

Because I lack the time and/or the machines.
I mainly intend to provide a good source tarball.

On Solaris pkgadd complains about "no packages found"

The Solaris package is provided as a single file package stream (read man pkgtrans) and needs to be installed using the following commands:

gzip -d <KHBxvidcap-version>.pkg.gz
pkgadd -d <KHBxvidcap-version>

The usual "pkgadd -d . <packagename>" will not work.

How do I install the Fedora RPMS and how do they differ?

Notes on installing the Fedora RPMS for the 1.1.3 versions, which you shouldn't be using anymore:

  • gvidcap - comes with the GTK2 gui
  • xvidcap - comes with the X11 gui, only

They are conflicting packages. On Fedora go with gvidcap (xvidcap is intended for non-GTK2 OS`s).
Install the usual way:

rpm -i gvidcap-1.1.3-fc1.i386.rpm

Both packages require a recent version of ffmpeg (>= 0.4.8). This is easily obtainable from one of the Fedora repositories (look here, for example). If you want ffmpeg support statically linked, build the application from source.
The new RPMS for version 1.1.3 now come with the audio/video sync patch included which can otherwise only be obtained from CVS, as a source patch, or from more recent versions.

back to top


#usage

Usage

Why does the button to capture a single image not work for me?

This is usually a usage problem. The button for recording a single frame is sensitive during a paused recording session only! This means you cannot start a recording by pressing that button. The right way of doing it is:

  • Press Pause
  • Press Record
  • Press Capture Single Frame

Also note that this only makes sense when you're capturing to single-frame images, not when you're encoding to a video on-the-fly.

Capture fails with "Could not find audio grab device ..."

That's a message originating from FFMPEG and means there is a problem with accessing the audio grab device.
The reason is probably one of the following:

  • Your sound device is not OSS compatible (not very probable if you're on Linux)
  • There is no such device
  • You don't have access permissions to that device
  • You're using 1.1.2 and trying to encode to MS_MPEG4. That won't work with audio. Use a more recent version.

Why are the videos or single frames I capture always white or black?

Most probably you are trying to capture from an application that uses hardware graphics acceleration. Typical cases are 3D animations that use OpenGL. Xvidcap has no way of capturing that.
If you want to capture from applications like those, you need a switch to turn of the use of hardware graphics acceleration. That's not possible with all applications out there, though ... sorry.
If you are completely sure, this does not match your case, please submit a bug here.

Running xvidcap I get an error message saying "xvidcap: error while loading shared libraries: libpng.so.2: cannot open shared object file: No such file or directory"

This is a problem with the old debian package. You could try installing libpng2 and libpng10-0:

apt-get install libpng2 libpng10-0

The much preferred fix, however, would be installing a more recent version.

xvidcap hangs on starting a capture session. What can I do about it?

Chances are you are running a Linux distribution using libxcb. To determine whether that is the case, run:

ldd <path-to-xvidcap>/xvidcap | grep -i xcb

If that returns some libraries xvidcap will use xcb. Problem with that is just that at time of writing this there are loads of problems with libX11/libxcb interaction, esp. in multi-threaded applications. For just one example of such a bug, look here.
There are two things you can try:
1. Set the environment variable LIBXCB_ALLOW_SLOPPY_LOCK to 1. Testing seems to indicate that this makes xvidcap work most of the time unless you are using the "Capture Area follows Mouse Pointer" setting.

export LIBXCB_ALLOW_SLOPPY_LOCK=1
xvidcap

2. To get xvidcap to work reliably, you will need to use a version of libX11 with xcb disabled. That may not be trivial to find. Also, merely downgrading libX11 may break other applications depending on it.
For hardy I reccommend you download all the debs for your CPU from Bryce's testbed, then do:

mkdir /usr/local/libX11-noxcb
cd <directory-with-downloaded-libx11-noxcb-debs>
for i in libx11*noxcb*deb ; do dpkg-deb --vextract $i /usr/local/libX11-noxcb/ ; done
unset LIBXCB_ALLOW_SLOPPY_LOCK
export LD_LIBRARY_PATH=/usr/local/libX11-noxcb/usr/lib
xvidcap

The upstream libxcb developers are working on this issue and a future version will hopefully have this fixed.

back to top


#encoding

Encoding

Why do my videos recorded with xvidcap play back too fast?

This can have one of two reasons:

  1. Dropped frames:
The hardware you're on can't handle what you ask for. Try making the capture selection very small and see if the problem disappears. If not, it's probably (2), if it does, you can't capture at the frame size, image quality, and frame rate you selected. You can play around with those parameters until you find a combination that your system can handle. Make sure you watch (2). Another way of making the capturing lighter on your system is using the XDamage extension. This may or may not work for you. The results depend a lot on your window manager and the nature of the stuff you want to capture. If you're on a fairly conservative window manager and want to record normal application windows, chances are it will work alright and improve performance for you. Xvidcap will enable the use of XDamage by default on any window manager but compiz or beryl.
Perhaps, however you need a faster system. You can see dropped frames using xvidcap with a "-v" parameter. Note however, that writing the verbose output to tty will slow down xvidcap and may actually cause dropped frames.
  1. Wrong frame rate:
Some codecs don't support arbitrary frame rates. Selecting a frame rate of 10 with MPEG1, e.g., will capture 10 frames per second but playback will use 24 fps making the video go way to fast. Read the man page for what frame rates are supported where. The current UI should enforce valid frame rates, older versions might not.

How can I record videos for Windows Media Player compatibility?

With 1.1.2 there is only one way to do that: Chose MSMPEG4 as the video codec. Afterwards rename the file to an *.asf extension. You also must not record audio. Windows Media Player won't be able to play ASF files with an audio stream. This is due to a limitation in FFMPEG in that version.
With 1.1.3rc1 or higher you can select a video codec of MS_DIV2 in an AVI file. This will also support an audio stream. Note that MSMPEG4 has been renamed to MS_DIV3 in 1.1.3rc1.

How do I improve recorded audio quality?

Watch your mixer settings. If your microphone input gain is set too high, sound will get distorted.
From the Help Forum:
Quote:

  • Make sure the Recording function is on Volume (alsamixer calls it Master) if you're recording sounds produced
  • Set IGain at about 50% -- mine was set too high
  • Set PCM at around 70% -- again, mine was too high
  • After lowering the iGain (alsamixer calls it Capture), the sound quality is very close to the original.

back to top