In the age of digital content, the ability to create engaging videos programmatically is a game changer for developers. FFMPEGAPI.net offers a powerful hosted REST API that enables you to merge images and audio without the hassle of server management. This article provides a practical guide on how to use the Image and Audio Merge endpoint to create captivating MP4 videos.
Understanding the Image and Audio Merge API
The Image and Audio Merge API is designed to create an MP4 video from one or more pairs of images and audio files. It allows you to specify image and audio URLs, applying optional transitions and effects to enhance the visual appeal of your videos.
- Supports multiple image/audio pairs.
- Flexible JSON request format.
- Supports various transition effects and image zoom.
- Effortless integration with your applications.
Making a Request to the API
To create a video, 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, optional transition effects, and dimensions for the output video. Below is an example of how to structure your request.
- POST /api/merge_image_audio
- Content-Type: application/json or multipart/form-data
- Include 'image_urls' and 'audio_urls' for multiple pairs, or 'image' and 'audio' for a single pair.
{
"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: Merging Images and Audio
Here's a practical example using curl to make a request to the Image and Audio Merge API. This example demonstrates how to merge two images with their corresponding audio files into a single MP4 video.
- Ensure your images and audio files are accessible via their URLs.
- Choose your desired transition effects for a professional touch.
- Set the dimensions to suit your video requirements.
curl -X POST https://www.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
}'
FFMPEGAPI.net provides an effortless way for developers to integrate video creation capabilities into their applications without the need for managing FFmpeg servers. By harnessing the power of the Image and Audio Merge API, you can focus on building your features while delivering professional-quality videos. Explore the possibilities and streamline your video processing workflows today!