Last active
July 27, 2016 05:29
-
-
Save ashbeats/b3265d22feda7d96794de5228ddd4c1b to your computer and use it in GitHub Desktop.
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 | |
/** | |
* | |
* @param array $paths_media_inputs | |
* @param string $paths_media_output | |
* @param int $default_video_stream_index | |
* @param int $default_audio_stream_index | |
* @return string | |
*/ | |
function filters_simple_combine(array $paths_media_inputs, string $paths_media_output, int $default_video_stream_index = 0, int $default_audio_stream_index = 0) : string | |
{ | |
# notes - normalize/standardize inputs first. sar, dar, streams, etc before executing the output of this 'filters_simple_combine()'. | |
$instructions_inputs = ""; | |
$instructions_complexFilterOption = ""; | |
$input_count = 0; | |
foreach ($paths_media_inputs as $media_path_single) { | |
$instructions_inputs .= " -i " . '"' . realpath(trim($media_path_single)) . '"'; | |
$instructions_complexFilterOption .= " [$input_count:v:$default_video_stream_index] [$input_count:a:$default_audio_stream_index]"; | |
$input_count++; | |
} | |
$instructions_complexFilterOption .= " concat=n=$input_count:v=1:a=1 [v] [a]"; | |
$instructions_complexFilterOption = ' -filter_complex "' . trim($instructions_complexFilterOption) . '"' . ' -map "[v]" -map "[a]"'; | |
$command_to_execute = "ffmpeg " . trim($instructions_inputs . $instructions_complexFilterOption . " " . '"' . addcslashes(trim($paths_media_output), '\\"') . '"'); | |
return $command_to_execute; | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment