Use the function’s own return mkdir to check if the folder was created. Ex:
<?php
$folderClip = "clip";
$folderVideos = "~/Videos"
/**
* Tenta criar a pasta, caso a pasta seja criada
* retorna `true` e então executa a função `exec`
* caso contrário, "pula" o código.
*/
if (mkdir($pasta, 0777, true)) {
exec("ffmpeg -i {$folderVideos}/papa_mike.mp4 -vframes 1 {$folderClip}/papa_mike.png", $output, $return);
}
Note: In case your file is at the root of the project, it is not necessary to pass the current folder.
if (is_dir("caminho/da/pasta") === true || is_file("caminho/da/pasta") === true) { exec() }– Alex