Transcoding Profiles

 
A transcoding profile is a set of a transcoding options that are applied to different file types.  The profile to apply depends on the Transcoding Rules that are specified for the incoming request.  They are defined in the transcodingmap.xml file that is found in the iHomeServer installation directory.  iHomeServer ships with a default set of rules however advanced users are free to edit this file to implement custom transcoding options for any devices that require them.
 

Advanced Topic

Note that this is a very advanced topic that is for information only to users who want to try to create their own transcoding profiles.  Experience of both XML and ffmpeg is required; Bizmodeller technical support may not provide specific support for editing transcoding profiles.
 
The transcodingmap.xml file has the following structure:
 
<?xml version="1.0" encoding="utf-8"?>
<TranscodeMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Templates>
<TranscodeMap Id="template_wav_le" Name="16-bit PCM WAV LE">
        <Transcoder>ffmpeg</Transcoder>
        <Params>-i %IN% -c pcm_s16le -ac 2 -f wav temp.wav</Params>
<TranscodeMimeType>audio/L16;rate=44100;channels=2</TranscodeMimeType>
<DLNAContentFeatures>DLNA.ORG_PN=LPCM</DLNAContentFeatures>
<Async>
<ReadyTriggerFile>temp.wav</ReadyTriggerFile>
<ReadyTriggerTimeSeconds>1</ReadyTriggerTimeSeconds>
</Async>
</TranscodeMap>
 
...
 
<!-- further transcode maps defined here -->
 
  </Templates>
 
  <TranscodeMapGroups>
 
    <TranscodeMapGroup Id="dlna-transcode3" Name="Generic DLNA Audio (MP3 + WAV LE)"  Description="This profile transcodes transcodes M4A audio files to PCM WAV LE files">
      <TranscodeMaps>
<TranscodeMap Id="EBACFBEB-C725-423D-BD0B-72DA000DF7DD" InternalPriority="301" ExternalPriority="300" Extension="(m4a)" Inherit="template_wav_le"/>
      </TranscodeMaps>
    </TranscodeMapGroup>
 
...
<!-- further transcodemapgroups defined here -->
 
  </TranscodeMapGroup>
</TranscodeMapConfig>
 

TranscodeMap section

 
The first section of the file contains template transcode maps.  These are reusable blocks that define transcoding sub-profiles.  The example shown above in red shows a transcodemap that will transcode the input into a 16-bit LE format WAV file.  The XML element has the following structure:
 
<TranscodeMap Id="[unique ID that identifies the transcodeMap]" Name="[description that appears in iHomeServer]">
        <Transcoder>[name of the transcoder plugin that is used, usually 'ffmpeg']</Transcoder>
        <Params>[command line parameter, eg, for ffmpeg, the command line parameter passed to ffmpeg - see note [1] below]</Params>
  <TranscodeMimeType>[an optional string that will be sent as the transcoded mime type to web and dlna clients]</TranscodeMimeType>
<DLNAContentFeatures>[an optional string that can be added to the protocolInfo component of the res element - see note [2] below]</DLNAContentFeatures>
<AdditionalRESParams>[an optional string that will be added to the DLNA res element]</AdditionalRESParams>
<Async> <!-- an optional element that is used if Async transcoding occurs - see note [3] -->
<ReadyTriggerFile>[The filename whose presence dictates that transcoding has started and we can start streaming]</ReadyTriggerFile>
<ReadyTriggerTimeSeconds>[Number of seconds to wait between the file appearing and streaming to start]</ReadyTriggerTimeSeconds>
</Async>
</TranscodeMap>
 
Note [1]: Use the token %IN% where you require the original INPUT filename to be substituted dynamically.
Note [2]: The DLNAContentFeatures attribute will be prepended before the 'DLNA.ORG_OP' attribute in the res element for DLNA clients. i.e.
<res protocolInfo="http-get:*:[mimetype]:[DLNAContentFeatures];DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01500000000000000000000000000000>....</res>
Note [3]: TranscodingMaps can either output a piped stream or can transcode to a temporary file.  If using a piped stream then we refer to this as a Synchronous Transcode and no 'Async' element is required; if using ffmpeg ensure that the correct command line is used to output as a pipe (the filename should be '-').  If your transcoding requires a temporary file to be created, then you should ensure the ffmpeg command line includes a temporary filename for the output (iHomeServer will create a temporary unique working directory so you do not need to specify a path), eg temp.wmv for example.  Then use the 'Async/ReadyTriggerFile' element to tell iHomeServer the name of the temporary file.  iHomeServer will monitor the temporary working directory for this filename, and when it exists it will wait for 'ReadyTriggerTimeSeconds' in seconds and then start streaming the file to the client.
 

TranscodeMapGroup section

 
The TranscodeMapGroup section allows sets of TranscodeMap subprofiles to be grouped together into profiles.  Sub-profiles are mapped against file type extensions (using regular expressions) and this allows iHomeServer to choose the right TranscodeMap for the right file.  Multiple sub-profiles can be specified for the same extension filter.  In this case, a priority should be provided which will affect whether iHomeServer uses this transcode by default.
 
The TranscodeMapGroup XML element has the following structure:
 
<TranscodeMapGroup Id="[unique ID that identifies the MapGroup]" Name="[name that appears as an iHomeServer profile]"  Description="[description of this profile]">
          <TranscodeMaps>
<TranscodeMap Id="[unique ID for the transcode map instance]" InternalPriority="[internal priority]" ExternalPriority="[external priority]" Extension="[regular expression for matching the file extension]" Inherit="[name of the transcoding map to include]"/>
 
... additional TranscodeMaps can be added here ...
 
      </TranscodeMaps>
</TranscodeMapGroup>
 
Remember that the transcodingmap.xml only defines the available transcoding profiles and profile sub-profiles.  Once you have created a new profile, you must use the iHomeServer Management Console to define a Transcoding Rule that will map a profile (and its sub-profiles) to either a DLNA or Browser streaming request.