For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
StatusSupportDiscussionsLog inSign Up
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
  • Get started
    • Overview
    • Quickstart
  • Upload videos
    • Upload videos from device
    • Upload videos from a URL
    • Upload 4K videos
    • Speed up video processing
  • Playback and delivery
    • Play your videos
    • Embed a video in your app
    • Configure media quality levels
    • Enable MP4 Support for offline viewing
    • Create and manage playlists
  • Edit and transform videos
    • Add metadata to videos
    • Add a watermark to a video
    • Add an intro and outro to a video
    • Clip and trim videos
    • Merge and stitch videos
    • Remove unwanted video segments
  • Manage audio and subtitle tracks
    • Upload and play audio and subtitle tracks
    • Add subtitles to a video
    • Generate subtitles automatically
    • Add audio to a video
    • Replace a video's audio track
    • Normalize audio loudness
    • Overlay audio on a video timeline
  • Extract images from video
    • Create thumbnails from a video
    • Create GIFs from a video
    • Create timeline hovers from a video
  • Video security
    • Generate JWTs for secure media
    • Secure media access with JWTs
    • Restrict playback access
    • Set up DRM encryption
    • FairPlay DRM integration
  • VOD events
    • Media events
    • Transform media events
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Prerequisites
  • Key terms
  • Language code support (BCP 47)
  • Add an audio track
  • Update an audio track
  • Delete an audio track
  • Frequently asked questions
  • What’s next?
Manage audio and subtitle tracks

Add audio to a video

Manage multiple audio tracks for a video, including adding, updating, and deleting tracks to enable multi-language support.

Was this page helpful?
Previous

Replace a video's audio track

Replace a video’s audio track with a new file (for narration updates, background music, or localization) without re-editing the video.

Next
Built with

Reaching a global audience means offering audio in multiple languages, but re-encoding and re-uploading the entire video for each locale wastes time and storage. FastPix lets you attach, update, and delete audio tracks on an existing On-Demand Video through the /on-demand/{mediaId}/tracks endpoint. HLS manifests expose each track automatically, so viewers can switch languages in the player without any extra client-side work.


Prerequisites

  • A FastPix account with an active workspace (Activate your account)
  • Your Access Token ID and Secret Key from the FastPix dashboard → API Settings
  • An existing on-demand video and its mediaId
  • A publicly accessible audio file in MP3, AAC, WAV, or OGG format

Key terms

  • mediaId - The unique identifier FastPix assigns to every uploaded on-demand video.
  • trackId - The identifier FastPix returns when you add an audio track. Pass it back in update and delete calls.
  • languageCode - A BCP 47 language tag (for example, en, fr, es-419) that players use to label and select a track.
  • accessPolicy - public or private. Track operations inherit the parent media’s access policy.

Language code support (BCP 47)

FastPix follows BCP 47 language codes for audio and subtitle tracks. When you add or update a track, set languageCode in this format so HLS manifests expose the correct LANGUAGE attribute and players can surface an accurate language picker.

Examples:

  • en - English
  • en-US - English (United States)
  • fr - French
  • es-419 - Spanish (Latin America)
  • hi - Hindi

See the BCP 47 specification for the full list of primary language subtags.


Add an audio track

Send a POST request to attach a new audio track to an existing media. Pass the mediaId in the path and the audio file URL, type, and language in the request body. See the add media track reference for the full contract.

POST
https://api.fastpix.com/v1/on-demand/{mediaId}/tracks

Subscribe to the video.media.track.ready and video.media.track.created webhook events to know when the track is created and ready for playback.

Request body:

Request
1{
2 "tracks": {
3 "url": "https://static.fastpix.com/music-1.mp3",
4 "type": "audio",
5 "languageCode": "en",
6 "languageName": "English"
7 }
8}

NOTE

  • FastPix supports MP3, AAC, WAV, and OGG formats for audio tracks.
  • The url must point to a publicly accessible audio file.
  • Set languageCode using a BCP 47 tag for accurate localization.

Response example:

1{
2 "success": true,
3 "data": {
4 "id": "ce926a2b-5448-4d39-88ab-d33641379a45",
5 "type": "audio",
6 "url": "https://static.fastpix.com/music-1.mp3",
7 "languageCode": "en",
8 "languageName": "English"
9 }
10}

Store the returned id as the trackId, you need it for update and delete calls.


Update an audio track

Send a PATCH request to change a track’s source file or language metadata without creating a new trackId. See the update media track reference.

PATCH
https://api.fastpix.com/v1/on-demand/{mediaId}/tracks/{trackId}

Subscribe to the video.media.track.updated webhook event to know when the updated track is re-processed and ready.

Request body:

Request
1{
2 "url": "https://static.fastpix.com/music-2.mp3",
3 "languageCode": "fr",
4 "languageName": "French"
5}

NOTES

  • The new url must point to a valid, publicly accessible audio file.
  • Use the trackId of the track you want to update.
  • Set languageCode using a BCP 47 tag.

Response example:

Response
1{
2 "success": true,
3 "data": {
4 "id": "ce926a2b-5448-4d39-88ab-d33641379a45",
5 "type": "audio",
6 "url": "https://static.fastpix.com/music-2.mp3",
7 "languageCode": "fr",
8 "languageName": "French"
9 }
10}

Delete an audio track

Send a DELETE request to remove an audio track from a video. See the delete media track reference.

DELETE
https://api.fastpix.com/v1/on-demand/{mediaId}/tracks/{trackId}

Response example:

Response
1{
2 "success": "true"
3}

NOTES

  • Deletion is permanent and cannot be undone.
  • Provide the correct trackId for the audio file you want to remove.

Frequently asked questions

Which audio track does the player pick by default?

The original audio muxed into the source video stays the default. Tracks you add through this endpoint appear as alternate audio tracks in the HLS manifest, and most HLS-compatible players let viewers switch tracks from a language menu.

How do I switch audio tracks on the FastPix Player?

FastPix exposes each audio track in the HLS manifest with the LANGUAGE attribute set from languageCode. The FastPix Player and other HLS players render these as selectable options in the track menu with no extra configuration.

What language codes does FastPix accept?

FastPix accepts BCP 47 tags such as en, en-US, fr, de, es-419, and hi. Tags that do not match BCP 47 are rejected at track creation.

Can I replace the original audio instead of adding an alternate track?

Yes. Use Replace existing audio to overwrite the primary audio on a media. Use the track endpoints on this page when you want to keep the original and add additional language tracks.


What’s next?

  • Replace existing audio with new audio
  • Overlay audio at a specific timeline
  • API reference: Add media track
  • API reference: Update media track
  • API reference: Delete media track

For additional questions, reach out to the FastPix support team.