[x264-devel] h.264 encoding live stream from a web cam

Jason Garrett-Glaser darkshikari at gmail.com
Mon Aug 24 00:45:02 CEST 2009


On Sun, Aug 23, 2009 at 3:36 PM, i-love-spam<i-love-spam at yandex.ru> wrote:
> Hello,
>
> I trying to encode from a web cam and I have a couple of problems/questions:
>
> 0) it seems that my cpu can't do real time encoding of web cam video. Is my cpu no good, is that property of video from a so-so quality web cam (mosquito noise etc) or it's my config of x264 isn't good (I'll post the code at the bottom of the message)?
> 10fps at CIF takes 30% cpu on a dual core athlon 64 x2 3800+ (I manually limit to 10fps for testing).
> if I try to use 640x480 then I already can't do real time encoding even if I enable threading.
> I'm getting approximately 8.5fps with 95+% of cpu load (both cores).
> I'm using ffmpeg built with x264. From all the post all over the web I'm seeing that most of the users transcode a DVD movie in half duration of the movie itself; so I just wanted to make sure that my results aren't totally broken.

You should use the x264 library directly, not ffmpeg, if possible.

x264's CPU usage depends on the encoding settings you use; see the
presets in x264.c for examples.  --preset ultrafast, for example, is
over 100 times faster than --preset placebo.

Additionally, you may want to make sure that you didn't compile
without the assembly code enabled.

> 1) x264 and threading: I enabled threading and it works, but I have one major complain about that.
> I'm getting 8fps and for each frame it seems that there is a thread started and terminated, so that in debugger of visual studio I see tons of useless messages like:
> ..
> The thread 'Win32 Thread' (0x1ba4) has exited with code 0 (0x0).
> The thread 'Win32 Thread' (0x1258) has exited with code 0 (0x0).
> The thread 'Win32 Thread' (0xd08) has exited with code 0 (0x0).
> ..
> Can I make x264 not terminate, and keep the thread and use mutexes or events to signal new tasks? If there is not such code in x264, can you direct me where should I look for threading code so I change it for my build, otherwise x264 makes my debug output unreadable.

Tell your debugger to ignore thread terminations, or pipe the output
to "grep -v "Win32 Thread".

> and one small question: what's that project direct264 and what's the difference? It seems that x264 doesn't compile out of the box on MSVC

MSVC is not a supported compiler; use GCC or ICC.  Direct264 is an
unsupported fork of x264 for use as a DirectShow filter.

Dark Shikari


More information about the x264-devel mailing list