MediaCoder on the way to a distributive transcoder (Stanley posted on November 24th, 2011 )

Finally MediaCoder is stepping on its way to becoming a distributive transcoder. I decided to design a frame level distributing mechanism instead of file-level distributing. The system is made up of a master, which performs decoding and data distribution, and one or more agents, which receive raw video frame, encode them and send the encoded stream back to the master. Users will feel like still using a desktop version of MediaCoder, while the encoding is actually done on another one or more machines. This approach has several advantages:

  1. No need to expose the whole file to the encoding machine with OS file sharing.
  2. It’s possible to implement segmented + distributed transcoding
  3. The decoding is still done by a Windows box (where MediaCoder runs), which has better decoding capability. This also helps to unify the decoding standard in a distributed transcoding system.
  4. The transcoding agents need no storage for intermediate data during transcoding. The frames are transmited over LAN, encoded and send back over LAN.

However, nothing is perfect. The downsides are:

  1. A fast (Gigabyte) LAN is required. Otherwise, the transmission of raw video frame over LAN will be the bottleneck of the system
  2. The master will have heavy load if there are too many agents to be fed

Currently the finished work is still limited. The MediaCoder Agent is written from scratch and only supports x264 meanwhile. It’s OS portable already however and I decided to make it open-source. So that some one will help with the improvement and porting hopefully.

Here is what current implementation can do and the limitations:

  1. MediaCoder Agent wait for incoming connection from MediaCoder upon running
  2. When MediaCoder is put into the new “Distributive” mode, it will off-load video encoding to MediaCoder Agent running on the other machine or locally.
  3. During the transcoding in distributive mode, MediaCoder decodes video into raw frames, send the frames to the agent over TCP and wait for the agent to return encoded stream in the return channel
  4. MediaCoder Agent can literally run on any OS (32 or 64 bit) with x264 installed (in /usr/bin by default, the location can be altered in MediaCoder’s Settings dialog)
  5. Audio encoding is not off-loaded and still done locally
  6. Currently only x264 is tested and only a single agent is supported

Here are some instructions to make things work.

  1. Download and install latest MediaCoder 2011 build 5210  (link at the bottom).
  2. Changing task mode to “Distributive”
  3. Setting agent IP address (currently only one agent is supported)
  4. Tick “Agent Under Linux” if agent is running on Linux
  5. Alter the path of x264 if needed

  1. Install (compile or apt-get) x264 on the machine to run MediaCoder Agent
  2. Checking out the source code of MediaCoder Agent from SourceForge repository (yes I am back to again)
  3. Compile the source code and run ./mcagent and it’s ready to roll
  4. If you want to use MediaCoder Agent on Windows, it’s even easier. You will find mcagent.exe in MediaCoder’s installation folder after applying the build 5210 update mentioned above. You don’t need to deal with x264 as it’s just in the codecs folder.

  1. After setting up, just do the transcoding as you do normally, adding files, setting parameters and pushing the start button
  2. You will note that the encoder CPU usage is almost zero. That’s where the difference is. The encoding is totally off-loaded from your local CPU.
  3. Everything else is just the same as in the “normal” mode

  1. Here on the agent machine, it’s busily processing the video frame pushed from the master machine. In my case, the agent machine is a Ubuntu x64 box.
  2. I am testing with a 100M LAN which will definitely be the bottleneck of the system when processing HD video. So a Gigabyte LAN is highly recommeded.
  3. After all frames have been processed, the master will obtain the complete encoded elementary stream and mux with the audio to output the final product.

So here is it. If you like this new toy for transcoding, I hope you can try it and give me as many feedbacks as possible.

COMMENTS: Comments Closed

Comments are closed.