protected ProcessWrapperImpl getFFMpegTranscode(
      String fileName, DLNAResource dlna, DLNAMediaInfo media, OutputParams params)
      throws IOException {
    PmsConfiguration configuration = PMS.getConfiguration();
    String ffmpegAlternativePath = configuration.getFfmpegAlternativePath();
    List<String> cmdList = new ArrayList<String>();

    if (ffmpegAlternativePath != null && ffmpegAlternativePath.length() > 0) {
      cmdList.add(ffmpegAlternativePath);
    } else {
      cmdList.add(executable());
    }

    if (params.timeseek > 0) {
      cmdList.add("-ss");
      cmdList.add("" + params.timeseek);
    }

    cmdList.add("-i");
    cmdList.add(fileName);

    for (String arg : args()) {
      cmdList.add(arg);
    }

    String[] ffmpegSettings = StringUtils.split(configuration.getFfmpegSettings());

    if (ffmpegSettings != null) {
      for (String option : ffmpegSettings) {
        cmdList.add(option);
      }
    }

    cmdList.add("pipe:");
    String[] cmdArray = new String[cmdList.size()];
    cmdList.toArray(cmdArray);

    cmdArray = finalizeTranscoderArgs(this, fileName, dlna, media, params, cmdArray);

    ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params);
    pw.runInNewThread();

    return pw;
  }
  @Override
  public ProcessWrapper launchTranscode(
      String fileName, DLNAResource dlna, DLNAMediaInfo media, OutputParams params)
      throws IOException {
    params.minBufferSize = params.minFileSize;
    params.secondread_minsize = 100000;

    PipeProcess pipe = new PipeProcess("mencoder" + System.currentTimeMillis());
    params.input_pipes[0] = pipe;

    String cmdArray[] = new String[args().length + 4];
    cmdArray[0] = executable();
    cmdArray[1] = fileName;
    for (int i = 0; i < args().length; i++) {
      cmdArray[i + 2] = args()[i];
    }
    cmdArray[cmdArray.length - 2] = "-o";
    cmdArray[cmdArray.length - 1] = pipe.getInputPipe();

    ProcessWrapper mkfifo_process = pipe.getPipeProcess();

    cmdArray = finalizeTranscoderArgs(this, fileName, dlna, media, params, cmdArray);

    ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params);
    pw.attachProcess(mkfifo_process);
    mkfifo_process.runInNewThread();
    try {
      Thread.sleep(50);
    } catch (InterruptedException e) {
    }
    pipe.deleteLater();

    pw.runInNewThread();
    try {
      Thread.sleep(50);
    } catch (InterruptedException e) {
    }
    return pw;
  }