Skip to content

Audio encoding

media.transcode.audio

Sapsan re-encodes audio tracks, for example G.711 from an IP camera, and preserves the stream timeline.

Output codecs

The media.transcode.audio feature includes encoding to the following output audio codecs:

Audio codec codec value
AAC {set: aac}
Opus {set: opus}
MP3 {set: mp3}

Configuration

source: {content: audio} selects all audio tracks. Use source: {exact: a1} for one track by its input ID.

streams:
  - name: camera
    inputs:
    - rtsp:
        url: rtsp://camera/stream
    transcoder:
      output:
      - source: !content audio
        codec: !set aac
        bitrate: 128000

Parameters

Parameter Description
source Selection rule for source audio tracks.
codec The target audio codec from the list above. codec: same preserves the source codec.
bitrate Target bitrate in bits/s.
if_missing In live streams, a rule with no matches creates no output; blank and substitute do not supply replacement media.

Use source: {language: eng} to keep selecting the language when the source codec changes. If the input codec matters too, use source: {language_codec: [eng, aac]}. See MBR source track selection for primary/backup examples and if_missing limitations. Check the audio tracks and codec in stream statistics, and listen to the result.