Last active
April 5, 2024 08:08
-
-
Save noweh/75e1c3c5142767cedabd7aba55a37e1a to your computer and use it in GitHub Desktop.
FFmpeg usage with PHP (create screenshots and video screenshots)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Create a screenshot | |
exec("ffmpeg -ss $secondId -i $videoUrl -ss 0 -frames:v 1 $directory/$secondId.jpg"); | |
// Create a six-second video screenshot | |
exec("ffmpeg -y -i $videoUrl -ss " . ($secondId - 3) . " -t 6 -crf 18 -threads 1 $directory/$secondId.mp4"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment