Hello all you Influxians out there, we have been receiving some requests on how to encode various files into different formats, so we decided to give a quick, basic tutorial on how to encode a video through the program MediaCoder.

You will need to download and install the program MediaCoder from the following:

http://www.mediacoderhq.com/dlfull.htm (Note: Please do not download Video Converter, it is just an ad on the page, download the 32 bit or 64 bit depending on your Version of Windows)

So let’s get started with this tutorial!

First we will start off with a picture of what you should see when you launch MediaCoder:

In the next image, we have uploaded/added a new video (Please note for this example, we just uploaded an mp4 file, you can upload any type of video format)

  1. Notice that there are checkmark boxes for each of the threads (cores + Hyper threading threads) available on your machine.  I tend to leave a couple unchecked in case some background tasks on the computer need to go or so I can use my computer while encoding.
  2. There is a drop down menu for both encoding and decoding for Video and Audio.  If I wanted I could assign two threads for each process of 2 for video encoding, 2 for video decoding, and 1 for audio encoding and another one for audio decoding.  It is up to you how you want to set them, although the default is to use all threads for all stages.

———————–

1.  Here you select whether or not to enable video processing at all.  ID:0 refers to the first and in this case only video track in the file we put as the source.

2.  Even though there are multiple drop down menu items for the Video Bit rate (Such as Buff size, etc.) I wouldn’t recommend using them unless you’re an advanced user.  If you have Video Bit rate selected you just enter the streaming bit rate in KBPS.  Make sure this is about 150Kbps below your peak streaming bandwidth for your Influxis Account!

3. Rate Mode :  For Influxis and online video streaming in general you should use Constant Bit rate for the Rate Mode.  This ensures that the file streams roughly the same amount of bytes/second so that fluctuations on scene changes in Variable Bit Rate(VBR) or 1 and 2 pass mode does not cause your internet, network card and computer to change how it is currently consuming the video – hence a smoother playback.  Additionally in VBR mode temporary spikes in video data can temporarily exceed (sometimes every second or two) the users maximum download speed available to them and cause stuttering.

Format:  This is where you start getting a lot of options.  Make your selection, you can do Flash Video, H.264, VP8, Theora and more.  You can use this to encode content from FLV to MPEG-4, WebM, and OGV and back.

Encoder:  Make sure you select Auto unless you are an advanced user.  Some Encoders can only encode certain formats so unless you want to play around with the different encoders I would suggest using Auto.  Earlier I was using the Intel Encoder (Which you can use if you have a Sandy bridge processor).  Now that I selected Auto it selected the x264 encoder for me, and the menu on the right-hand side changed to make sure the correct options are in front of me.  Don’t click out of the x264 tab or the tab for your encoder you selected or that was auto-selected for you as each tab is different settings for a different encoder.

Source:  This is where you select the decoder.  I would just leave this on Auto.

4.   Since we are in this example encoding to MPEG-4, I will discuss the encoding parameters of the x264 encoder.

Profile:  You can leave this auto selected but you can use this chart at the following link to estimate the exact profile and level you will need.  Different ones require more processing power from the person viewing it – and can cause poor playback performance from older / lower powered machines.

Baseline: This is the most basic encoding for x264 and will be the easiest to decode for the client.  This is ideal for phones, tablets, iPods and other low powered media devices.

Main:  This is the average profile people use.  It represents a good blend of advanced encoding to help reduce blocking and compress data even further granting a better quality for a lower bitrates.

High:  If you’re only hitting desktop machines I wouldn’t worry about using this profile.  I like to use this when I can.

Level:  The level will correspond to what sort of video bit rate you will be using.  Refer to the chart to know which one to set, or use Auto.

*A warning about using Auto for Profile and Level:  It usually will encode to High and level 5.1 or something above what is needed but I wouldn’t worry about it unless you’re having problems with the encoded content during playback.

Preset:  This will let you have the B-frame method, Sub pixel motion estimation and motion estimation algorithm selected for you.  If you review at this chart here you can get an idea of various Motion Estimation methods available and their strong / weak points.

Tune:  We aren’t certain exactly what this does, so we would advise to leave it.

GOP:  Group of Pictures AKA Key Frames.  The selection means make 30 key frames for every 90 frames that are processed.  If you divide the first into the second you will get the key frame interval of the encoded content.  The closer to 1 you get the larger the file will be; however the more resilient the streaming will be to internet fluctuations and color loss from scene changes.  Colors will be brighter and more vivid the lower the interval.  The lowest you can go is a 1:1 ratio.

B-Frames:  B-frames are both forward and backward predicting.  You should use more of them to help compensate for longer key frame intervals.  B-frames don’t increase the size of the file significantly and will require more decoding processing from the client.  A B-frame will use the key frame that last came through and the upcoming one to determine color data for that frame.  Otherwise a p-frame will often be there which uses only the prior key frame.

Reference Frames: This is more advanced, leaving at 2 is a good idea for now.

————————

First of all before I go any further make sure that the TASK MODE (top right green box) is set to Normal.  Earlier I had demux on.  You can change what you’re doing with Task Mode.  I had demux earlier to strip out audio and video streams into separate files.

For box one you have the Format section.  I use LC-AAC a lot which is basically just AAC.  You can use HE-AAC v1 and v2 as well.  They have better quality sound at lower bitrates but not all decoders support it yet.  If the audio does not need to be encoded, such as you are just trying to lower the video bit rate, you can select the copy audio button rather then re-encoded something that doesn’t need to be.

For box two you can resample the audio sampling rate, so if you want to up-sample or de-sample this is where you do it.

For box three you will want CBR just like you have on the Video tab.  In this case the audio of the source file is 64 kbps so I will use that as my CBR bit rate for the LC-AAC audio.  If you didn’t know LC means Low Complexity and HE means High Efficiency.

—————————–

Now the last tab you will need to set is the container tab.  All the other tabs are for more advanced stuff.  You can mess with the picture and sound tab, they are rather self-explanatory.  If you have any questions definitely ask on our Get Satisfaction forum!

For box one, Container, you will in this case want to select MP4.  If you are encoding to Flash Video and Speex / mp3 Audio you will want FLV as the container.  If you are doing VP8 and Vorbis you will want the WebM container for example.

Now notice the output folder.  Make sure it is set to where you want the encoded file to be dumped to.

Now start the encoding process by pressing the Start button at the top, and when it is done you have a fresh MP4 ready for flash streaming!

If you have any questions, let us know!

~Matthew Wall

One Response to “Encoding Videos through MediaCoder”

  1. Paul Doyle

    thanku for a great insight into mediacoder

    Reply

Leave a Reply

Current day month ye@r *