Program: 47100
Project: 47100
Buggy source:
@Override public synchronized ProcessWrapper launchTranscode(DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  final String filename=dlna.getSystemName();
  InputFile newInput=new InputFile();
  newInput.setFilename(filename);
  newInput.setPush(params.stdin);
  PmsConfiguration prev=configuration;
  configuration=(DeviceConfiguration)params.mediaRenderer;
  RendererConfiguration renderer=params.mediaRenderer;
  boolean aspectRatiosMatch=true;
  if (media.getAspectRatioContainer() != null && media.getAspectRatioVideoTrack() != null && !media.getAspectRatioContainer().equals(media.getAspectRatioVideoTrack())) {
    aspectRatiosMatch=false;
  }
  int nThreads=1;
  if (configuration.isFfmpegMultithreading()) {
    if (Runtime.getRuntime().availableProcessors() == configuration.getNumberOfCpuCores()) {
      nThreads=0;
    }
 else {
      nThreads=configuration.getNumberOfCpuCores();
    }
  }
  List<String> cmdList=new ArrayList<>();
  boolean avisynth=avisynth();
  if (params.timeseek > 0) {
    params.waitbeforestart=1;
  }
 else   if (renderer.isTranscodeFastStart()) {
    params.manageFastStart();
  }
 else {
    params.waitbeforestart=2500;
  }
  setAudioAndSubs(filename,media,params);
  cmdList.add(executable());
  cmdList.add("String_Node_Str");
  cmdList.add("String_Node_Str");
  if (LOGGER.isTraceEnabled()) {
    cmdList.add("String_Node_Str");
  }
 else {
    cmdList.add("String_Node_Str");
  }
  if (params.timeseek > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(params.timeseek));
  }
  if (nThreads > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(nThreads));
  }
  final boolean isTsMuxeRVideoEngineEnabled=configuration.getEnginesAsList(PMS.get().getRegistry()).contains(TsMuxeRVideo.ID);
  final boolean isXboxOneWebVideo=params.mediaRenderer.isXboxOne() && purpose() == VIDEO_WEBSTREAM_PLAYER;
  ac3Remux=false;
  dtsRemux=false;
  if (configuration.isAudioRemuxAC3() && params.aid != null && params.aid.isAC3() && !avisynth() && renderer.isTranscodeToAC3() && !isXboxOneWebVideo && params.aid.getAudioProperties().getNumberOfChannels() <= configuration.getAudioChannelCount()) {
    ac3Remux=true;
  }
 else {
    dtsRemux=isTsMuxeRVideoEngineEnabled && configuration.isAudioEmbedDtsInPcm() && params.aid != null && params.aid.isDTS() && !avisynth() && params.mediaRenderer.isDTSPlayable();
  }
  String frameRateRatio=media.getValidFps(true);
  String frameRateNumber=media.getValidFps(false);
  cmdList.add("String_Node_Str");
  if (avisynth && !filename.toLowerCase().endsWith("String_Node_Str")) {
    File avsFile=AviSynthFFmpeg.getAVSScript(filename,params.sid,params.fromFrame,params.toFrame,frameRateRatio,frameRateNumber,configuration);
    cmdList.add(ProcessUtil.getShortFileNameIfWideChars(avsFile.getAbsolutePath()));
  }
 else {
    cmdList.add(filename);
  }
  String prependTraceReason="String_Node_Str";
  if (!(renderer instanceof RendererConfiguration.OutputOverride) && params.sid != null && !(!configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder))) {
    boolean deferToMencoder=false;
    if (configuration.isFFmpegDeferToMEncoderForProblematicSubtitles() && params.sid.isEmbedded() && (params.sid.getType().isText() || params.sid.getType() == SubtitleType.VOBSUB)) {
      deferToMencoder=true;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
 else     if (media.isEmbeddedFontExists()) {
      deferToMencoder=true;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToMencoder) {
      MEncoderVideo mv=new MEncoderVideo();
      return mv.launchTranscode(dlna,media,params);
    }
  }
  if (!(renderer instanceof RendererConfiguration.OutputOverride) && configuration.isFFmpegMuxWithTsMuxerWhenCompatible()) {
    boolean deferToTsmuxer=true;
    prependTraceReason="String_Node_Str";
    if (deferToTsmuxer == true && !configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isMuxH264MpegTS()) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && params.sid != null) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && avisynth()) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && params.mediaRenderer.isH264Level41Limited() && !media.isVideoWithinH264LevelLimits(newInput,params.mediaRenderer)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !media.isMuxable(params.mediaRenderer)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !aspectRatiosMatch) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isPS3() && media.isWebDl(filename,params)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && "String_Node_Str".equals(media.getMatrixCoefficients())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && (params.mediaRenderer.isKeepAspectRatio() || params.mediaRenderer.isKeepAspectRatioTranscoding()) && !"String_Node_Str".equals(media.getAspectRatioContainer())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str" + media.getAspectRatioContainer()+ "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isResolutionCompatibleWithRenderer(media.getWidth(),media.getHeight())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer) {
      TsMuxeRVideo tv=new TsMuxeRVideo();
      params.forceFps=media.getValidFps(false);
      if (media.getCodecV() != null) {
        if (media.isH264()) {
          params.forceType="String_Node_Str";
        }
 else         if (media.getCodecV().startsWith("String_Node_Str")) {
          params.forceType="String_Node_Str";
        }
 else         if (media.getCodecV().equals("String_Node_Str")) {
          params.forceType="String_Node_Str";
        }
      }
      return tv.launchTranscode(dlna,media,params);
    }
  }
  cmdList.addAll(getVideoFilterOptions(dlna,media,params));
  if (media.getAudioTracksList().size() > 1) {
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str" + (media.getAudioTracksList().indexOf(params.aid)));
  }
  if (nThreads > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(nThreads));
  }
  if (params.timeend > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(params.timeend));
  }
  boolean override=false;
  if (renderer instanceof RendererConfiguration.OutputOverride) {
    override=((RendererConfiguration.OutputOverride)renderer).getOutputOptions(cmdList,dlna,this,params);
  }
  if (!override) {
    cmdList.addAll(getVideoBitrateOptions(dlna,media,params));
    String customFFmpegOptions=renderer.getCustomFFmpegOptions();
    if (!ac3Remux && !dtsRemux && !(type() == Format.AUDIO)) {
      int channels=0;
      if ((renderer.isTranscodeToWMV() && !renderer.isXbox360()) || (renderer.isXboxOne() && purpose() == VIDEO_WEBSTREAM_PLAYER)) {
        channels=2;
      }
 else       if (params.aid != null && params.aid.getAudioProperties().getNumberOfChannels() > configuration.getAudioChannelCount()) {
        channels=configuration.getAudioChannelCount();
      }
      if (!customFFmpegOptions.contains("String_Node_Str") && channels > 0) {
        cmdList.add("String_Node_Str");
        cmdList.add(String.valueOf(channels));
      }
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        cmdList.add("String_Node_Str");
        if (renderer.isTranscodeToAAC()) {
          cmdList.add(Math.min(configuration.getAudioBitrate(),320) + "String_Node_Str");
        }
 else {
          cmdList.add(String.valueOf(CodecUtil.getAC3Bitrate(configuration,params.aid)) + "String_Node_Str");
        }
      }
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        cmdList.add("String_Node_Str");
        cmdList.add("String_Node_Str" + params.mediaRenderer.getTranscodedVideoAudioSampleRate());
      }
    }
    cmdList.addAll(getVideoTranscodeOptions(dlna,media,params));
    if (StringUtils.isNotEmpty(customFFmpegOptions)) {
      parseOptions(customFFmpegOptions,cmdList);
    }
  }
  PipeProcess pipe=null;
  if (!dtsRemux) {
    String fifoName=String.format("String_Node_Str",Thread.currentThread().getId(),System.currentTimeMillis());
    pipe=new PipeProcess(fifoName);
    pipe.deleteLater();
    params.input_pipes[0]=pipe;
    cmdList.add(pipe.getInputPipe());
  }
  String[] cmdArray=new String[cmdList.size()];
  cmdList.toArray(cmdArray);
  cmdArray=finalizeTranscoderArgs(filename,dlna,media,params,cmdArray);
  ProcessWrapperImpl pw=new ProcessWrapperImpl(cmdArray,params);
  setOutputParsing(dlna,pw,false);
  if (!dtsRemux) {
    ProcessWrapper mkfifo_process=pipe.getPipeProcess();
    mkfifo_process.runInSameThread();
    pw.attachProcess(mkfifo_process);
    try {
      Thread.sleep(300);
    }
 catch (    InterruptedException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
 else {
    pipe=new PipeProcess(System.currentTimeMillis() + "String_Node_Str");
    TsMuxeRVideo ts=new TsMuxeRVideo();
    File f=new File(configuration.getTempFolder(),"String_Node_Str");
    String cmd[]=new String[]{ts.executable(),f.getAbsolutePath(),pipe.getInputPipe()};
    pw=new ProcessWrapperImpl(cmd,params);
    PipeIPCProcess ffVideoPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
    cmdList.add(ffVideoPipe.getInputPipe());
    OutputParams ffparams=new OutputParams(configuration);
    ffparams.maxBufferSize=1;
    ffparams.stdin=params.stdin;
    String[] cmdArrayDts=new String[cmdList.size()];
    cmdList.toArray(cmdArrayDts);
    cmdArrayDts=finalizeTranscoderArgs(filename,dlna,media,params,cmdArrayDts);
    ProcessWrapperImpl ffVideo=new ProcessWrapperImpl(cmdArrayDts,ffparams);
    ProcessWrapper ff_video_pipe_process=ffVideoPipe.getPipeProcess();
    pw.attachProcess(ff_video_pipe_process);
    ff_video_pipe_process.runInNewThread();
    ffVideoPipe.deleteLater();
    pw.attachProcess(ffVideo);
    ffVideo.runInNewThread();
    PipeIPCProcess ffAudioPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
    StreamModifier sm=new StreamModifier();
    sm.setPcm(false);
    sm.setDtsEmbed(dtsRemux);
    sm.setSampleFrequency(48000);
    sm.setBitsPerSample(16);
    sm.setNbChannels(2);
    List<String> cmdListDTS=new ArrayList<>();
    cmdListDTS.add(executable());
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    if (params.timeseek > 0) {
      cmdListDTS.add(String.valueOf(params.timeseek));
    }
 else {
      cmdListDTS.add("String_Node_Str");
    }
    if (params.stdin == null) {
      cmdListDTS.add("String_Node_Str");
    }
 else {
      cmdListDTS.add("String_Node_Str");
    }
    cmdListDTS.add(filename);
    if (params.timeseek > 0) {
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
    }
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add(ffAudioPipe.getInputPipe());
    String[] cmdArrayDTS=new String[cmdListDTS.size()];
    cmdListDTS.toArray(cmdArrayDTS);
    if (!params.mediaRenderer.isMuxDTSToMpeg()) {
      ffAudioPipe.setModifier(sm);
    }
    OutputParams ffaudioparams=new OutputParams(configuration);
    ffaudioparams.maxBufferSize=1;
    ffaudioparams.stdin=params.stdin;
    ProcessWrapperImpl ffAudio=new ProcessWrapperImpl(cmdArrayDTS,ffaudioparams);
    params.stdin=null;
    try (PrintWriter pwMux=new PrintWriter(f)){
      pwMux.println("String_Node_Str");
      String videoType="String_Node_Str";
      if (renderer.isTranscodeToH264()) {
        videoType="String_Node_Str";
      }
      if (params.no_videoencode && params.forceType != null) {
        videoType=params.forceType;
      }
      StringBuilder fps=new StringBuilder();
      fps.append("String_Node_Str");
      if (params.forceFps != null) {
        fps.append("String_Node_Str").append(params.forceFps).append("String_Node_Str");
      }
      String audioType="String_Node_Str";
      if (dtsRemux) {
        if (params.mediaRenderer.isMuxDTSToMpeg()) {
          audioType="String_Node_Str";
        }
 else {
          audioType="String_Node_Str";
        }
      }
      pwMux.println(videoType + "String_Node_Str" + ffVideoPipe.getOutputPipe()+ "String_Node_Str"+ fps+ "String_Node_Str");
      pwMux.println(audioType + "String_Node_Str" + ffAudioPipe.getOutputPipe()+ "String_Node_Str");
    }
     ProcessWrapper pipe_process=pipe.getPipeProcess();
    pw.attachProcess(pipe_process);
    pipe_process.runInNewThread();
    try {
      wait(50);
    }
 catch (    InterruptedException e) {
    }
    pipe.deleteLater();
    params.input_pipes[0]=pipe;
    ProcessWrapper ff_pipe_process=ffAudioPipe.getPipeProcess();
    pw.attachProcess(ff_pipe_process);
    ff_pipe_process.runInNewThread();
    try {
      wait(50);
    }
 catch (    InterruptedException e) {
    }
    ffAudioPipe.deleteLater();
    pw.attachProcess(ffAudio);
    ffAudio.runInNewThread();
  }
  pw.runInNewThread();
  try {
    Thread.sleep(200);
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str",e);
  }
  configuration=prev;
  return pw;
}

Fixed version (ground truth):
@Override public synchronized ProcessWrapper launchTranscode(DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  final String filename=dlna.getSystemName();
  InputFile newInput=new InputFile();
  newInput.setFilename(filename);
  newInput.setPush(params.stdin);
  PmsConfiguration prev=configuration;
  configuration=(DeviceConfiguration)params.mediaRenderer;
  RendererConfiguration renderer=params.mediaRenderer;
  boolean aspectRatiosMatch=true;
  if (media.getAspectRatioContainer() != null && media.getAspectRatioVideoTrack() != null && !media.getAspectRatioContainer().equals(media.getAspectRatioVideoTrack())) {
    aspectRatiosMatch=false;
  }
  int nThreads=1;
  if (configuration.isFfmpegMultithreading()) {
    if (Runtime.getRuntime().availableProcessors() == configuration.getNumberOfCpuCores()) {
      nThreads=0;
    }
 else {
      nThreads=configuration.getNumberOfCpuCores();
    }
  }
  List<String> cmdList=new ArrayList<>();
  boolean avisynth=avisynth();
  if (params.timeseek > 0) {
    params.waitbeforestart=1;
  }
 else   if (renderer.isTranscodeFastStart()) {
    params.manageFastStart();
  }
 else {
    params.waitbeforestart=2500;
  }
  setAudioAndSubs(filename,media,params);
  dlna.setMediaSubtitle(params.sid);
  cmdList.add(executable());
  cmdList.add("String_Node_Str");
  cmdList.add("String_Node_Str");
  if (LOGGER.isTraceEnabled()) {
    cmdList.add("String_Node_Str");
  }
 else {
    cmdList.add("String_Node_Str");
  }
  if (params.timeseek > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(params.timeseek));
  }
  if (nThreads > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(nThreads));
  }
  final boolean isTsMuxeRVideoEngineEnabled=configuration.getEnginesAsList(PMS.get().getRegistry()).contains(TsMuxeRVideo.ID);
  final boolean isXboxOneWebVideo=params.mediaRenderer.isXboxOne() && purpose() == VIDEO_WEBSTREAM_PLAYER;
  ac3Remux=false;
  dtsRemux=false;
  if (configuration.isAudioRemuxAC3() && params.aid != null && params.aid.isAC3() && !avisynth() && renderer.isTranscodeToAC3() && !isXboxOneWebVideo && params.aid.getAudioProperties().getNumberOfChannels() <= configuration.getAudioChannelCount()) {
    ac3Remux=true;
  }
 else {
    dtsRemux=isTsMuxeRVideoEngineEnabled && configuration.isAudioEmbedDtsInPcm() && params.aid != null && params.aid.isDTS() && !avisynth() && params.mediaRenderer.isDTSPlayable();
  }
  String frameRateRatio=media.getValidFps(true);
  String frameRateNumber=media.getValidFps(false);
  cmdList.add("String_Node_Str");
  if (avisynth && !filename.toLowerCase().endsWith("String_Node_Str")) {
    File avsFile=AviSynthFFmpeg.getAVSScript(filename,params.sid,params.fromFrame,params.toFrame,frameRateRatio,frameRateNumber,configuration);
    cmdList.add(ProcessUtil.getShortFileNameIfWideChars(avsFile.getAbsolutePath()));
  }
 else {
    cmdList.add(filename);
  }
  String prependTraceReason="String_Node_Str";
  if (!(renderer instanceof RendererConfiguration.OutputOverride) && params.sid != null && !(!configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder))) {
    boolean deferToMencoder=false;
    if (configuration.isFFmpegDeferToMEncoderForProblematicSubtitles() && params.sid.isEmbedded() && (params.sid.getType().isText() || params.sid.getType() == SubtitleType.VOBSUB)) {
      deferToMencoder=true;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
 else     if (media.isEmbeddedFontExists()) {
      deferToMencoder=true;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToMencoder) {
      MEncoderVideo mv=new MEncoderVideo();
      return mv.launchTranscode(dlna,media,params);
    }
  }
  if (!(renderer instanceof RendererConfiguration.OutputOverride) && configuration.isFFmpegMuxWithTsMuxerWhenCompatible()) {
    boolean deferToTsmuxer=true;
    prependTraceReason="String_Node_Str";
    if (deferToTsmuxer == true && !configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isMuxH264MpegTS()) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && params.sid != null) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && avisynth()) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && params.mediaRenderer.isH264Level41Limited() && !media.isVideoWithinH264LevelLimits(newInput,params.mediaRenderer)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !media.isMuxable(params.mediaRenderer)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !aspectRatiosMatch) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isPS3() && media.isWebDl(filename,params)) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && "String_Node_Str".equals(media.getMatrixCoefficients())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer == true && (params.mediaRenderer.isKeepAspectRatio() || params.mediaRenderer.isKeepAspectRatioTranscoding()) && !"String_Node_Str".equals(media.getAspectRatioContainer())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str" + media.getAspectRatioContainer()+ "String_Node_Str");
    }
    if (deferToTsmuxer == true && !params.mediaRenderer.isResolutionCompatibleWithRenderer(media.getWidth(),media.getHeight())) {
      deferToTsmuxer=false;
      LOGGER.trace(prependTraceReason + "String_Node_Str");
    }
    if (deferToTsmuxer) {
      TsMuxeRVideo tv=new TsMuxeRVideo();
      params.forceFps=media.getValidFps(false);
      if (media.getCodecV() != null) {
        if (media.isH264()) {
          params.forceType="String_Node_Str";
        }
 else         if (media.getCodecV().startsWith("String_Node_Str")) {
          params.forceType="String_Node_Str";
        }
 else         if (media.getCodecV().equals("String_Node_Str")) {
          params.forceType="String_Node_Str";
        }
      }
      return tv.launchTranscode(dlna,media,params);
    }
  }
  cmdList.addAll(getVideoFilterOptions(dlna,media,params));
  if (media.getAudioTracksList().size() > 1) {
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str");
    cmdList.add("String_Node_Str" + (media.getAudioTracksList().indexOf(params.aid)));
  }
  if (nThreads > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(nThreads));
  }
  if (params.timeend > 0) {
    cmdList.add("String_Node_Str");
    cmdList.add(String.valueOf(params.timeend));
  }
  boolean override=false;
  if (renderer instanceof RendererConfiguration.OutputOverride) {
    override=((RendererConfiguration.OutputOverride)renderer).getOutputOptions(cmdList,dlna,this,params);
  }
  if (!override) {
    cmdList.addAll(getVideoBitrateOptions(dlna,media,params));
    String customFFmpegOptions=renderer.getCustomFFmpegOptions();
    if (!ac3Remux && !dtsRemux && !(type() == Format.AUDIO)) {
      int channels=0;
      if ((renderer.isTranscodeToWMV() && !renderer.isXbox360()) || (renderer.isXboxOne() && purpose() == VIDEO_WEBSTREAM_PLAYER)) {
        channels=2;
      }
 else       if (params.aid != null && params.aid.getAudioProperties().getNumberOfChannels() > configuration.getAudioChannelCount()) {
        channels=configuration.getAudioChannelCount();
      }
      if (!customFFmpegOptions.contains("String_Node_Str") && channels > 0) {
        cmdList.add("String_Node_Str");
        cmdList.add(String.valueOf(channels));
      }
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        cmdList.add("String_Node_Str");
        if (renderer.isTranscodeToAAC()) {
          cmdList.add(Math.min(configuration.getAudioBitrate(),320) + "String_Node_Str");
        }
 else {
          cmdList.add(String.valueOf(CodecUtil.getAC3Bitrate(configuration,params.aid)) + "String_Node_Str");
        }
      }
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        cmdList.add("String_Node_Str");
        cmdList.add("String_Node_Str" + params.mediaRenderer.getTranscodedVideoAudioSampleRate());
      }
    }
    cmdList.addAll(getVideoTranscodeOptions(dlna,media,params));
    if (StringUtils.isNotEmpty(customFFmpegOptions)) {
      parseOptions(customFFmpegOptions,cmdList);
    }
  }
  PipeProcess pipe=null;
  if (!dtsRemux) {
    String fifoName=String.format("String_Node_Str",Thread.currentThread().getId(),System.currentTimeMillis());
    pipe=new PipeProcess(fifoName);
    pipe.deleteLater();
    params.input_pipes[0]=pipe;
    cmdList.add(pipe.getInputPipe());
  }
  String[] cmdArray=new String[cmdList.size()];
  cmdList.toArray(cmdArray);
  cmdArray=finalizeTranscoderArgs(filename,dlna,media,params,cmdArray);
  ProcessWrapperImpl pw=new ProcessWrapperImpl(cmdArray,params);
  setOutputParsing(dlna,pw,false);
  if (!dtsRemux) {
    ProcessWrapper mkfifo_process=pipe.getPipeProcess();
    mkfifo_process.runInSameThread();
    pw.attachProcess(mkfifo_process);
    try {
      Thread.sleep(300);
    }
 catch (    InterruptedException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
 else {
    pipe=new PipeProcess(System.currentTimeMillis() + "String_Node_Str");
    TsMuxeRVideo ts=new TsMuxeRVideo();
    File f=new File(configuration.getTempFolder(),"String_Node_Str");
    String cmd[]=new String[]{ts.executable(),f.getAbsolutePath(),pipe.getInputPipe()};
    pw=new ProcessWrapperImpl(cmd,params);
    PipeIPCProcess ffVideoPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
    cmdList.add(ffVideoPipe.getInputPipe());
    OutputParams ffparams=new OutputParams(configuration);
    ffparams.maxBufferSize=1;
    ffparams.stdin=params.stdin;
    String[] cmdArrayDts=new String[cmdList.size()];
    cmdList.toArray(cmdArrayDts);
    cmdArrayDts=finalizeTranscoderArgs(filename,dlna,media,params,cmdArrayDts);
    ProcessWrapperImpl ffVideo=new ProcessWrapperImpl(cmdArrayDts,ffparams);
    ProcessWrapper ff_video_pipe_process=ffVideoPipe.getPipeProcess();
    pw.attachProcess(ff_video_pipe_process);
    ff_video_pipe_process.runInNewThread();
    ffVideoPipe.deleteLater();
    pw.attachProcess(ffVideo);
    ffVideo.runInNewThread();
    PipeIPCProcess ffAudioPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
    StreamModifier sm=new StreamModifier();
    sm.setPcm(false);
    sm.setDtsEmbed(dtsRemux);
    sm.setSampleFrequency(48000);
    sm.setBitsPerSample(16);
    sm.setNbChannels(2);
    List<String> cmdListDTS=new ArrayList<>();
    cmdListDTS.add(executable());
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    if (params.timeseek > 0) {
      cmdListDTS.add(String.valueOf(params.timeseek));
    }
 else {
      cmdListDTS.add("String_Node_Str");
    }
    if (params.stdin == null) {
      cmdListDTS.add("String_Node_Str");
    }
 else {
      cmdListDTS.add("String_Node_Str");
    }
    cmdListDTS.add(filename);
    if (params.timeseek > 0) {
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
      cmdListDTS.add("String_Node_Str");
    }
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add("String_Node_Str");
    cmdListDTS.add(ffAudioPipe.getInputPipe());
    String[] cmdArrayDTS=new String[cmdListDTS.size()];
    cmdListDTS.toArray(cmdArrayDTS);
    if (!params.mediaRenderer.isMuxDTSToMpeg()) {
      ffAudioPipe.setModifier(sm);
    }
    OutputParams ffaudioparams=new OutputParams(configuration);
    ffaudioparams.maxBufferSize=1;
    ffaudioparams.stdin=params.stdin;
    ProcessWrapperImpl ffAudio=new ProcessWrapperImpl(cmdArrayDTS,ffaudioparams);
    params.stdin=null;
    try (PrintWriter pwMux=new PrintWriter(f)){
      pwMux.println("String_Node_Str");
      String videoType="String_Node_Str";
      if (renderer.isTranscodeToH264()) {
        videoType="String_Node_Str";
      }
      if (params.no_videoencode && params.forceType != null) {
        videoType=params.forceType;
      }
      StringBuilder fps=new StringBuilder();
      fps.append("String_Node_Str");
      if (params.forceFps != null) {
        fps.append("String_Node_Str").append(params.forceFps).append("String_Node_Str");
      }
      String audioType="String_Node_Str";
      if (dtsRemux) {
        if (params.mediaRenderer.isMuxDTSToMpeg()) {
          audioType="String_Node_Str";
        }
 else {
          audioType="String_Node_Str";
        }
      }
      pwMux.println(videoType + "String_Node_Str" + ffVideoPipe.getOutputPipe()+ "String_Node_Str"+ fps+ "String_Node_Str");
      pwMux.println(audioType + "String_Node_Str" + ffAudioPipe.getOutputPipe()+ "String_Node_Str");
    }
     ProcessWrapper pipe_process=pipe.getPipeProcess();
    pw.attachProcess(pipe_process);
    pipe_process.runInNewThread();
    try {
      wait(50);
    }
 catch (    InterruptedException e) {
    }
    pipe.deleteLater();
    params.input_pipes[0]=pipe;
    ProcessWrapper ff_pipe_process=ffAudioPipe.getPipeProcess();
    pw.attachProcess(ff_pipe_process);
    ff_pipe_process.runInNewThread();
    try {
      wait(50);
    }
 catch (    InterruptedException e) {
    }
    ffAudioPipe.deleteLater();
    pw.attachProcess(ffAudio);
    ffAudio.runInNewThread();
  }
  pw.runInNewThread();
  try {
    Thread.sleep(200);
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str",e);
  }
  configuration=prev;
  return pw;
}