Skip to content

Transcoding separate audio tracks

In some situations, it may be necessary to transcode input audio tracks separately, with different transcoding parameters. For example, when you capture video from a satellite, one audio track may be encoded with MP2A, and another one – with AC3. The AC3-encoded track has good quality and has not to be transcoded, however MP2A-encoded track should be transcoded to be used in browsers. Also, you may need to make two audio tracks with different parameters (e.g., bitrate) from one input track.

To transcode separate audio tracks, you can use the atrack option in the transcoder configuration. This option allows to specify an order number of an input track as an integer value or a string in a<N> format. For example, atrack=1 or atrack=a1 means the first input track.

All audio options specified in the configuration before the first atrack option are applied by default to all audio tracks. The options specified after the atrack option are applied to this particular track. If no options are specified after the atrack option, the output track will have the settings specified for all audio tracks.

Example for transcoding three input audio tracks with different parameters:

stream sample {
  input fake://fake;
  transcoder vb=1000k ab=copy acodec=aac atrack=1 ab=copy atrack=2 ab=64k atrack=3;
}

In this example, the first and the third input tracks will be transcoded with the original bitrate and the second track will be transcoded with the bitrate 64k.

Example for making two audio tracks from one input audio track:

stream fake {
  input fake://fake;
  transcoder vb=copy ab=64k acodec=ac3 atrack=1 ab=64k acodec=opus atrack=1;
}

In this example, transcoder will make two audio tracks from the first input audio track. The first output track will have the settings: ab=64k, acodec=opus. The second output track will have the settings: ab=64k acodec=ac3 (as these settings are applied to all audio tracks).