Video encoding tips and tricks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PowerCum
    CjOverkill
    • Apr 2003
    • 1328

    #1

    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
  • Davy
    Confirmed User
    • Apr 2006
    • 4323

    #2
    Thanks for the tutorial.
    Why would you convert 320x240 to 640x480, though?
    I hope that's not what the content provider sold you?
    ---
    ICQ 14-76-98 <-- I don't use this at all

    Comment

    • Waiter
      Too lazy to set a custom title
      • Dec 2006
      • 15986

      #3
      thanks for sharing yo !!!
      The Best Web Hosting Plan ... Amerinoc.com / Unlimited Transfer / Unlimited Web Space / Unlimited Domains / Unlimited Email + Databases ... And much more at Amerinoc.com

      Comment

      • PowerCum
        CjOverkill
        • Apr 2003
        • 1328

        #4
        Originally posted by Davy
        Thanks for the tutorial.
        Why would you convert 320x240 to 640x480, though?
        I hope that's not what the content provider sold you?
        Because if you convert it properly you can gain quality and still have relatively low bitrate. Most people wouldn't bother with that, but we do.
        Having a HUGE library of scenes licensed from 1998 to now has left us with lots of formats bitrates and funky crap around. We are just reencoding and normalizing everything in our content library at the moment.
        Lots of amateur made content using the first digital cameras or still old Hi-8 and VHS cameras requires some extra resampling if you want to put it on a production site nowadays... even if it's a free tube with full scenes like in our case
        CjOverkill Traffic Trading Script
        Free, secure and fast traffic trading script. Get your copy now

        Comment

        • fatfoo
          ICQ:649699063
          • Mar 2003
          • 27763

          #5
          Nice long tutorial.
          Send me an email: [email protected]

          Comment

          • xenigo
            Confirmed User
            • Jan 2001
            • 8067

            #6
            Not trying to be an asshole, but I don't really see any "tips" here, as much as I see an explanation for these functions. Exception may be where you talked about pixel depth, and sound bitrate.

            You seem to like filters, but forgot to mention that each filter will double the length of encoding time.

            Comment

            • stickyfingerz
              Doin fine
              • Oct 2005
              • 24984

              #7
              Originally posted by PowerCum
              Because if you convert it properly you can gain quality and still have relatively low bitrate. Most people wouldn't bother with that, but we do.
              Having a HUGE library of scenes licensed from 1998 to now has left us with lots of formats bitrates and funky crap around. We are just reencoding and normalizing everything in our content library at the moment.
              Lots of amateur made content using the first digital cameras or still old Hi-8 and VHS cameras requires some extra resampling if you want to put it on a production site nowadays... even if it's a free tube with full scenes like in our case
              No offense, but how do you think you can gain quality by converting a smaller resolution to a larger one...

              Comment

              • PowerCum
                CjOverkill
                • Apr 2003
                • 1328

                #8
                Originally posted by stickyfingerz
                No offense, but how do you think you can gain quality by converting a smaller resolution to a larger one...
                No offense at all. It's all about what the human visitor may perceive as quality and not about the technical quality as pixels count and such.
                The concept is the same as when you interpolate a small pic and make it bigger by artificially raising it's resolution. You can just zoom that pic and have a very similar effect, but the human eye likes more the interpolated pic than the zoomed low resolution original.

                You can just resize a 320x240 video to 640x480 into the player, but then the player interpolation is made in real time, if the player interpolates at all, and usually ends with 4x4 pixel squares all over the video.
                Processing the video properly will "eliminate" these squares by interpolation, noise reduction and gamma correction. The square pixels will be still there because you cannot get more data to fill them if there is not, but the human visitor eye will barely notice them if it notices them at all.
                CjOverkill Traffic Trading Script
                Free, secure and fast traffic trading script. Get your copy now

                Comment

                • donnie
                  Confirmed User
                  • Jan 2003
                  • 1630

                  #9
                  Nice tutorial! Thank you very much

                  Just one stupid question... What software do you actually use for encoding?

                  Comment

                  • PowerCum
                    CjOverkill
                    • Apr 2003
                    • 1328

                    #10
                    Originally posted by donnie
                    Nice tutorial! Thank you very much

                    Just one stupid question... What software do you actually use for encoding?
                    Custom made CUDA encoding stuff, ffmpeg, Sorenson Squeeze and Loiloscope.
                    CjOverkill Traffic Trading Script
                    Free, secure and fast traffic trading script. Get your copy now

                    Comment

                    • stickyfingerz
                      Doin fine
                      • Oct 2005
                      • 24984

                      #11
                      Originally posted by PowerCum
                      No offense at all. It's all about what the human visitor may perceive as quality and not about the technical quality as pixels count and such.
                      The concept is the same as when you interpolate a small pic and make it bigger by artificially raising it's resolution. You can just zoom that pic and have a very similar effect, but the human eye likes more the interpolated pic than the zoomed low resolution original.

                      You can just resize a 320x240 video to 640x480 into the player, but then the player interpolation is made in real time, if the player interpolates at all, and usually ends with 4x4 pixel squares all over the video.
                      Processing the video properly will "eliminate" these squares by interpolation, noise reduction and gamma correction. The square pixels will be still there because you cannot get more data to fill them if there is not, but the human visitor eye will barely notice them if it notices them at all.
                      I guess you have a sample of this then? Its not going to "increase" the quality I just don't buy that. You may make a larger version that is very viewable and acceptable, but the quality can't get better.

                      Comment

                      • xenigo
                        Confirmed User
                        • Jan 2001
                        • 8067

                        #12
                        Originally posted by stickyfingerz
                        I guess you have a sample of this then? Its not going to "increase" the quality I just don't buy that. You may make a larger version that is very viewable and acceptable, but the quality can't get better.
                        Dude, increasing the resolution won't by itself help... you gotta increase the bitrate, too.

                        Come on man... you know that.

                        Comment

                        • Les Grossman
                          So Fucking Banned
                          • Sep 2009
                          • 1012

                          #13
                          Nice post. Thanks.

                          Comment

                          • jay23
                            Confirmed User
                            • Jun 2003
                            • 1444

                            #14
                            Watch this video

                            http://tv.adobe.com/watch/max-2009-d...o-using-flash/

                            I consider this guy to be the best video encoder in the planet.

                            Comment

                            • grumpy
                              Too lazy to set a custom title
                              • Jan 2002
                              • 9870

                              #15
                              thanks for the info although one point, we set bitrate to 2500 for hd

                              sample link
                              mms://62.204.69.107/Storage3/demo_169_2500.wmv
                              Last edited by grumpy; 11-08-2009, 11:39 AM.
                              Don't let greediness blur your vision | You gotta let some shit slide
                              icq - 441-456-888

                              Comment

                              • Barefootsies
                                Choice is an Illusion
                                • Feb 2005
                                • 42635

                                #16
                                Good info.

                                Jimmy Gunn has some great advise as well. He knows his shit toe be sho.

                                Bookmarked.

                                Should You Email Your Members?

                                Link1 | Link2 | Link3

                                Enough Said.

                                "Would you rather live like a king for a year or like a prince forever?"

                                Comment

                                • Pixelbucks Eric
                                  Confirmed User
                                  • Nov 2008
                                  • 496

                                  #17
                                  bookmarking, just in case
                                  New Program! http://www.pixelbucks.com | ICQ: 369055569

                                  Comment

                                  • alias
                                    aliasx
                                    • Apr 2001
                                    • 19010

                                    #18
                                    Originally posted by PowerCum
                                    Because if you convert it properly you can gain quality and still have relatively low bitrate. Most people wouldn't bother with that, but we do.
                                    Having a HUGE library of scenes licensed from 1998 to now has left us with lots of formats bitrates and funky crap around. We are just reencoding and normalizing everything in our content library at the moment.
                                    Lots of amateur made content using the first digital cameras or still old Hi-8 and VHS cameras requires some extra resampling if you want to put it on a production site nowadays... even if it's a free tube with full scenes like in our case
                                    Nice, thanks for the tips. I have been doing 320x240 at 900 bitrate for mobile.
                                    https://porncorporation.com

                                    Comment

                                    • TheSenator
                                      Too lazy to set a custom title
                                      • Feb 2003
                                      • 13330

                                      #19
                                      Here is a Flash bitrate calculator.

                                      http://www.adobe.com/devnet/flash/ap...tor/index.html
                                      ISeekGirls.com since 2005

                                      Comment

                                      Working...