How to convert codecs in C#

This description demonstrates in a really simple manner how covert h.263 and h.264 codecs in C# . You can also learn about why is it useful, why you should use it and some background information about the compression process. To implement this example you must have Ozeki Camera SDK installed, and a reference to OzekiSDK.dll should be added to your Visual Studio project.

How does it work?

The program analyzes data for redundancies and repetitions. It then creates a new, smaller file, mathematically encoded in a different format. Decompressing the new file with the same program recreates the original.

H.264 is perhaps best known as being one of the video encoding standards for Blu-ray Discs; all Blu-ray Disc players must be able to decode H.264. It is also widely used by streaming internet sources, such as videos from Vimeo, YouTube, and the iTunes Store, web software such as the Adobe Flash Player and Microsoft Silverlight, and also various HDTV broadcasts over terrestrial, cable, and satellite.

Why should i use this?

In digital signal processing, data compression, source coding, or bit-rate reduction involves encoding information using fewer bits than the original representation. This way you can dramatically reduce the amount of network communication. Sending smaller packages of data means it will also arrive faster.


  • Less disk space (more data in reality)
  • Faster writing and reading
  • Faster file transfer
  • Variable dynamic range
  • Byte order independent

raw to h.264 and h.264 to raw
Figure 1 - Compressing raw format to h.264 and backwards

When should i use this?

When you are working with uncompressed images, or you want to recover the original data from a compressed image.


IsRunning - True if Converter is running, otherwise false

SourceFormat - Input format

ForceTranscode - If true it forces transcoding in all cases, even when the input and output formats are the same

OutputQuality - Output format

DestinationFormat - Output format



private set


Start() - This method start the mediahandler

Stop() - This method stop the mediahandler

Dispose() - Get rid of unmanaged resources

Related Pages


Below you can find the answers for the most frequently asked questions related to this topic:

  1. I have not managed to build the solution. How to solve it?

    • Please set the Target framework property of the project to .NET 4.0.
    • You should add the OzekiSDK.dll to the references of the solution.
    • Please import the missing classes.
  2. Why is the camera moving, when I am not using it?

    It is possible that someone else is also using the camera.

  3. Why cannot I turn the camera in bigger angle than the current?

    Because all camera have a limit in rotation.

More information