View Single Post
Old 11-08-2009, 10:55 AM  
PowerCum
CjOverkill
 
Industry Role:
Join Date: Apr 2003
Location: Woldwide
Posts: 1,328
Video encoding tips and tricks

Today I was speaking with one of my content providers and just showed him some of the resampled and processed "shit quality" videos he sold me for nuts some time ago. The guy was completely freaked with the quality so I decided to write some tricks we use here at Galaxy Media for video processing.
Don't expect me to detail the process, these are just raw guidelines that are followed here.


Bitrates:

Everyone knows that if you want to stream a 640x480 or better res video with decent quality you should go to 1.000 - 2.000 kbps bitrates. This assumption is no more true in most of the cases.
Using variable bitrate encoding with burst will allow you to match the same or very similar quality with 500 - 800 kbps bitrates. Just make sure that your VBR settings have enough burst to raise the bitrate when quality is really needed.
The more movement your video has the more bitrate burst it will need. For example a slow moving scene of a solo girl would need practically no burst while a scene with 15 people orgy all moving fast all over the screen jumping around like crazy rabbits would need relatively high burst.


Resolution and resolution resampling:

Converting 320x240 video to 640x480 is easy, but in the process you usually "lose" quality because the pixels convert into square clusters that don't look very good. In these cases applying some filters really cleans the scene and makes it looks like a native 640x480.
These filters are your friends in these cases: Smoothing filter, gama, contrast and brightness correction and noise reduction. A good combination of these + some extra bitrate burst during the high movement parts of the scene will usually do the work.
Take in mind that different resolutions will demand different bitrates. It's not the same to have 640x480 than a 768x576 resolution.


Resampling framerates:

Usually changing the original video framerate is not a good idea unless you want to adapt it to a specific media (mobile phones for example).
If you remove frames you will be removing data and will need less bitrate, but the video will look chunky. This will be even worse for high movement scenes because the video processor will just discard entire frames.
Adding framerate is also bad, but in the opposite way. Resampling an 15 fps video to 30 fps usually adds the same data twice converting the final result in a chunky playing video where most pixels are just big squares. Have you seen a hentai video where the male toon dick is pixelated? Think about that with real actors. Also the final result video will be almost twice bigger than the non resampled one and it's quality will be lower for a human observator


Filtering:

Most people think that video processing is the same as photo processing. They couldn't hit closer to the target and still miss it completely.
Most people love to add a sharpen filter to their processed videos like they do to their pics. That's usually a very bad idea because the slightest defect your video has becomes more accentuated. On high movement scenes it may even look like the video is being played chunky... just like badly encoded CGI efects on action films.
Instead of that you should use a noise reduction filter to eliminate most of the pixelated and borders imperfections. Then combine with brightness, contrast and gamma filters.
Having a good combination of these filters will allow you to lower the bitrate considerably (5 - 15%) losing some technical quality but not losing a human eye observer perceived quality.


Pixel depth:

The human eye practically doesn't distringuish between 32 and 24 bit pixel depth. On the image side, that's 20 - 25% less data and bitrate. Most videos can even be encoded at 16 bit pixel depth without losing quality to the human observer eye.


Sound:

Use same concept as the pixel depth. It's ok to have the sound encoded at 300 kbps, but if you go over 128 kbps most humans will not notice the difference. mp3 encoding at 96 kbps usually does a good work. With aac you can lower the bitrate even more.
Remember to add a sound normalization filter. When you lower the sound bitrate sample there will be moments where the sound volume will jump up and down. Adding a sound normalization filter solves that problem in 99% of the cases.


CUDA "turboprocessors":

A CUDA processor is a native GPU processing unit that can process video in sub real time. The most powerful ones can process a 30 minute scene is 2 or 3 minutes. It's basically a high end graphics card with a stream processor... like this one: http://www.nvidia.com/object/product..._c1060_us.html
The problem with cuda is that you are constrained to 4:3 and 16:9 resolutions and the lack of processing applications. Even that, it's relatively easy to code your own stream processing application that fits your needs and eliminate all these restructions.
The usual problem with the CUDA processing library (at least with the current one) is that it cannot apply filters optimally and the sound usually gets missadjusted a couple of seconds making the final result video funny to watch but not a worthy piece for production site.
Having a first stage of processing to separate the video from the sound, then applying the needed filters to the video part and streaming through the CUDA processor to get the final video with no sound solves the problem. You can process the sound and add it after that in a mixer program. In most cases this is faster than processing the video with just a CPU based video processing application. Also allows some real time transformations and testing on the video part that would take you hours to do on a normal video processing applcation.
CUDA only processed files are usually about 15% bigger than pure CPU or mixed processing results. If you count your bw usage in Gigabit/sec it's something really important to look at. With 1 Gbit line you could save 150 Mbps by using a mixed solution.


Some other day I could post tips about how to build your own CDN network for practically no money.
__________________
CjOverkill Traffic Trading Script
Free, secure and fast traffic trading script. Get your copy now
PowerCum is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote