Merging videos programmatically can be a challenging task without the right tools. FFMPEGAPI.net offers a powerful hosted REST API that simplifies video and audio processing, eliminating the need for server management and complex setups. In this article, we will explore the Picture in Picture feature that allows you to overlay one video on another efficiently.
What is Picture in Picture?
Picture in Picture (PiP) is a video composition technique where one video is displayed over another. This feature is commonly used for tutorials, gaming streams, and various multimedia applications.
- Easily create engaging video content.
- Customize overlay position and size.
- Select audio source for the final video.
Using the FFMPEGAPI.net Picture in Picture Endpoint
The Picture in Picture feature can be accessed via the POST endpoint: `/api/picture_in_picture`. This endpoint allows developers to merge videos effortlessly through a simple API call.
- No need to set up FFmpeg locally.
- API-key authentication ensures secure access.
- Ideal for automation, SaaS applications, and content pipelines.
import requests
url = 'https://www.ffmpegapi.net/api/picture_in_picture'
data = {
'main_video_url': 'https://example.com/main.mp4',
'pip_video_url': 'https://example.com/overlay.mp4',
'position': 'top-right'
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'}
response = requests.post(url, json=data, headers=headers)
print(response.json())
curl -X POST https://www.ffmpegapi.net/api/picture_in_picture \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{"main_video_url":"https://example.com/main.mp4", "pip_video_url":"https://example.com/overlay.mp4", "position":"top-right"}'
Parameters for the Picture in Picture Endpoint
The API requires specific parameters to perform the overlay operation. Here is a brief overview of the parameters you can use:
- main_video_url: The URL of the main video (required).
- pip_video_url: The URL of the overlay video (required).
- position: The position of the overlay; defaults to bottom-right.
- scale: Adjust the size of the overlay; default is iw/4:ih/4.
- audio_option: Choose the audio source; default is video1.
- async: Process the job in the background.
FFMPEGAPI.net provides a straightforward and efficient way to merge videos programmatically with its Picture in Picture feature. By utilizing this hosted API, developers can focus on building applications without worrying about server setups or FFmpeg management. Whether you're developing content pipelines or automation tools, FFMPEGAPI.net is the ideal solution for your video processing needs.