Learn · Developers

Convert audio to video with an AI generated image

Contents

Do you have an audio clip that you want to turn into a shareable video? Perhaps you want to add a visual element to your podcast, voice over, or lecture. Or you want to convert your audio into video content for social media.

This guide will walk you through how to create a video from an input audio file. We’ll begin by generating a transcript of the audio file, and use that transcript to create an image prompt. Then, we’ll send one render request that generates an image from that prompt and puts the audio and image together into a video.

About Shotstack and the Ingest and Edit APIs

Shotstack is a cloud-based video editing platform. It’s designed to make it convenient for developers to automate video editing at scale. Shotstack provides various APIs, including the two we will use in this tutorial: the Ingest API and the Edit API.

We will use the Ingest API to generate a transcript of the audio. The Edit API then generates the background image with AI and puts the video together, in the same render.

Requirements

To follow the steps outlined in the guide, you’ll need the following:

  • A Shotstack API Key. Get one when you sign up for a free account.
  • Basic understanding of using the command line to run curl requests.

Rendering and AI image generation use credits. See pricing for the rates.

The following covers a step-by-step process of how to convert an audio file into a video with a background image.

Getting the transcript of the audio

For this guide, we will be using an audio excerpt of a financial podcast:

The audio needs to be available somewhere online, so we have uploaded it to the following URL: https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/audio/financial-podcast.mp3.

The next step is to send a POST request to the Ingest API to generate a transcript of the audio. The request should contain a JSON payload with details like the input audio’s URL and the transcription format. In this case, we’re using the SRT format.

Run the curl command below in your terminal to generate an SRT file from the audio. Replace SHOTSTACK_API_KEY with your API key.

Bash
curl -X POST \
    -H "Content-Type: application/json" \
    -H "x-api-key: SHOTSTACK_API_KEY" \
    https://api.shotstack.io/ingest/v1/sources \
    -d '
{
    "url": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/audio/financial-podcast.mp3",
    "outputs": {
        "transcription": {
            "format": "srt"
        }
    }
}'

If the request succeeds, you should see a response like the one below. Take note of the id. We will use it in the next step.

JSON
{
    "data": {
        "type": "source",
        "id": "zzz01m70-epcjx-71ym6-87z8g-9ns8mc"
    }
}

Getting the status of the audio transcription

Wait for a few seconds for the audio transcription process to complete. Then run the command below to send a GET request to the API. This will retrieve the generated SRT file.

Again, make sure to replace SHOTSTACK_API_KEY with your API key. And replace ID with the id from the previous JSON response.

Bash
curl -X GET https://api.shotstack.io/ingest/v1/sources/ID \
    -H 'Accept: application/json' \
    -H 'x-api-key: SHOTSTACK_API_KEY'

You should see a response with relevant details about the generated file. It’s going to look similar to this:

JSON
{
    "data": {
        "type": "source",
        "id": "zzz01m70-epcjx-71ym6-87z8g-9ns8mc",
        "attributes": {
            "id": "zzz01m70-epcjx-71ym6-87z8g-9ns8mc",
            "owner": "5ca6hu7s9k",
            "input": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/audio/financial-podcast.mp3",
            "source": "https://shotstack-ingest-api-v1-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzz01m70-epcjx-71ym6-87z8g-9ns8mc/source.mp3",
            "status": "ready",
            "outputs": {
                "transcription": {
                    "status": "ready",
                    "url": "https://shotstack-ingest-api-v1-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzz01m70-epcjx-71ym6-87z8g-9ns8mc/transcript.srt"
                }
            },
            "duration": 67.38,
            "created": "2026-11-09T15:26:41.757Z",
            "updated": "2026-11-09T15:26:54.007Z",
            "extension": "mp3",
            "filesize": 1086759
        }
    }
}

Note: You may see waiting, processing or another status for the status parameter under outputs.transcription. If that’s the case, retry the same GET request until the status reads ready.

When the status is ready, the response will include a URL to the output SRT file. For our example, the URL is:

Text
https://shotstack-ingest-api-v1-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzz01m70-epcjx-71ym6-87z8g-9ns8mc/transcript.srt

The podcast audio transcription

Below is the transcript of the example podcast audio.

Text
1
00:00:00,170 --> 00:00:02,670
Nutrition was launched just over a year ago,

2
00:00:02,840 --> 00:00:03,240
um,

3
00:00:03,360 --> 00:00:06,040
as part of Black Rock's Sustainable Thematic Suite,

4
00:00:06,320 --> 00:00:07,570
and I've been named on it,

5
00:00:07,680 --> 00:00:07,840
uh,

6
00:00:07,920 --> 00:00:09,510
since the start of this year.

7
00:00:09,880 --> 00:00:14,990
And the fund's mandate is to invest in anything related to,

8
00:00:15,200 --> 00:00:15,720
um,

9
00:00:16,010 --> 00:00:17,880
food and beverage consumer trends.

10
00:00:18,000 --> 00:00:20,070
And our job is to,

11
00:00:20,320 --> 00:00:20,440
uh,

12
00:00:20,560 --> 00:00:20,800
one,

13
00:00:20,960 --> 00:00:23,230
make sure that the fund invests in those

14
00:00:23,430 --> 00:00:24,280
faster-moving,

15
00:00:24,400 --> 00:00:24,640
um,

16
00:00:24,760 --> 00:00:25,320
rivers.

17
00:00:25,430 --> 00:00:26,010
Within that

18
00:00:26,220 --> 00:00:27,300
overall thematic,

19
00:00:27,540 --> 00:00:28,290
but also,

20
00:00:28,340 --> 00:00:28,730
uh,

21
00:00:28,780 --> 00:00:31,420
to abide by our sustainability mandate,

22
00:00:31,740 --> 00:00:35,170
which is to ensure that at least 70% of the fund

23
00:00:35,380 --> 00:00:38,290
is investing in companies which align with

24
00:00:38,380 --> 00:00:41,020
the United Nations Sustainability Development Goals.

25
00:00:41,770 --> 00:00:42,050
Um,

26
00:00:42,170 --> 00:00:43,380
so it's important,

27
00:00:43,570 --> 00:00:43,850
um,

28
00:00:43,970 --> 00:00:46,550
and critical that the companies that we invest in

29
00:00:46,880 --> 00:00:47,450
broadly,

30
00:00:47,520 --> 00:00:48,080
um,

31
00:00:48,530 --> 00:00:51,550
are helping the world move towards a more sustainable

32
00:00:51,810 --> 00:00:52,490
food chain.

33
00:00:52,730 --> 00:00:53,090
And,

34
00:00:53,170 --> 00:00:53,650
of course,

35
00:00:54,210 --> 00:00:55,110
plant-based and,

36
00:00:55,250 --> 00:00:55,690
um,

37
00:00:55,930 --> 00:00:57,130
some of the other topics that we're going to

38
00:00:57,130 --> 00:01:00,130
talk about today are a really big piece to it

39
00:01:00,410 --> 00:01:00,880
because

40
00:01:01,010 --> 00:01:04,640
the food chain is possibly one of the single most polluting

41
00:01:04,989 --> 00:01:05,720
pieces of

42
00:01:05,850 --> 00:01:06,530
humankind.

Using ChatGPT and the transcription to generate an image prompt

You’ve now successfully generated a transcript of the audio. Copy and paste the content of the transcript into ChatGPT. Ask ChatGPT to use the transcript to create a prompt to generate an image via an API call to a text-to-image service.

Here is an example prompt you can use:

Text
Use the content of an SRT transcription file, pasted below, to write a prompt to generate
an image using an AI text-to-image service:

CONTENT_OF_SRT_FILE

Replace CONTENT_OF_SRT_FILE with the transcript we generated previously.

Below is the response we got from ChatGPT using the prompt above:

Text
"A world map with highlights on areas with sustainable food production practices. Emphasize
plant-based agriculture and companies that align with the UN Sustainable Development
Goals. Include a flowing blue river representing fast-moving trends within the sustainable
food chain."

Let’s use the prompt we got from ChatGPT to generate the image in the next step.

Note: if you want to automate this step you could use the OpenAI API to generate the prompt. This article to video guide does something very similar.

Generating the image and the video in one render

Almost set! What’s left is to generate an image from the prompt and put the audio and image together. The Edit API does both in one render: an image asset with a prompt and a model is generated during the render, then edited into the video.

Create a new file named edit.json and paste the JSON below into it. The prompt is the one ChatGPT wrote for us, with “No text or labels.” added at the end so the image has no lettering on it. The audio asset uses the URL of our podcast MP3 file.

JSON
{
    "timeline": {
        "background": "#000000",
        "tracks": [
            {
                "clips": [
                    {
                        "asset": {
                            "type": "image",
                            "prompt": "A world map with highlights on areas with sustainable food production practices. Emphasize plant-based agriculture and companies that align with the UN Sustainable Development Goals. Include a flowing blue river representing fast-moving trends within the sustainable food chain. No text or labels.",
                            "model": "nano-banana-2",
                            "options": {
                                "aspectRatio": "16:9"
                            }
                        },
                        "start": 0,
                        "length": "alias://podcast",
                        "effect": "zoomIn"
                    }
                ]
            },
            {
                "clips": [
                    {
                        "alias": "podcast",
                        "asset": {
                            "type": "audio",
                            "src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/audio/financial-podcast.mp3",
                            "volume": 1
                        },
                        "start": 0,
                        "length": "auto"
                    }
                ]
            }
        ]
    },
    "output": {
        "format": "mp4",
        "resolution": "sd",
        "poster": {
            "capture": 1
        }
    }
}

Here is what each part does:

  • The image clip is generated from the prompt with the nano-banana-2 model, in a 16:9 shape to fit the video. "length": "alias://podcast" makes it last as long as the podcast, and the zoomIn effect adds a slow zoom.
  • The audio clip has "alias": "podcast" and "length": "auto", so it plays the whole file. You don’t need to know how long the audio is.
  • output.poster saves a still from the first second of the video, which you can use as a thumbnail.

Then run the following command to send a POST request to the Edit API. Note that we’re using the content of the edit.json file as the payload using the curl -d @edit.json argument.

Bash
curl -X POST \
    -H 'Content-Type: application/json' \
    -H 'x-api-key: SHOTSTACK_API_KEY' \
    -d @edit.json \
    https://api.shotstack.io/edit/v1/render

Here is an example of the response you will get back from the API.

JSON
{
    "success": true,
    "message": "Created",
    "response": {
        "message": "Render Successfully Queued",
        "id": "ba4cbd7c-62ed-4eec-8d02-e2973514ab08"
    }
}

Getting the video render status

Wait a few seconds, then run the following command to get the video URL. While the image is being generated, the status is generating.

Replace SHOTSTACK_API_KEY with your API key and ID with the id received in the previous JSON response.

Bash
curl -X GET \
    -H 'x-api-key: SHOTSTACK_API_KEY' \
    https://api.shotstack.io/edit/v1/render/ID

Once the status is done, you will receive a response similar to this:

JSON
{
    "success": true,
    "message": "OK",
    "response": {
        "id": "ba4cbd7c-62ed-4eec-8d02-e2973514ab08",
        "owner": "5ca6hu7s9k",
        "plan": "payg",
        "status": "done",
        "error": "",
        "duration": 67.38,
        "billable": 67.38,
        "renderTime": 5873,
        "credits": 1.62,
        "url": "https://shotstack-api-v1-output.s3-ap-southeast-2.amazonaws.com/5ca6hu7s9k/ba4cbd7c-62ed-4eec-8d02-e2973514ab08.mp4",
        "poster": "https://shotstack-api-v1-output.s3-ap-southeast-2.amazonaws.com/5ca6hu7s9k/ba4cbd7c-62ed-4eec-8d02-e2973514ab08-poster.jpg",
        "thumbnail": null,
        "created": "2026-11-09T15:44:36.616Z",
        "updated": "2026-11-09T15:45:21.029Z"
    }
}

You can access the final video via the url in the response, and the still image via poster. Copy and paste the URL to view it in your browser or to download it.

The final video

Here’s how the final video looks, converted from our audio file into a video with an AI-generated background image:

Turn any audio into a video you can share

Now you know how to convert audio into a video with an AI-generated background image, using the Shotstack Ingest and Edit APIs. This guide only covered the very basics. You could expand on this tutorial and start adding text, multiple images, transitions and effects.

There’s so much more that you can achieve with our APIs. Check out our developer guides to learn how to convert YouTube videos to MP3s, generate videos from images, add AI voice overs to your videos, and more.

Sign up for a free Shotstack account to get your API key and turn your first audio file into a video.

Keep reading

Start free

  • Unlimited developer sandbox
  • No credit card required