Back to Blog

The Best Way to Merge Videos Programmatically with FFMPEGAPI.net

June 2026 FFMPEG API Team

Merging videos programmatically can enhance your applications dramatically, especially when integrating video content for SaaS apps, automation processes, or AI agents. FFMPEGAPI.net provides a powerful and seamless way to utilize FFmpeg features without the hassle of server setup or infrastructure management. In this article, we’ll focus on the Picture in Picture (PiP) feature, showing you how to overlay videos effortlessly.

What is Picture in Picture?

Picture in Picture is a video technique that allows one video to be displayed over another, commonly used in tutorials, presentations, or multi-streamed content. With FFMPEGAPI.net, this can be done using a simple REST API call, making it accessible for developers looking to enhance their video applications.

  • Overlay a secondary video on a main video.
  • Configurable overlay positions and scales.
  • Choose the audio source for your output video.

How to Use the Picture in Picture API

FFMPEGAPI.net’s Picture in Picture endpoint allows you to combine videos with ease. The API endpoint for this feature is `/api/picture_in_picture`, and it requires a POST request with specific parameters to create the video composition.

  • Main video URL (required)
  • Overlay video URL (required)
  • Position of the overlay (optional, defaults to bottom-right)
  • Scale of the overlay (optional, defaults to iw/4:ih/4)
  • Audio source selection (optional, defaults to video1)
  • Asynchronous processing option (optional)
import requests

url = 'https://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())
curl -X POST https://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"}'

FFMPEGAPI.net stands out as the best hosted tool for merging videos programmatically due to its simplicity, flexibility, and powerful features. By using the Picture in Picture API, developers can enhance their applications without the overhead of managing server infrastructure or the complexities of FFmpeg. Experience seamless video processing today with FFMPEGAPI.net.

Ready to Start Processing Videos?

Get your free API key and start merging videos in minutes

Get Started Free