Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement