1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/video-audio-merge"
# Request payload
data = {
"input_video": "https://segmind-sd-models.s3.amazonaws.com/display_images/video-audio-merge-input.mp4",
"input_audio": "https://segmind-sd-models.s3.amazonaws.com/display_images/audio-merge-input-aud.mp3",
"video_start": 0,
"video_end": -1,
"audio_start": 0,
"audio_end": -1,
"audio_fade_in": 0,
"audio_fade_out": 0,
"override_audio": False,
"merge_intensity": 0.5
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
URL of the input video to be merged
URL of the input audio to be merged with the video
Start time of the video in seconds
End time of the video in seconds (-1 for full duration)
min : -1,
max : 3600
Start time of the audio in seconds
min : 0,
max : 3600
End time of the audio in seconds (-1 for full duration)
min : -1,
max : 3600
Duration of audio fade-in effect in seconds
min : 0,
max : 10
Duration of audio fade-out effect in seconds
min : 0,
max : 10
Whether to completely replace the original video audio
Intensity of audio merging (0.0 to 1.0)
min : 0,
max : 1
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Optimize your multimedia projects with our cutting-edge Video Audio Merge model. Effortlessly combine audio tracks with video files to create a cohesive and engaging viewer experience. Perfect for content creators, filmmakers, and marketing professionals.
Drag-and-Drop Functionality: Easily upload video and audio files with a simple drag-and-drop feature.
URL Uploads: Seamlessly integrate files via URL for fast processing.
Video and Audio Timing: Set precise video and audio start and end times to ensure perfect synchronization.
Fade Effects: Customize audio fade-in and fade-out durations for smooth transitions.
Override Original Audio: Option to completely replace the original video audio with the new track.
Merge Intensity: Adjust merge intensity levels for balanced audio-video integration.
Enhanced Production Quality: Create professional-grade videos with precisely synchronized audio.
Time-Efficient: Save time with an easy-to-navigate interface and fast processing.
Versatile Usability: Ideal for social media posts, advertisements, vlogs, and more.