$ffmpeg_start_time, '%SOURCE_TEMP%' => new CommandPlaceholderArg($source_temp, 'is_safe_basename'), '%FFMPEG_DURATION_TIME%' => $ffmpeg_duration_time, '%TARGET_TEMP%' => new CommandPlaceholderArg($target_temp, 'is_safe_basename') ); run_command($shell_exec_cmd, false, $shell_exec_params); rename($target_temp, $target); unlink($source_temp); } else { $ffprobe_array = get_video_info($source_video_file); if(isset($ffprobe_array['streams'][1]['codec_name']) && $ffprobe_array['streams'][1]['codec_name'] = "pcm_s24le") { # ffmpeg does not support PCM in the MP4 container $shell_exec_cmd = $ffmpeg_fullpath . " -y -ss %FFMPEG_START_TIME% -i %SOURCE_VIDEO_FILE% -t '%FFMPEG_DURATION_TIME%' -c copy -c:a aac %TARGET%"; $shell_exec_params = array( '%FFMPEG_START_TIME%' => $ffmpeg_start_time, '%SOURCE_VIDEO_FILE%' => new CommandPlaceholderArg($source_video_file, 'is_safe_basename'), '%FFMPEG_DURATION_TIME%' => $ffmpeg_duration_time, '%TARGET%' => new CommandPlaceholderArg($target, 'is_safe_basename') ); run_command($shell_exec_cmd, false, $shell_exec_params); } else { $shell_exec_cmd = $ffmpeg_fullpath . " -y -ss %FFMPEG_START_TIME% -i %SOURCE_VIDEO_FILE% -t %FFMPEG_DURATION_TIME% " . ($use_avconv ? '-strict experimental -acodec copy ' : ' -c copy ') . '%TARGET%'; $shell_exec_params = array( '%FFMPEG_START_TIME%' => $ffmpeg_start_time, '%SOURCE_VIDEO_FILE%' => new CommandPlaceholderArg($source_video_file, 'is_safe_basename'), '%FFMPEG_DURATION_TIME%' => $ffmpeg_duration_time, '%TARGET%' => new CommandPlaceholderArg($target, 'is_safe_basename') ); run_command($shell_exec_cmd, false, $shell_exec_params); } } }