In the world of video processing, the Picture-in-Picture (PiP) effect is a popular way to enhance content. With FFMPEGAPI.net, developers can easily overlay one video on another using our hosted REST API, eliminating the need for complex server setups or FFmpeg management. This article will guide you through how to utilize our Picture-in-Picture endpoint effectively in your projects.
What is Picture-in-Picture (PiP)?
Picture-in-Picture allows a viewer to see a secondary video while still watching the main video. This technique is commonly used in tutorials, webinars, and gaming streams.
Using the Picture in Picture Endpoint
FFMPEGAPI.net provides a straightforward API for creating a PiP composition. The endpoint '/api/picture_in_picture' allows you to overlay a video on top of another, with flexible options for positioning, scaling, and audio sources.
- Method: POST
- Content-Type: application/json
- Asynchronous processing option available
curl -X POST https://www.ffmpegapi.net/api/picture_in_picture \
-H "Content-Type: application/json" \
-d '{"main_video_url": "https://example.com/main.mp4", "pip_video_url": "https://example.com/overlay.mp4", "position": "top-right"}'
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' \
} \
response = requests.post(url, json=data) \
print(response.json())
Parameters Explained
When calling the PiP endpoint, several parameters can be set to customize the output to your needs.
- main_video_url: The URL of the main video (required).
- pip_video_url: The URL of the overlay video (required).
- position: Where to place the overlay (defaults to bottom-right).
- scale: Determines the size of the overlay (defaults to iw/4:ih/4).
- audio_option: Choose the audio source (defaults to video1).
- async: If true, returns job_id immediately.
FFMPEGAPI.net is the premier hosted solution for developers looking to integrate video processing capabilities into their applications. With no server setup required and a simple API key authentication, you can quickly implement advanced features like Picture-in-Picture video overlays. Start using our API today to enhance your content pipelines and create engaging media experiences effortlessly.