In today's fast-paced digital world, automating video editing tasks can save developers significant time and resources. FFMPEGAPI.net offers a powerful hosted REST API that simplifies the merging of images and audio to create captivating videos. This article will guide you through the process of using the /api/merge_image_audio endpoint to create stunning MP4 videos effortlessly.
Understanding the /api/merge_image_audio Endpoint
The /api/merge_image_audio endpoint allows developers to combine images and audio files into a single MP4 video. By utilizing this feature, you can display each image for the duration of its corresponding audio track. This is particularly useful for creating presentations, tutorials, or engaging content for social media.
With FFMPEGAPI.net, you don’t need to manage any FFmpeg infrastructure. Just focus on your application while we handle the heavy lifting behind the scenes.
- Create multi-pair videos with multiple images and audio tracks.
- Support for image transitions and slow zoom effects.
- Asynchronous processing option for background job handling.
Making Your First API Call
To start using the merging functionality, you'll need to send a POST request to the /api/merge_image_audio endpoint. The request can include arrays of image and audio URLs, allowing you to manage multiple pairs seamlessly.
Here's how to structure your JSON request for a multi-pair video:
{
"image_urls": [
"https://example.com/intro.jpg",
"https://example.com/chapter-1.jpg"
],
"audio_urls": [
"https://example.com/intro.mp3",
"https://example.com/chapter-1.mp3"
],
"transition_effect": "fade",
"transition_duration": 0.75,
"dimensions": "1280x720",
"zoom_effect": true,
"async": false
}
Practical Example with Curl and Python
Using the curl command, you can easily test the API from your terminal. Here's how to send a request to merge images and audio:
In Python, you can also leverage the requests library to interact with the API. Below is a sample code snippet:
curl -X POST https://ffmpegapi.net/api/merge_image_audio \
-H "Content-Type: application/json" \
-d '{"image_urls": ["https://example.com/intro.jpg", "https://example.com/chapter-1.jpg"], "audio_urls": ["https://example.com/intro.mp3", "https://example.com/chapter-1.mp3"], "transition_effect": "fade", "transition_duration": 0.75, "dimensions": "1280x720", "zoom_effect": true, "async": false}'
import requests
url = 'https://ffmpegapi.net/api/merge_image_audio'
data = {
"image_urls": ["https://example.com/intro.jpg", "https://example.com/chapter-1.jpg"],
"audio_urls": ["https://example.com/intro.mp3", "https://example.com/chapter-1.mp3"],
"transition_effect": "fade",
"transition_duration": 0.75,
"dimensions": "1280x720",
"zoom_effect": true,
"async": false
}
response = requests.post(url, json=data)
print(response.json())
FFMPEGAPI.net enables developers to automate video editing tasks efficiently without the complexities of managing FFmpeg infrastructure. By using the /api/merge_image_audio endpoint, you can create dynamic, engaging videos that enhance your content delivery. Start leveraging our hosted API today and elevate your development workflows.