Working with Audio

Audio layers function similarly to video layers but never appear visually on the canvas. They are entirely dedicated to the auditory mix.

Basic Audio Object

A basic audio layer requires an asset_id and a time definition. If the duration requested is longer than the source audio, the audio will simply end early unless you enable looping.

{
  "id": "bg-music",
  "type": "audio",
  "asset_id": "asset-music-1",
  "time": {
    "start_seconds": 0,
    "duration_seconds": 15
  }
}

Volume Control

You can control the mix of your audio layer using the volume property inside media_settings. Volume is a multiplier: 1.0 is original volume, 0.5 is 50% volume, and 0.0 is muted.

{
  "id": "voiceover",
  "type": "audio",
  "asset_id": "asset-vo-1",
  "media_settings": {
    "volume": 0.8
  }
}

Looping Audio

If you have a short music track (e.g., a 10-second loop) but your video composition is 60 seconds long, you can enable loop in the media_settings. The audio will repeat seamlessly until it reaches the layer's duration_seconds.

{
  "id": "looping-beat",
  "type": "audio",
  "asset_id": "asset-beat-1",
  "time": {
    "start_seconds": 0,
    "duration_seconds": 60
  },
  "media_settings": {
    "loop": true,
    "volume": 0.2
  }
}

Fades and Crossfades

You can explicitly add fade-in and fade-out animations to audio layers using fade_in_seconds and fade_out_seconds. Reel Forge will automatically ramp the volume smoothly.

{
  "id": "fading-music",
  "type": "audio",
  "asset_id": "asset-music-1",
  "time": {
    "start_seconds": 0,
    "duration_seconds": 10
  },
  "media_settings": {
    "fade_in_seconds": 2.0,
    "fade_out_seconds": 3.0
  }
}

The Full Audio Request Example

This example demonstrates how to add a quiet, looping background track to a 10-second composition.

curl -X POST https://api.reelforger.com/v1/videos/render \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "v1",
    "output": {
      "width": 1080,
      "height": 1920,
      "fps": 30
    },
    "assets": [
        {
          "id": "asset-music",
          "type": "audio",
          "url": "https://example.com/looping-beat.mp3"
        }
    ],
    "composition": {
        "timeline": [
          {
            "id": "bgm-layer",
            "type": "audio",
            "asset_id": "asset-music",
            "time": {
              "start_seconds": 0,
              "duration_seconds": 10
            },
            "media_settings": {
              "volume": 0.1,
              "loop": true,
              "fade_in_seconds": 1.0,
              "fade_out_seconds": 1.0
            }
          }
        ]
    }
  }'