---
updatedAt: 2025-06-18T06:23:37.000Z
agentTools:
  projectIndex: https://api.encoding.com/llms.txt
---

# Advanced Source Mapping

Media Source can be specified as complex set o parameters such as several URLs and audio streams mapping.

```xml
<?xml version="1.0"?>
<query>
    <userid>[UserID]</userid> <!-- required -->
    <userkey>[UserKey]</userkey> <!-- required -->
    <action>AddMedia</action> <!-- required -->
    <source>[SourceFile1]</source> <!-- required -->
    <source>
        <url>[SourceFile2]</url>
        <url>[AdditionalSourceFile2]</url>
        <audio_stream>
            <use_stream_id>[SourceMediaAudioStreamID]</use_stream_id>
            <natural_order>[yes|no]</natural_order>
            <language>[Language]</language>
            <channel>
                <id>[OutputChannelID]</id>
                <in>
                    <id>[SourceTrackID:SourceChannelID]</id>
                    <gain>[ChannelGainLevel]</gain>
                </in>
                <in>
                    <!-- Input channel params -->
                </in>
            </channel>
            <channel>
                <!-- Audio channel params -->
            </channel>
            <normalize>[yes|no]</normalize>
            <layout>[AudioLayoutName]</layout>
            <start>[StartTimecode]</start>
            <finish>[FinishTimecode]</finish>
            <duration>[Duration]</duration>
        </audio_stream>
        <!-- Multiple audio streams -->
        <audio_stream>
            <!-- Audio stream params -->
        </audio_stream>
    </source>
    <source>
        <url>[SourceFile3]</url>
        <!-- Source params -->
    </source>
    <format> <!-- required -->
        <!-- Format params --> 
    </format>
</query>
```
```json
{
    "query": {
        "userid": "[UserID]", // required
        "userkey": "[UserKey]", // required
        "action": "AddMedia",  // required
        "source": [ // required
            "[SourceFile1]", 
            {
                "url": [
                    "[SourceFile2]",
                    "[AdditionalSourceFile2]"
                ],
                "audio_stream": [
                    {
                        "use_stream_id": "[SourceMediaAudioStreamID]",
                        "natural_order": "[yes|no]",
                        "language": "[Language]",
                        "channel": [
                            {
                                "id": "[OutputChannelID]",
                                "in": [
                                    {
                                        "id": "[SourceTrackID:SourceChannelID]",
                                        "gain": "[ChannelGainLevel]"
                                    },
                                    {
                                        // Input channel params
                                    }
                                ]
                            },
                            {
                                // Audio channel params
                            }
                        ],
                        "normalize": "[yes|no]",
                        "layout": "[AudioLayoutName]",
                        "start": "[StartTimecode]",
                        "finish": "[FinishTimecode]",
                        "duration": "[Duration]"
                    }, 
                    {
                        //Audio stream params
                    }
                ]
            },
            {
                "url": "[SourceFile3]"
                // Source params
            }
        ],
        "format": { // required
            // Format params
        }
    }
}
```

| Parameter                           | Description                                                                                                                                          | Allowed Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Default Values |
| :---------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
| **use\_stream\_id**                 | Specify the source media stream ID.                                                                                                                  | Set of 2 non-negative integer numbers separated by colon sign<br/>e.g. **F**:**S**<br/>Where<br/> ***F** – File index (index of **\<url />** param in **\<source />** block)<br/>* **S** – Stream index in source file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | *none*         |
| **language**                        | Specify the track language.                                                                                                                          | A language code in 3 lowercase letters according to [ISO639-2](https://www.loc.gov/standards/iso639-2/php/code_list.php).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | *none*         |
| **Mapping Parameters**              | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **normalize**                       | Enable the renormalization output track to avoid clipping noise.                                                                                     | yes, no                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | *none*         |
| **layout**                          | Specify the output channels layout.                                                                                                                  | One of these channel layouts:<br/>mono — FC<br/>stereo — FL+FR<br/>2.1 — FL+FR+LFE<br/>3.0 — FL+FR+FC<br/>3.0-back — FL+FR+BC<br/>4.0 — FL+FR+FC+BC<br/>quad — FL+FR+BL+BR<br/>quad-side — FL+FR+SL+SR<br/>3.1 — FL+FR+FC+LFE<br/>5.0 — FL+FR+FC+BL+BR<br/>5.0-side — FL+FR+FC+SL+SR<br/>4.1 — FL+FR+FC+LFE+BC<br/>5.1 — FL+FR+FC+LFE+BL+BR<br/>5.1-side — FL+FR+FC+LFE+SL+SR<br/>6.0 — FL+FR+FC+BC+SL+SR<br/>6.0-front — FL+FR+FLC+FRC+SL+SR<br/>hexagonal — FL+FR+FC+BL+BR+BC<br/>6.1 — FL+FR+FC+LFE+BC+SL+SR<br/>6.1 — FL+FR+FC+LFE+BL+BR+BC<br/>6.1-front — FL+FR+LFE+FLC+FRC+SL+SR<br/>7.0 — FL+FR+FC+BL+BR+SL+SR<br/>7.0-front — FL+FR+FC+FLC+FRC+SL+SR<br/>7.1 — FL+FR+FC+LFE+BL+BR+SL+SR<br/>7.1-wide — FL+FR+FC+LFE+BL+BR+FLC+FRC<br/>7.1-wide-side — FL+FR+FC+LFE+FLC+FRC+SL+SR<br/>octagonal — FL+FR+FC+BL+BR+BC+SL+SR<br/>downmix — DL+DR | *none*         |
| **Output Audio Channel Parameters** | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **id**                              | Specify the output channel ID.                                                                                                                       | Channel number or one of these channel names:<br/>FL — front left<br/>FR — front right<br/>FC — front center<br/>LFE — low frequency<br/>BL — back left<br/>BR — back right<br/>FLC — front left-of-center<br/>FRC — front right-of-center<br/>BC — back center<br/>SL — side left<br/>SR — side right<br/>TC — top center<br/>TFL — top front left<br/>TFC — top front center<br/>TFR — top front right<br/>TBL — top back left<br/>TBC — top back center<br/>TBR — top back right<br/>DL — downmix left<br/>DR — downmix right<br/>WL — wide left<br/>WR — wide right<br/>SDL — surround direct left<br/>SDR — surround direct right<br/>LFE2 — low frequency 2                                                                                                                                                                                     | *none*         |
| **Input Audio Channel Parameters**  | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **id**                              | Specify input audio channel ID.                                                                                                                      | Set of 3 non-negative integer numbers separated by colon sign<br/>e.g. **F**:**S**:**C**<br/>Where<br/> ***F** – File index (index of **\<url />** param in **\<source />** block)<br/>* **S** – Stream index in source file<br/>\* **C** – Channel index in audio stream                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | *none*         |
| **gain**                            | Sepcify the input audio channel gain level.                                                                                                          | Float positive number from 0 to 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | *none*         |
| **natural\_order**                  | If set to *yes* then value of **\<use\_stream\_id />** will mean number of source's **audio** stream, not number of stream in all type streams list. | yes, no                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | no             |
| **Clipping Parameters**             | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **start**                           | Specify where the video clip should start.                                                                                                           | Non-negative float or timecode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | *none*         |
| **finish**                          | Specify where the video clip should end.                                                                                                             | Non-negative float or timecode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | *none*         |
| **duration**                        | Specify the duration of the video clip.                                                                                                              | Positive integer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | *none*         |
| **Audio Stream Parameters**         | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **Source Parameters**               | -                                                                                                                                                    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -              |
| **url**                             | Source File URL                                                                                                                                      | Valid URL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | *none*         |