Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. *
  5. * @param array $paths_media_inputs
  6. * @param string $paths_media_output
  7. * @param int $default_video_stream_index
  8. * @param int $default_audio_stream_index
  9. * @return string
  10. */
  11. 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
  12. {
  13. # notes - normalize/standardize inputs first. sar, dar, streams, etc before executing the output of this 'filters_simple_combine()'.
  14.  
  15. $instructions_inputs = "";
  16. $instructions_complexFilterOption = "";
  17.  
  18. $input_count = 0;
  19. foreach ($paths_media_inputs as $media_path_single) {
  20. $instructions_inputs .= " -i " . '"' . realpath(trim($media_path_single)) . '"';
  21. $instructions_complexFilterOption .= " [$input_count:v:$default_video_stream_index] [$input_count:a:$default_audio_stream_index]";
  22. $input_count++;
  23. }
  24.  
  25. $instructions_complexFilterOption .= " concat=n=$input_count:v=1:a=1 [v] [a]";
  26. $instructions_complexFilterOption = ' -filter_complex "' . trim($instructions_complexFilterOption) . '"' . ' -map "[v]" -map "[a]"';
  27.  
  28. $command_to_execute = "ffmpeg " . trim($instructions_inputs . $instructions_complexFilterOption . " " . '"' . addcslashes(trim($paths_media_output), '\\"') . '"');
  29. return $command_to_execute;
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement