You have two or more MP4 clips and you want one file out, in a set order, without standing up an FFmpeg box. This walkthrough uses PennyCompute's ffmpeg.stitch_export.v1 job: you send the clip URLs in playback order, wait until the job succeeds, and download the joined MP4. The same flow is documented on the stitch videos guide. Field names and paths below are taken from the public OpenAPI document at https://api.pennycompute.com/openapi.json (buyer API 1.10.2).
What you need
- Public
httpslinks to the clips, each up to 1 GB, orinput_urlvalues fromPOST /v1/assets. The renderer fetches them with a plain GET, so keep every link readable until the job has ended.input_urlsholds 1 to 64 clips. The order of the array is the order of the edit. To repeat a shot, include its URL a second time. - A PennyCompute account and a server API key from https://app.pennycompute.com. Send the key as
Authorization: Bearer $PENNY_API_KEYon every API call.
A new account starts with $5 in its prepaid balance. Failed, cancelled and expired jobs are not charged.
Match your sources, or re-encode
The default video_codec and audio_codec are both copy. Copy joins the clips without re-encoding; they must share codec, size, frame rate and audio layout. The official guide does not claim that a mismatched stitch is re-encoded automatically.
If the sources do not already match, transcode each one to a common format with ffmpeg.transcode.v1, then put those output links in input_urls. ffmpeg.transcode.v1 requires input_url. Optional fields include height, fps, start_seconds and duration_seconds. Its default video codec is h264_videotoolbox (hardware on the renderer); libx264 encodes in software.
Alternatively, ffmpeg.stitch_export.v1 can re-encode in the stitch itself. Set video_codec to libx264 or h264_videotoolbox, and set audio_codec to aac if you also need the sound stream rewritten. output_container is mp4 only.
What a stitch job costs
Stitching is billed as FFmpeg output. Live rates are on https://pennycompute.com/ffmpeg-api-pricing and https://pennycompute.com/pricing: $0.0075 per minute of HD output, $0.00375 for SD and $0.015 for 4K, billed by the second, with a ten-second minimum per output. The rate follows the output's shorter side. Queue time is not charged.
POST /v1/jobs/estimate takes the same service_id and input as a job. It creates no job and reserves nothing. For FFmpeg, price_is_final is false. The completed job is billed for the length of its actual output.
1. Estimate the job
export PENNY_API_KEY="$PENNY_API_KEY"
export API=https://api.pennycompute.com
curl -sS -X POST "$API/v1/jobs/estimate" \
-H "Authorization: Bearer $PENNY_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"service_id": "ffmpeg.stitch_export.v1",
"input": {
"input_urls": [
"https://example.com/clip-a.mp4",
"https://example.com/clip-b.mp4"
]
}
}'
Replace the example URLs with your own public links, or with input_url values returned by POST /v1/assets. The body above uses the defaults: video_codec copy, audio_codec copy, output_container mp4.
2. Submit the job
POST /v1/jobs requires an Idempotency-Key header of 8 to 128 characters. Repeating the same key with the same body returns the original job and does not create or charge a second one.
curl -sS -X POST "$API/v1/jobs" \
-H "Authorization: Bearer $PENNY_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: stitch-mp4-demo-001" \
-d '{
"service_id": "ffmpeg.stitch_export.v1",
"input": {
"input_urls": [
"https://example.com/clip-a.mp4",
"https://example.com/clip-b.mp4"
]
}
}'
A new job is created as queued. Save the returned id. Optional fields on the same body are max_wait_seconds (default 900, maximum 86400), client_reference, priority and webhook_endpoint_id.
To re-encode during the stitch, add the codec fields to input:
curl -sS -X POST "$API/v1/jobs" \
-H "Authorization: Bearer $PENNY_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: stitch-mp4-reencode-001" \
-d '{
"service_id": "ffmpeg.stitch_export.v1",
"input": {
"input_urls": [
"https://example.com/clip-a.mp4",
"https://example.com/clip-b.mp4"
],
"video_codec": "libx264",
"audio_codec": "aac",
"output_container": "mp4"
}
}'
3. Poll until the status is final
JOB_ID=your-job-id
curl -sS "$API/v1/jobs/$JOB_ID" \
-H "Authorization: Bearer $PENNY_API_KEY" \
-H "Accept: application/json"
status is one of queued, active, cancelling, succeeded, failed, cancelled or expired. Poll until it is one of the last four. Only succeeded is charged.
4. Download the joined MP4
curl -sS "$API/v1/jobs/$JOB_ID/output" \
-H "Authorization: Bearer $PENNY_API_KEY" \
-H "Accept: application/json"
The response is {"url": "https://..."}. Fetch that URL with a plain GET; it needs no API key and takes byte ranges. The file is kept for 3 days after the render finishes; after that the link answers 404.
If you next need captions or a soundtrack, pass that output link to ffmpeg.caption_burn.v1 or ffmpeg.audio_mix.v1.
Optional: upload the clips first
Any public https link works in a job input without an upload. If the files are only on your machine, POST /v1/assets prepares a single-file upload for each clip: you send the file's SHA-256 and content type, PUT the bytes to the returned upload_url, and put the returned input_url in input_urls. Those PUTs need no API key. A single-file upload can be up to 100 MB; pass a larger clip by its own public link (up to 1 GB). Uploaded files stop being served 24 hours after their PUT, so submit the stitch while every link is still readable.
If something goes wrong
-
402 insufficient_balance: add funds in the dashboard and submit again. -
409 no_capacity: no renderer can take this service now, or its queue is full; submit again later. -
expiredwithfailure_codeno_capacity: the job waitedmax_wait_secondswithout starting and was not charged. - If a copy stitch fails because the clips do not match, transcode each clip to a common format first, or resubmit with
video_codecset tolibx264orh264_videotoolbox.
OpenAPI: https://api.pennycompute.com/openapi.json. Docs: https://pennycompute.com/docs. Pricing: https://pennycompute.com/pricing. Billing terms: https://pennycompute.com/billing-terms.
— Adam King, PennyCompute
Top comments (0)