Back to Blog

The Best Way to Merge Videos Programmatically with FFMPEGAPI.net

June 2026 FFMPEG API Team

Merging videos programmatically has never been easier, thanks to FFMPEGAPI.net. This powerful hosted REST API allows developers to create stunning picture-in-picture (PiP) compositions without the hassle of setting up server infrastructure or managing FFmpeg on their own. In this article, we will explore how to use the Picture in Picture endpoint of FFMPEGAPI.net to overlay one video on another seamlessly.

What is Picture in Picture?

Picture in Picture (PiP) is a video format where one video is displayed within another. This is commonly used in video streaming, presentations, and content creation to enhance viewer engagement. With FFMPEGAPI.net, you can easily produce PiP videos programmatically, allowing for creative flexibility in your projects.

  • Enhances user engagement with visual storytelling.
  • Ideal for tutorials, vlogs, and marketing videos.
  • Support for multiple audio sources.

Using the Picture in Picture API Endpoint

FFMPEGAPI.net provides a straightforward API endpoint for creating Picture in Picture compositions. The endpoint is accessible via a simple POST request, allowing you to specify the main video, overlay video, and various parameters to customize your output.

  • Endpoint: /api/picture_in_picture
  • Method: POST
  • Content-Type: application/json
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'
headers = {'Content-Type': 'application/json'}
data = {
    'main_video_url': 'https://example.com/main.mp4',
    'pip_video_url': 'https://example.com/overlay.mp4',
    'position': 'top-right'
}
response = requests.post(url, headers=headers, json=data)
print(response.json())

Parameters for the API Request

The Picture in Picture endpoint accepts several parameters to customize your video overlay. Here’s a breakdown of the key parameters you can use:

  • main_video_url: URL of the main/background video (required).
  • pip_video_url: URL of the overlay/PiP video (required).
  • position: Position of the overlay video (default: bottom-right).
  • scale: Scale for the overlay, expressed as a FFmpeg scale expression (default: iw/4:ih/4).
  • audio_option: Choose audio source from video1, video2, or mute (default: video1).
  • async: Option to process the video in the background.

Why Choose FFMPEGAPI.net?

FFMPEGAPI.net stands out as the best hosted tool for video processing workflows due to its ease of use, robust API, and flexible features. With no server setup required, you can focus on building your application rather than managing infrastructure. Whether you're developing a SaaS application, automating video processing, or creating content pipelines, FFMPEGAPI.net has you covered.

  • No server management is needed, saving you time and resources.
  • API-key authentication ensures secure access.
  • Scalable for a variety of applications, from individual projects to large-scale solutions.
  • Detailed documentation and support available for seamless integration.

In conclusion, FFMPEGAPI.net provides a powerful and efficient way to merge videos programmatically through its Picture in Picture API endpoint. By using this API, developers can create engaging video content with minimal effort, allowing for greater creativity and flexibility. Start your journey with FFMPEGAPI.net today and elevate your video processing capabilities!

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free