WordPress + ReelSDK $0.03 per output minute, first $0.50 free
Videos from WordPress posts with a PHP snippet
A short narrated video from a post's images costs under 1 cent on ReelSDK: $0.03 per output minute plus $0.05 per 1,000 voiceover characters. PHP can't start ffmpeg where shell_exec is disabled and wp_remote_post gives up after 5 s, long before a render is done, so a WP-Cron job and a signed webhook do the waiting.
- Post images in, video in the media library
- Key in wp-config.php
- A retried request gets the same job, never a second one
PHP Fatal error: Uncaught Error: Call to undefined function shell_exec() in Command line code:1
WP_Error http_request_failed: cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received
Sources: PHP 8.0: disabled functions, WordPress: http_request_timeout
The same job as one call to ReelSDK
$response = wp_remote_post( 'https://api.reelsdk.com/v1/slideshow?wait=60', array(
'timeout' => 70,
'headers' => array(
'Authorization' => 'Bearer ' . REELSDK_KEY,
'Content-Type' => 'application/json',
),
'body' => wp_json_encode( array(
'images' => array(
'https://api.reelsdk.com/f/lib/demo/seville/river.jpg',
'https://api.reelsdk.com/f/lib/demo/seville/plaza.jpg',
'https://api.reelsdk.com/f/lib/demo/seville/flamenco.jpg',
),
'size' => '9:16',
'voiceover' => array( 'text' => 'Our Seville guide: the river at sunset, Plaza de España at noon and flamenco after dark.' ),
'captions' => 'karaoke',
) ),
) );
$job = json_decode( wp_remote_retrieve_body( $response ), true )['job'];Why ffmpeg breaks here
No shell, a 5 s timeout, and a job that keeps going
Running ffmpeg from PHP needs shell_exec or exec and an ffmpeg binary on the server. Hosts that list them in disable_functions remove them completely: since PHP 8 a disabled function is treated as if it didn't exist, hence Call to undefined function. Calling an API instead runs into the next limit, because WordPress gives every HTTP request 5 s unless you pass a timeout.
That timeout doesn't stop the render. When the request above gave up at 5 s, the job kept going and finished about 19 seconds after it was created, and sending the same request again with the same Idempotency-Key returned that finished job instead of starting a second one. The plugin below never waits: publishing schedules a WP-Cron event, the event starts the job with ?wait=0, and a REST route takes ReelSDK's signed webhook and puts the mp4 in the media library.
This 8-second video cost under 1 cent: $0.03 per output minute plus $0.05 per 1,000 voiceover characters, with captions free. Failed jobs are free and pricing has the rest. Watch a video made this way.
WordPress hosting next to ReelSDK
| Topic | WordPress on a typical host | ReelSDK |
|---|---|---|
| Running ffmpeg | Needs shell_exec and a binary on the server | Slideshows, captions and raw ffmpeg over HTTPS |
| HTTP timeout | 5 s unless you pass timeout | ?wait=0 answers at once with a job id |
| Background work | WP-Cron runs on page loads | Signed webhook when the video is done |
| Secrets | Constants in wp-config.php | Authorization: Bearer with that value |
| Keeping the file | media_handle_sideload into the library | Output links last 7 days |
WordPress limits from WordPress: http_request_timeout, checked November 2026.
Set it up
Two constants and one must-use plugin
This is your own code, not a plugin from the directory: one PHP file in wp-content/mu-plugins, which WordPress loads on every request without activation. It turns each newly published post with attached images into a vertical video with the excerpt as voiceover.
Put the keys in wp-config.php
Constants in wp-config.php stay on the server and out of the database, so they don't show up in exports or the admin. Never print the key into a page or a script tag.
wp-config.php // wp-config.php, above "That's all, stop editing!" define( 'REELSDK_KEY', 'rsdk_live_...' ); define( 'REELSDK_WEBHOOK_SECRET', 'whsec_...' );Add the plugin file
Publishing queues
reelsdk_render_post. The REST route'spermission_callbackchecks the signature and rejects timestamps more than 300 s old before the callback reads the body, and the callback finds the post by the job id it stored.wp-content/mu-plugins/reelsdk-video.phpTry it <?php /** * Plugin Name: Post videos with ReelSDK */ // Publishing only queues the work, so the editor never waits on a render add_action( 'transition_post_status', function ( $new_status, $old_status, $post ) { $published = 'publish' === $new_status && 'publish' !== $old_status; if ( $published && 'post' === $post->post_type ) { wp_schedule_single_event( time(), 'reelsdk_render_post', array( $post->ID ) ); } }, 10, 3 ); add_action( 'reelsdk_render_post', function ( $post_id ) { $ids = array_keys( get_attached_media( 'image', $post_id ) ); $images = array_values( array_filter( array_map( 'wp_get_attachment_url', $ids ) ) ); if ( ! $images ) { return; } $response = wp_remote_post( 'https://api.reelsdk.com/v1/slideshow?wait=0', array( 'timeout' => 15, 'headers' => array( 'Authorization' => 'Bearer ' . REELSDK_KEY, 'Content-Type' => 'application/json', 'Idempotency-Key' => 'wp-post-' . $post_id, ), 'body' => wp_json_encode( array( 'images' => array_slice( $images, 0, 10 ), 'size' => '9:16', 'voiceover' => array( 'text' => wp_strip_all_tags( get_the_excerpt( $post_id ) ) ), 'captions' => 'karaoke', 'webhook_url' => rest_url( 'reelsdk/v1/webhook' ), ) ), ) ); $data = json_decode( wp_remote_retrieve_body( $response ), true ); if ( is_wp_error( $response ) || empty( $data['job']['id'] ) ) { $reason = is_wp_error( $response ) ? $response->get_error_message() : print_r( $data, true ); error_log( 'reelsdk render failed for post ' . $post_id . ': ' . $reason ); return; } update_post_meta( $post_id, '_reelsdk_job', $data['job']['id'] ); } ); add_action( 'rest_api_init', function () { register_rest_route( 'reelsdk/v1', '/webhook', array( 'methods' => 'POST', 'permission_callback' => 'reelsdk_signature_is_valid', 'callback' => 'reelsdk_attach_video', ) ); } ); function reelsdk_signature_is_valid( WP_REST_Request $request ) { $header = (string) $request->get_header( 'reelsdk-signature' ); parse_str( str_replace( ',', '&', $header ), $parts ); $t = $parts['t'] ?? ''; $v1 = $parts['v1'] ?? ''; if ( ! is_string( $t ) || ! is_string( $v1 ) || ! ctype_digit( $t ) ) { return false; } if ( abs( time() - (int) $t ) > 300 ) { return false; } $expected = hash_hmac( 'sha256', $t . '.' . $request->get_body(), REELSDK_WEBHOOK_SECRET ); return hash_equals( $expected, $v1 ); } function reelsdk_attach_video( WP_REST_Request $request ) { $job = json_decode( $request->get_body(), true ); $posts = get_posts( array( 'meta_key' => '_reelsdk_job', 'meta_value' => $job['id'], 'fields' => 'ids', ) ); $post_id = $posts[0] ?? 0; $done = ! $post_id || get_post_meta( $post_id, '_reelsdk_video', true ); if ( 'succeeded' !== $job['status'] || $done ) { return new WP_REST_Response( null, 204 ); } require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; // Output links expire after 7 days, so the mp4 goes into the media library $tmp = download_url( $job['outputs']['video'] ); if ( is_wp_error( $tmp ) ) { return $tmp; } $file = array( 'name' => 'post-' . $post_id . '.mp4', 'tmp_name' => $tmp ); $attachment = media_handle_sideload( $file, $post_id ); if ( is_wp_error( $attachment ) ) { wp_delete_file( $tmp ); return $attachment; } update_post_meta( $post_id, '_reelsdk_video', $attachment ); return new WP_REST_Response( null, 204 ); }Make sure WP-Cron runs
WP-Cron only checks for due events on page loads, so on a quiet site a render can sit in the queue. Disable it with
define( 'DISABLE_WP_CRON', true );and call wp-cron.php from a real cron every minute instead.
FAQ
Video on WordPress, answered
Can I run ffmpeg from PHP on WordPress?
Only if your host allows shell_exec or exec and has an ffmpeg binary installed. Where those functions are disabled, PHP 8 reports them as undefined. Calling ReelSDK needs nothing but wp_remote_post.
Why do I get cURL error 28 from wp_remote_post?
WordPress gives HTTP requests 5 seconds by default. Pass a larger timeout, or better, start the job with ?wait=0 and take the result from a webhook, so no PHP request has to wait for a render.
Is there a ReelSDK WordPress plugin?
No. The file on this page is a must-use plugin you own and can change: it adds an action, a cron event and a REST route, and sends your images to the slideshow API.
How do I keep someone from faking the webhook?
Verify the Reelsdk-Signature header in the route's permission_callback: an HMAC-SHA256 of the timestamp and the raw body with your webhook secret, compared with hash_equals and rejected when older than 300 seconds.
What does it cost?
$0.03 per output minute plus $0.05 per 1,000 voiceover characters, so a short 8-second video costs under 1 cent. The first $0.50 is free and failed jobs cost nothing.
The same fix on other platforms
All integrationsReady to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
