public int killVideoProcessor(boolean asRoot, boolean waitFor) {
    int killDelayMs = 300;

    String ffmpegBin = new File(context.getDir("bin", 0), "ffmpeg").getAbsolutePath();

    int result = -1;

    int procId = -1;

    while ((procId = ShellUtils.findProcessId(ffmpegBin)) != -1) {

      Log.d(TAG, "Found PID=" + procId + " - killing now...");

      String[] cmd = {ShellUtils.SHELL_CMD_KILL + ' ' + procId + ""};

      try {
        result =
            ShellUtils.doShellCommand(
                cmd,
                new ShellCallback() {

                  @Override
                  public void shellOut(String msg) {

                    Log.d(TAG, "Killing ffmpeg:" + msg);
                  }

                  @Override
                  public void processComplete(int exitValue) {
                    // TODO Auto-generated method stub

                  }
                },
                asRoot,
                waitFor);
        Thread.sleep(killDelayMs);
      } catch (Exception e) {
      }
    }

    return result;
  }