View Full Version : x264 - VLC - real-time high motion encoding
MysticX
24th February 2009, 16:39
Hello,
I need to stream live video data coming from a webcam using an application with libVLC and x264 as codec. The video stream is very prone to have high motion, and I'm having a hard time tweaking the 264 codec so that motion is well encoded and doesn't give blurry parts in the image or, at least, not for a long time.
Is there any tutorials out there or any clues you can provide me on that?
Thanks in advance!
cogman
24th February 2009, 16:53
The first step would be to set the bitrate to the average (or slightly below average) bitrate that your connection can handle. Once you've done that, the steps are simply adjusting settings until you max out the encoding machines speed. (IE, the FPS in are slightly lower then the fps out)
Some more experienced in streaming data might recommend better settings/have better suggestions. The musts (that I can think of) are Cabac, subme of 5 or higher, and a me of hex or better (umh is pretty good for most, and esa is the best but fairly slow).
After that, its just play with the settings trying to get the most for your processing power, 2-3 ref frames would be great, but might not be possible. badapt2 with 4 bframes would also help but might not be possible with your CPU.
If you really want to save bits though, try lowering the FPS and decreasing the resolution. At very least it will make allow you to encode faster, hence use more aggressive settings.
Dark Shikari
24th February 2009, 17:31
Your first step is probably to make sure that you're using the latest x264, since most VLC users seem to have a habit of using something from 2006.
Sagekilla
24th February 2009, 17:45
Note, you shouldn't actually use what your maximum bandwidth is. If you have a 2 megabit upload, then you should probably use something like 1500 - 1800 kbps.
MysticX
24th February 2009, 19:17
One of the main problem I'm encountering is that I have to use maximum 512 kbps bandwidth (since it has to fit on most high speed Internet connection here who has a max 800 kbps on upload), so, of course, quality is expected to be lower than if I was having a 1Mbps link.
Thanks for the suggestions on the motion estimator and settings, cogman! I've tried hex and umh so far, but didn't seem to notice any real difference. In fact, umh even made it worse in a particular situation. I tried some of the settings suggested, but I'll have to do more intensive testing.
I notice I haven't said all the parameters requirement I need... Doing low resolution 320x240 video @ 15 fps is a minimum, but if I could get to 640x480, I would be happy, though it mostly depend on the encoding machines of course!
Dark Shikari, do you know how I can check the x264 version used by VLC?
Any other suggestions anyone?
Sagekilla
24th February 2009, 19:33
320x240 @ 15 fps should be ridiculously easy.. x264 can do 1080p in real time on a quad core ;)
Check if your VLC has subme 9, if it does you probably have a recent revision.
MysticX
24th February 2009, 19:42
Check if your VLC has subme 9, if it does you probably have a recent revision.
Yes, subme can be set from 1 to 9.
LoRd_MuldeR
24th February 2009, 20:15
Dark Shikari, do you know how I can check the x264 version used by VLC?
x264 writes its version and all options to the bitstream.
Tools like AVInaptic or MediaInfo can unveil that information. You can even use a simple HexViewer ;)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.