Add audio to a video
Manage multiple audio tracks for a video, including adding, updating, and deleting tracks to enable multi-language support.
Manage multiple audio tracks for a video, including adding, updating, and deleting tracks to enable multi-language support.
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.
mediaIdmediaId - 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.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 - Englishen-US - English (United States)fr - Frenches-419 - Spanish (Latin America)hi - HindiSee the BCP 47 specification for the full list of primary language subtags.
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.
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:
NOTE
- FastPix supports MP3, AAC, WAV, and OGG formats for audio tracks.
- The
urlmust point to a publicly accessible audio file.- Set
languageCodeusing a BCP 47 tag for accurate localization.
Response example:
Store the returned id as the trackId, you need it for update and delete calls.
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.
Subscribe to the video.media.track.updated webhook event to know when the updated track is re-processed and ready.
Request body:
NOTES
- The new
urlmust point to a valid, publicly accessible audio file.- Use the
trackIdof the track you want to update.- Set
languageCodeusing a BCP 47 tag.
Response example:
Send a DELETE request to remove an audio track from a video. See the delete media track reference.
Response example:
NOTES
- Deletion is permanent and cannot be undone.
- Provide the correct
trackIdfor the audio file you want to remove.
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.
For additional questions, reach out to the FastPix support team.