Docs · Convert video to MP4
Guides · Convert video to MP4

Convert video to MP4

Send the video as an input and name an .mp4 output with H.264 video and AAC audio. The response holds a download URL for the MP4, the job’s usage and its price.

The request

Request
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mov"
        }
      ],
      "outputs": [
        {
          "file": "video.mp4",
          "options": [
            "-c:v",
            "libx264",
            "-preset",
            "medium",
            "-crf",
            "23",
            "-c:a",
            "aac",
            "-b:a",
            "128k",
            "-movflags",
            "+faststart"
          ]
        }
      ]
    }
  }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6hqvpqkiwproi518azpod

{
  "ok": true,
  "result": [
    {
      "file_name": "video.mp4",
      "size_bytes": 98566144,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 38.4,
    "input_size_gb": 0.384,
    "output_size_gb": 0.091796875,
    "gb_sec": 18.270599985
  },
  "request_id": "job_0mv6hqvpqkiwproi518azpod",
  "amount_usd": 0.243364392
}

The input is a file you uploaded (POST /file). The full reference is POST /ffmpeg/process.

The options, explained

What each option does
-c:v libx264Encode the video as H.264, which every browser and device plays.
-preset mediumThe balance of encoding speed and file size. Slower presets make smaller files and take longer.
-crf 23Constant quality. Lower is better quality and a bigger file; 18 looks close to the source, 28 is visibly softer.
-c:a aac -b:a 128kAAC audio at 128 kbit/s.
-movflags +faststartPuts the MP4’s index at the start of the file, so playback can begin before the download ends.

Variations

Keep the streams as they are

If the source is already H.264 and AAC, change only the container. It takes seconds.

In the output: "options": ["-c", "copy", "-movflags", "+faststart"]

H.265 for smaller files

About half the size of H.264 at the same quality. Not every browser plays it.

In the output: "options": ["-c:v", "libx265", "-crf", "28", "-tag:v", "hvc1", "-c:a", "aac"]

From a URL

Give the input’s file_path as a public HTTPS URL to skip the upload.

What it costs

A 1 GB recording that becomes a 0.25 GB MP4 in 95 seconds: (1 GB + 0.25 GB) × 95 s = 118.750 GB-seconds, which is USD 1.5818 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See Pricing.