This is a good place to start, but transcoding from H264 to MPEG2 is going to lower the quality of the video a lot. As an alternative, you can try using x264 to lower the bitrate. Support is compiled into the current Arch release of FFMPEG, and FFMPEG should generate ISO compliant MPEG4 files (hopefully the version in the repos in new enough for that). Writing Matroska files right now isn't implemented, but you can use MKVToolnix to do that.