# FFMPEG API Examples

Replace `your_api_key_here` with an active key from your dashboard.

## Image and Audio Merge

```bash
curl -X POST "https://ffmpegapi.net/api/merge_image_audio" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "image_urls": [
    "https://example.com/intro.jpg",
    "https://example.com/chapter-1.jpg"
  ],
  "audio_urls": [
    "https://example.com/intro.mp3",
    "https://example.com/chapter-1.mp3"
  ],
  "transition_effect": "fade",
  "transition_duration": 0.75,
  "dimensions": "1280x720",
  "zoom_effect": true,
  "async": false
}'
```

Response:

```json
{
  "success": true,
  "message": "Image and Audio Merge completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Video Merge

```bash
curl -X POST "https://ffmpegapi.net/api/merge_videos" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_urls": [
    "https://example.com/intro.mp4",
    "https://example.com/main.mp4"
  ],
  "dimensions": "1920x1080"
}'
```

Response:

```json
{
  "success": true,
  "message": "Video Merge completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Neonvideo Merge Videos

```bash
curl -X POST "https://ffmpegapi.net/api/neonvideo_merge_videos" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_urls": [
    "https://example.com/intro.mp4",
    "https://example.com/main.mp4"
  ],
  "outro_url": "https://example.com/outro.mp4",
  "dimensions": "1920x1080"
}'
```

Response:

```json
{
  "success": true,
  "message": "Neonvideo Merge Videos completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Video Loop

```bash
curl -X POST "https://ffmpegapi.net/api/video_loop" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/clip.mp4",
  "number_of_loops": 3
}'
```

Response:

```json
{
  "success": true,
  "message": "Video Loop completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Picture in Picture

```bash
curl -X POST "https://ffmpegapi.net/api/picture_in_picture" \
  -H "X-API-Key: your_api_key_here" \
  -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"
}'
```

Response:

```json
{
  "success": true,
  "message": "Picture in Picture completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Add Watermark

```bash
curl -X POST "https://ffmpegapi.net/api/add_watermark" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "watermark_url": "https://example.com/logo.png",
  "position": "bottom-right",
  "scale": 0.2
}'
```

Response:

```json
{
  "success": true,
  "message": "Add Watermark completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Add Subtitles

```bash
curl -X POST "https://ffmpegapi.net/api/add_subtitles" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "subtitle_url": "https://example.com/subtitles.ass"
}'
```

Response:

```json
{
  "success": true,
  "message": "Add Subtitles completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Split Audio

```bash
curl -X POST "https://ffmpegapi.net/api/split_audio" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "audio_url": "https://example.com/podcast.mp3",
  "parts": 3
}'
```

Response:

```json
{
  "success": true,
  "message": "Audio split into 3 parts successfully",
  "parts": 3,
  "audio_parts": [
    {
      "part": "part_001.mp3",
      "download_url": "https://ffmpegapi.net/download/job_abc123/part_001.mp3"
    },
    {
      "part": "part_002.mp3",
      "download_url": "https://ffmpegapi.net/download/job_abc123/part_002.mp3"
    },
    {
      "part": "part_003.mp3",
      "download_url": "https://ffmpegapi.net/download/job_abc123/part_003.mp3"
    }
  ]
}
```

## Split Audio by Segments

```bash
curl -X POST "https://ffmpegapi.net/api/split_audio_segments" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "audio_url": "https://example.com/podcast.mp3",
  "segment_duration": 10
}'
```

Response:

```json
{
  "success": true,
  "message": "Audio split into fixed-duration segments successfully",
  "segment_duration": 10,
  "total_segments": 4,
  "segments": [
    {
      "segment": "segment_001.mp3",
      "download_url": "https://ffmpegapi.net/download/job_abc123/segment_001.mp3"
    },
    {
      "segment": "segment_002.mp3",
      "download_url": "https://ffmpegapi.net/download/job_abc123/segment_002.mp3"
    }
  ]
}
```

## Split Audio by Time

```bash
curl -X POST "https://ffmpegapi.net/api/split_audio_time" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "audio_url": "https://example.com/audio.mp3",
  "start_time": 1000,
  "end_time": 11000
}'
```

Response:

```json
{
  "success": true,
  "message": "Split Audio by Time completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/audio_abc123.mp3",
  "filename": "audio_abc123.mp3"
}
```

## Trim Audio

```bash
curl -X POST "https://ffmpegapi.net/api/trim_audio" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "audio_url": "https://example.com/song.mp3",
  "desired_length": 30,
  "fade_duration": 2
}'
```

Response:

```json
{
  "success": true,
  "message": "Trim Audio completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/audio_abc123.mp3",
  "filename": "audio_abc123.mp3",
  "trimmed_length": 30
}
```

## Trim Video

```bash
curl -X POST "https://ffmpegapi.net/api/trim_video" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "start_time": 5,
  "end_time": 20
}'
```

Response:

```json
{
  "success": true,
  "message": "Trim Video completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Split Video

```bash
curl -X POST "https://ffmpegapi.net/api/split_video" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "split_at_seconds": 12.5
}'
```

Response:

```json
{
  "success": true,
  "message": "Video split successfully",
  "parts": [
    {
      "part": 1,
      "download_url": "https://ffmpegapi.net/api/storage/video_abc123_part1.mp4",
      "filename": "video_abc123_part1.mp4"
    },
    {
      "part": 2,
      "download_url": "https://ffmpegapi.net/api/storage/video_abc123_part2.mp4",
      "filename": "video_abc123_part2.mp4"
    }
  ]
}
```

## Get First Frame Image

```bash
curl -X POST "https://ffmpegapi.net/api/get_first_frame_image" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4"
}'
```

Response:

```json
{
  "success": true,
  "message": "Frame extracted successfully",
  "image_url": "https://ffmpegapi.net/api/storage/frame_abc123.jpg",
  "download_url": "https://ffmpegapi.net/api/storage/frame_abc123.jpg",
  "filename": "frame_abc123.jpg"
}
```

## Get Last Frame Image

```bash
curl -X POST "https://ffmpegapi.net/api/get_last_frame_image" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4"
}'
```

Response:

```json
{
  "success": true,
  "message": "Frame extracted successfully",
  "image_url": "https://ffmpegapi.net/api/storage/frame_abc123.jpg",
  "download_url": "https://ffmpegapi.net/api/storage/frame_abc123.jpg",
  "filename": "frame_abc123.jpg"
}
```

## Convert to Vertical

```bash
curl -X POST "https://ffmpegapi.net/api/convert_to_vertical" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/landscape.mp4",
  "watermark_url": "https://example.com/logo.png"
}'
```

Response:

```json
{
  "success": true,
  "message": "Convert to Vertical completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## TikTok Portrait Converter

```bash
curl -X POST "https://ffmpegapi.net/api/convert_to_tiktok_portrait" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/landscape.mp4",
  "outro_video_url": "https://example.com/outro.mp4"
}'
```

Response:

```json
{
  "success": true,
  "message": "TikTok Portrait Converter completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Extract Audio as MP3

```bash
curl -X POST "https://ffmpegapi.net/api/extract_audio_mp3" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "bitrate": "192k"
}'
```

Response:

```json
{
  "success": true,
  "message": "Extract Audio as MP3 completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/audio_abc123.mp3",
  "filename": "audio_abc123.mp3"
}
```

## Convert Video to GIF

```bash
curl -X POST "https://ffmpegapi.net/api/convert_video_to_gif" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/clip.mp4",
  "transparent_background": true,
  "chromakey_color": "0x00FF00",
  "fps": 10
}'
```

Response:

```json
{
  "success": true,
  "message": "Convert Video to GIF completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/clip_abc123.gif",
  "filename": "clip_abc123.gif"
}
```

## AI Captions

```bash
curl -X POST "https://ffmpegapi.net/api/videos/add-tiktok-captions" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "subtitle_style": "yellow-bg",
  "position": "bottom"
}'
```

Response:

```json
{
  "success": true,
  "download_url": "https://ffmpegapi.net/api/storage/auto-captions/video_abc123.mp4",
  "captions_json_url": "https://ffmpegapi.net/api/storage/auto-captions/captions_abc123.json",
  "srt_url": "https://ffmpegapi.net/api/storage/auto-captions/captions_abc123.srt",
  "vtt_url": "https://ffmpegapi.net/api/storage/auto-captions/captions_abc123.vtt",
  "word_count": 142,
  "message": "Video with auto-generated TikTok captions rendered successfully"
}
```

## Text Overlay Captions

```bash
curl -X POST "https://ffmpegapi.net/api/videos/add-text-overlay-captions" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "video_url": "https://example.com/video.mp4",
  "text": "First line\nSecond line",
  "duration_per_line": 4
}'
```

Response:

```json
{
  "success": true,
  "download_url": "https://ffmpegapi.net/api/storage/text-overlay/video_abc123.mp4",
  "line_count": 2,
  "duration_per_line": 4,
  "total_duration_seconds": 8,
  "message": "Video with text overlay captions rendered successfully"
}
```

## YouTube to MP4

```bash
curl -X POST "https://ffmpegapi.net/api/youtube_to_mp4" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "youtube_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}'
```

Response:

```json
{
  "success": true,
  "message": "YouTube to MP4 completed successfully",
  "download_url": "https://ffmpegapi.net/api/storage/video_abc123.mp4",
  "filename": "video_abc123.mp4"
}
```

## Job Status

```bash
curl -X GET "https://ffmpegapi.net/api/job/job_123/status?api_key=your_api_key_here"
```

Response:

```json
{
  "success": true,
  "job_id": "job_abc123",
  "job_type": "merge_videos",
  "status": "completed",
  "created_at": "2026-06-11T14:05:00Z",
  "updated_at": "2026-06-11T14:07:18Z",
  "download_url": "https://ffmpegapi.net/api/storage/merged_abc123.mp4",
  "result_url": "https://ffmpegapi.net/api/storage/merged_abc123.mp4",
  "filename": "merged_abc123.mp4"
}
```

## Async Workflow

```python
import time
import requests

api_key = "your_api_key_here"
response = requests.post(
    "https://ffmpegapi.net/api/merge_videos",
    headers={"X-API-Key": api_key},
    json={"video_urls": ["https://example.com/a.mp4", "https://example.com/b.mp4"], "async": True},
)
job_id = response.json()["job_id"]

while True:
    status = requests.get(f"https://ffmpegapi.net/api/job/{job_id}/status", headers={"X-API-Key": api_key}).json()
    if status["status"] in ("completed", "failed"):
        print(status)
        break
    time.sleep(5)
```
