Limit video duration on uploaded video

Is there any way to upload a file, transcode it, and publish just the first 30 seconds of a clip?

Currently, my only solution is to cut the clip on the backend, but this is consuming significant server resources.

$cmd = “ffmpeg -i $targetFilePath -ss 00:00:00 -t 00:00:30 -c copy $outputFilePath”;

// Execute the command
exec($cmd, $output, $return_var);

This script utilizes ffmpeg to trim the first 30 seconds of the uploaded video, but I’m looking for a more efficient solution that might reduce the server load.


Hey @claudio,

Want to know how to achieve this? It’s super easy with our API - just upload your video to our servers and use the parameters startTimecode and endTimecode to trim it. Don’t worry, we’ve got a helpful tutorial for you right here:

happy developing!