New audio encoders can be added into MediaCoder easily now

Share with other users your experience in using MediaCoder.
Post Reply
stanley
Site Admin
Site Admin
Posts: 4135
Joined: Mon May 15, 2006 7:43 pm
Location: Sydney

New audio encoders can be added into MediaCoder easily now

Post by stanley » Fri Aug 08, 2008 1:57 am

Since build 4166, users can add new audio encoders or modify the generation rule of command line options by modifying mccodecs.xml and mccore.xml. The file mccodecs.xml is newly added in this build which contains necessary information to map MediaCoder's settings to the command line options of audio encoders, which in the past, is hard-coded in the EXE. In some time later, command line options of video encoders and muxers will be defined in the XML file the almost same way. The following is a segment of this XML file.

Code: Select all

<codecs>
  <audio>
    ...
    <encoder name="Vorbis">
      <keybase>audioenc.vorbis</keybase>
      <input type="pcm"/>
      <extname>ogg</extname>
      <verinfo begin="ERROR:" end="*"/>
      <path key=".path"/>
      <if stdin="true">
        <arg>-r -C $(Channels) -R $(SampleRate) -</arg>
      </if>
      <if stdin="false">
        <arg>$(SourceFile)</arg>
      </if>
      <arg>-o "$(DestFile)" --quiet</arg>
      <arg key=".resample">--resample</arg>
      <arg key=".downmix">--downmix</arg>
      <arg key=".minBitrate" prefix="-m"/>
      <arg key=".maxBitrate" prefix="-M"/>
      <if test=".mode" value="Quality">
        <arg key=".quality" ratio="0.01" prefix="-q"/>
      </if>
      <if test=".mode" value="Bitrate">
        <arg key=".bitrate" prefix="-b"/>
      </if>
      <arg key=".options"/>
      <if tagging="true">
        <arg>-t "$(Title)" -a "$(Artist)" -l "$(Album)" -N "$(Track)" -d "$(Year)" -G "$(Genre)"</arg> 
      </if>
    </encoder>
    ...
  </audio>
</codecs>
Some explanations of the tags.
<keybase>: It defines the base parameter node of of the audio encoder. All the parameter keys referred for this encoder later which started with a dot will be composed with the base key to form the final one.
<input>: This defines what kind of input does the audio encoder prefer. There are 3 types: pcm (feed encoder with pcm data), wav (feed encoder with pcm data and wav header), (feed encoder with input file name and let it decode) file. If not specified, default is wav.
<extname>: This specifies the output file extension.
<path>: This defines the key that contains the encoder path. All keys are defined in mccore.xml.
<arg>: This will append an argument in the command line. If "key" attribute is specified, the value of the key will be automatically referenced to form the final option.
<if>, <ifnot>: This tests the condition specified with attribute "test" and "value". Other useful attributes are: tagging (whether tags should be added), stdin (whether use stdin to feed data) channels , samplerate etc.

If you need more options to be supported by an existing encoder, first add the parameter keys in mccore.xml in some position and modify mccodecs.xml to add <arg> or other necessary tags. Remeber you can switch to expert UI mode so as to observe the change of command line on changed of MediaCoder parameters.
When things work together, things work.

Post Reply