Search code examples
videoh.264mkvmatroskag729

Write h264 + g.711(g.722,g.726) to mkv


I am writing my own program for writing video and audio to .mkv container. I am successfully writing h.264 video in container with Codec_id V_MPEG4/ISO/AVC but i can't find Codec_id for g.7xx audio codecs in specification? How can i properly write g.711/g.722 to .mkv container?


Solution

  • It looks like MKV supports signaling Microsoft Audio Codec Manager (ACM) as A_MS/ACM. https://www.matroska.org/technical/specs/codecid/index.html

    You find details for setting up the data structures here:

    https://blogs.msdn.microsoft.com/matthew_van_eerde/2010/06/01/how-to-enumerate-audio-compression-manager-acm-drivers-on-your-system-spot-the-bug/

    You will be off the beaten path with H.264/[a-law,u-law,ADPCM] - so players may not play your MKV files. Consider using 16-bit linear PCM which should be a loss less conversion.