Yes - they are published standards, and if you want to implement them yourself, you can (probably) do it in (almost) and programming language. C++ and C# would both handle it well (though C# may not be as fast as native C++ code would be).
In both cases you have a lot of reading to do! Start here:
http://en.wikipedia.org/wiki/.mpg[
^]
http://en.wikipedia.org/wiki/JPEG[
^]
But you will probably need to follow at least some of the references for each.