Skip to main content
Skip table of contents

Overriding Presets When Transcoding [VC UG]

Sometimes you want to override your presets when transcoding. This can be done with a set function, using the corresponding element names from XML. Say that you are starting with the following preset document: 

CODE
<TranscodePresetDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <format>mp4</format>
  <video>
    <codec>h264</codec>
    <bitrate>512000</bitrate>
    <scaling>
      <width>1280</width>
      <heigth>720</height>
    </scaling>
  </video>
  <audio>
    <codec>aac</codec>
  </audio>
</TranscodePresetDocument>

 and then you want to change width, height and codec, you can use the following code: 

CODE
preset.getVideo().getScaling().setWidth(480);
preset.getVideo().getScaling().setHeight(640);
preset.getVideo().setCodec("h264");

 If your preset document doesn't have the a <code>scaling</code> element set in the first place, you must create it in the Javascript code: 

CODE
var scaling = new com.vidispine.generated.ScalingType();
preset.getVideo().setScaling(scaling);
preset.getVideo().getScaling().setWidth(480);
preset.getVideo().getScaling().setHeight(640);

 Then, how do I find what get and set are connected to a specific XML attribute? Let's use the following audio preset as an example: 

CODE
<mix silence="true"/>

 The starting point here would be the API documentation, looking at the generated packages. Here we look at the TranscodePresetType, following that one to AudioTranscodePresetType, and then further to AudioTranscodePresetMixType. Also, you see that get AudioTranscodePresetType has a getMix(), that returns a List, so the code should look like: 

CODE
var mix = new com.vidispine.generated.AudioTranscodePresetMixType();
mix.setSilence(true);
preset.getAudio().getMix().add(mix);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.