Program: 47310
Project: 47310
Buggy source:
@Override public ProcessWrapper launchTranscode(String fileName,DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  params.manageFastStart();
  boolean avisynth=avisynth();
  setAudioAndSubs(fileName,media,params,configuration);
  String subString=null;
  if (params.sid != null && params.sid.getPlayableExternalFile() != null) {
    subString=ProcessUtil.getShortFileNameIfWideChars(params.sid.getPlayableExternalFile().getAbsolutePath());
  }
  InputFile newInput=new InputFile();
  newInput.setFilename(fileName);
  newInput.setPush(params.stdin);
  dvd=false;
  if (media != null && media.getDvdtrack() > 0) {
    dvd=true;
  }
  boolean forceMencoder=!configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder);
  ovccopy=false;
  int intOCW=0;
  int intOCH=0;
  try {
    intOCW=Integer.parseInt(configuration.getMencoderOverscanCompensationWidth());
  }
 catch (  NumberFormatException e) {
    LOGGER.error("String_Node_Str",configuration.getMencoderOverscanCompensationWidth());
  }
  try {
    intOCH=Integer.parseInt(configuration.getMencoderOverscanCompensationHeight());
  }
 catch (  NumberFormatException e) {
    LOGGER.error("String_Node_Str",configuration.getMencoderOverscanCompensationHeight());
  }
  if (!forceMencoder && params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && media.isMuxable(params.mediaRenderer) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS() && (intOCW == 0 && intOCH == 0)) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    boolean nomux=false;
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        nomux=true;
      }
    }
    if (!nomux) {
      TSMuxerVideo tv=new TSMuxerVideo(configuration);
      params.forceFps=media.getValidFps(false);
      if (media.getCodecV().equals("String_Node_Str")) {
        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(fileName,dlna,media,params);
    }
  }
 else   if (params.sid == null && dvd && configuration.isMencoderRemuxMPEG2() && params.mediaRenderer.isMpeg2Supported()) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    boolean nomux=false;
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        nomux=true;
      }
    }
    if (!nomux) {
      ovccopy=true;
    }
  }
  String vcodec="String_Node_Str";
  wmv=false;
  if (params.mediaRenderer.isTranscodeToWMV()) {
    wmv=true;
    vcodec="String_Node_Str";
  }
  mpegts=params.mediaRenderer.isTranscodeToMPEGTSAC3();
  oaccopy=false;
  boolean ps3_and_stereo_and_384_kbits=params.aid != null && (params.mediaRenderer.getRendererUniqueID().equalsIgnoreCase(RENDERER_ID_PLAYSTATION3) && params.aid.getAudioProperties().getNumberOfChannels() == 2) && (params.aid.getBitRate() > 370000 && params.aid.getBitRate() < 400000);
  if (configuration.isRemuxAC3() && params.aid != null && params.aid.isAC3() && !ps3_and_stereo_and_384_kbits && !avisynth() && params.mediaRenderer.isTranscodeToAC3()) {
    oaccopy=true;
  }
 else {
    dtsRemux=configuration.isDTSEmbedInPCM() && (!dvd || configuration.isMencoderRemuxMPEG2()) && params.aid != null && params.aid.isDTS() && !avisynth() && params.mediaRenderer.isDTSPlayable();
    pcm=configuration.isMencoderUsePcm() && (!dvd || configuration.isMencoderRemuxMPEG2()) && !(media.getContainer().equals("String_Node_Str") && !media.getCodecV().equals("String_Node_Str"))&& params.aid != null && ((params.aid.isDTS() && params.aid.getAudioProperties().getNumberOfChannels() <= 6) || params.aid.isLossless() || params.aid.isTrueHD()|| (!configuration.isMencoderUsePcmForHQAudioOnly() && (params.aid.isAC3() || params.aid.isMP3() || params.aid.isAAC()|| params.aid.isVorbis()|| params.aid.isMpegAudio()))) && params.mediaRenderer.isLPCMPlayable();
  }
  if (dtsRemux || pcm) {
    if (dtsRemux) {
      oaccopy=true;
    }
    params.losslessaudio=true;
    params.forceFps=media.getValidFps(false);
  }
  if (!pcm && !dtsRemux && !ac3Remux&& ovccopy) {
    ovccopy=false;
  }
  if (pcm && avisynth()) {
    params.avidemux=true;
  }
  int channels;
  if (ac3Remux) {
    channels=params.aid.getAudioProperties().getNumberOfChannels();
  }
 else   if (dtsRemux || wmv) {
    channels=2;
  }
 else   if (pcm) {
    channels=params.aid.getAudioProperties().getNumberOfChannels();
  }
 else {
    channels=configuration.getAudioChannelCount();
  }
  LOGGER.trace("String_Node_Str" + channels);
  String add="String_Node_Str";
  String rendererMencoderOptions=params.mediaRenderer.getCustomMencoderOptions();
  String mencoderCustomOptions=configuration.getMencoderCustomOptions();
  String combinedCustomOptions=defaultString(mencoderCustomOptions) + "String_Node_Str" + defaultString(rendererMencoderOptions);
  if (!combinedCustomOptions.contains("String_Node_Str")) {
    add="String_Node_Str";
  }
  if (isNotBlank(rendererMencoderOptions)) {
    if (rendererMencoderOptions.contains("String_Node_Str") || dvd) {
      rendererMencoderOptions=null;
    }
  }
  StringTokenizer st=new StringTokenizer("String_Node_Str" + channels + (isNotBlank(mencoderCustomOptions) ? "String_Node_Str" + mencoderCustomOptions : "String_Node_Str")+ (isNotBlank(rendererMencoderOptions) ? "String_Node_Str" + rendererMencoderOptions : "String_Node_Str")+ add,"String_Node_Str");
  overriddenMainArgs=new String[st.countTokens()];
  int i=0;
  boolean handleToken=false;
  int nThreads=(dvd || fileName.toLowerCase().endsWith("String_Node_Str")) ? 1 : configuration.getMencoderMaxThreads();
  while (st.hasMoreTokens()) {
    String token=st.nextToken().trim();
    if (handleToken) {
      token+="String_Node_Str" + nThreads;
      if (configuration.getSkipLoopFilterEnabled() && !avisynth()) {
        token+="String_Node_Str";
      }
      handleToken=false;
    }
    if (token.toLowerCase().contains("String_Node_Str")) {
      handleToken=true;
    }
    overriddenMainArgs[i++]=token;
  }
  if (configuration.getMencoderMainSettings() != null) {
    String mainConfig=configuration.getMencoderMainSettings();
    String customSettings=params.mediaRenderer.getCustomMencoderQualitySettings();
    if (isNotBlank(customSettings)) {
      mainConfig=customSettings;
    }
    if (mainConfig.contains("String_Node_Str")) {
      mainConfig=mainConfig.substring(mainConfig.indexOf("String_Node_Str"));
    }
    int cbr_bitrate=params.mediaRenderer.getCBRVideoBitrate();
    String cbr_settings=(cbr_bitrate > 0) ? "String_Node_Str" + cbr_bitrate + "String_Node_Str"+ cbr_bitrate+ "String_Node_Str"+ ((cbr_bitrate > 16000) ? cbr_bitrate * 1000 : cbr_bitrate) : "String_Node_Str";
    String encodeSettings="String_Node_Str" + vcodec + (wmv ? "String_Node_Str" : (cbr_settings + "String_Node_Str" + (configuration.isMencoderAc3Fixed() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ CodecUtil.getAC3Bitrate(configuration,params.aid)))+ "String_Node_Str"+ (wmv ? 1 : configuration.getMencoderMaxThreads())+ ("String_Node_Str".equals(mainConfig) ? "String_Node_Str" : "String_Node_Str" + mainConfig);
    String audioType="String_Node_Str";
    if (dtsRemux) {
      audioType="String_Node_Str";
    }
 else     if (pcm) {
      audioType="String_Node_Str";
    }
    encodeSettings=addMaximumBitrateConstraints(encodeSettings,media,mainConfig,params.mediaRenderer,audioType);
    st=new StringTokenizer(encodeSettings,"String_Node_Str");
    int oldc=overriddenMainArgs.length;
    overriddenMainArgs=Arrays.copyOf(overriddenMainArgs,overriddenMainArgs.length + st.countTokens());
    i=oldc;
    while (st.hasMoreTokens()) {
      overriddenMainArgs[i++]=st.nextToken();
    }
  }
  boolean foundNoassParam=false;
  if (media != null) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        foundNoassParam=true;
      }
    }
  }
  StringBuilder sb=new StringBuilder();
  if (!configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null) {
    int subtitleMargin=0;
    int userMargin=0;
    boolean apply_ass_styling=params.sid.getType() != SubtitleType.VOBSUB && params.sid.getType() != SubtitleType.PGS && configuration.isMencoderAss() && !foundNoassParam && !dvd;
    if (apply_ass_styling) {
      sb.append("String_Node_Str");
      boolean override_ass_style=!configuration.isMencoderAssDefaultStyle() || params.sid.getType() == SubtitleType.SUBRIP || params.sid.getType() == SubtitleType.TX3G;
      if (override_ass_style) {
        String assSubColor="String_Node_Str";
        if (configuration.getSubsColor() != 0) {
          assSubColor=Integer.toHexString(configuration.getSubsColor());
          if (assSubColor.length() > 2) {
            assSubColor=assSubColor.substring(2) + "String_Node_Str";
          }
        }
        sb.append("String_Node_Str").append(assSubColor).append("String_Node_Str").append(configuration.getMencoderAssScale());
        if (configuration.getMencoderFont() != null && configuration.getMencoderFont().length() > 0) {
          sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
          sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
        }
 else {
          String font=CodecUtil.getDefaultFontPath();
          if (isNotBlank(font)) {
            sb.append("String_Node_Str").append(font).append("String_Node_Str");
            sb.append("String_Node_Str").append(font).append("String_Node_Str");
          }
 else {
            sb.append("String_Node_Str");
            sb.append("String_Node_Str");
          }
        }
        if (intOCH > 0) {
          subtitleMargin=(media.getHeight() / 100) * intOCH;
        }
        sb.append("String_Node_Str").append(configuration.getMencoderAssOutline()).append("String_Node_Str").append(configuration.getMencoderAssShadow());
        try {
          userMargin=Integer.parseInt(configuration.getMencoderAssMargin());
        }
 catch (        NumberFormatException n) {
          LOGGER.debug("String_Node_Str" + configuration.getMencoderAssMargin() + "String_Node_Str");
        }
        subtitleMargin=subtitleMargin + userMargin;
        sb.append("String_Node_Str").append(subtitleMargin).append("String_Node_Str");
      }
 else       if (intOCH > 0) {
        sb.append("String_Node_Str").append(subtitleMargin).append("String_Node_Str");
      }
      if (!params.sid.isEmbedded()) {
        sb.append("String_Node_Str");
      }
    }
 else {
      if (configuration.getMencoderFont() != null && configuration.getMencoderFont().length() > 0) {
        sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
      }
 else {
        String font=CodecUtil.getDefaultFontPath();
        if (isNotBlank(font)) {
          sb.append("String_Node_Str").append(font).append("String_Node_Str");
        }
      }
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssScale());
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssOutline());
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssBlur());
      if (intOCH > 0) {
        subtitleMargin=intOCH;
      }
      try {
        userMargin=Integer.parseInt(configuration.getMencoderNoAssSubPos());
      }
 catch (      NumberFormatException n) {
        LOGGER.debug("String_Node_Str" + configuration.getMencoderNoAssSubPos() + "String_Node_Str");
      }
      subtitleMargin=subtitleMargin + userMargin;
      sb.append("String_Node_Str").append(100 - subtitleMargin).append("String_Node_Str");
    }
    sb.append("String_Node_Str").append(configuration.isMencoderFontConfig() ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str");
    if (params.sid.getType() == SubtitleType.VOBSUB && configuration.getMencoderVobsubSubtitleQuality() != null) {
      String subtitleQuality=configuration.getMencoderVobsubSubtitleQuality();
      sb.append("String_Node_Str").append(subtitleQuality).append("String_Node_Str");
    }
    if (!configuration.isMencoderDisableSubs() && configuration.getMencoderSubCp() != null && configuration.getMencoderSubCp().length() > 0) {
      sb.append("String_Node_Str").append(configuration.getMencoderSubCp()).append("String_Node_Str");
      if (configuration.isMencoderSubFribidi()) {
        sb.append("String_Node_Str").append(configuration.getMencoderSubCp()).append("String_Node_Str");
      }
    }
  }
  st=new StringTokenizer(sb.toString(),"String_Node_Str");
  int oldc=overriddenMainArgs.length;
  overriddenMainArgs=Arrays.copyOf(overriddenMainArgs,overriddenMainArgs.length + st.countTokens());
  i=oldc;
  handleToken=false;
  while (st.hasMoreTokens()) {
    String s=st.nextToken();
    if (handleToken) {
      s="String_Node_Str";
      handleToken=false;
    }
    if ((!configuration.isMencoderAss() || dvd) && s.contains("String_Node_Str")) {
      s="String_Node_Str";
      handleToken=true;
    }
    overriddenMainArgs[i++]=s;
  }
  String cmdArray[]=new String[18 + args().length];
  cmdArray[0]=executable();
  cmdArray[1]="String_Node_Str";
  if (params.timeseek > 0) {
    cmdArray[2]="String_Node_Str" + params.timeseek;
  }
 else {
    cmdArray[2]="String_Node_Str";
  }
  if (dvd) {
    cmdArray[3]="String_Node_Str";
  }
 else {
    cmdArray[3]="String_Node_Str";
  }
  String frameRateRatio=null;
  String frameRateNumber=null;
  if (media != null) {
    frameRateRatio=media.getValidFps(true);
    frameRateNumber=media.getValidFps(false);
  }
  if (avisynth && !fileName.toLowerCase().endsWith("String_Node_Str")) {
    File avsFile=FFMpegAviSynthVideo.getAVSScript(fileName,params.sid,params.fromFrame,params.toFrame,frameRateRatio,frameRateNumber,false);
    cmdArray[4]=ProcessUtil.getShortFileNameIfWideChars(avsFile.getAbsolutePath());
  }
 else {
    cmdArray[4]=fileName;
    if (params.stdin != null) {
      cmdArray[4]="String_Node_Str";
    }
  }
  if (dvd) {
    cmdArray[5]="String_Node_Str" + media.getDvdtrack();
  }
 else {
    cmdArray[5]="String_Node_Str";
  }
  String arguments[]=args();
  for (i=0; i < arguments.length; i++) {
    cmdArray[6 + i]=arguments[i];
    if (arguments[i].contains("String_Node_Str") && media.getAspect() != null && media.getValidAspect(true) != null) {
      cmdArray[6 + i]+="String_Node_Str" + media.getValidAspect(true);
    }
  }
  cmdArray[cmdArray.length - 12]="String_Node_Str";
  cmdArray[cmdArray.length - 11]="String_Node_Str";
  cmdArray[cmdArray.length - 10]="String_Node_Str";
  cmdArray[cmdArray.length - 9]="String_Node_Str";
  if (!dtsRemux && !pcm && !avisynth()&& params.aid != null && media.getAudioTracksList().size() > 1) {
    cmdArray[cmdArray.length - 12]="String_Node_Str";
    boolean lavf=false;
    cmdArray[cmdArray.length - 11]="String_Node_Str" + (lavf ? params.aid.getId() + 1 : params.aid.getId());
  }
  if (subString == null && params.sid != null) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str" + params.sid.getId();
  }
 else   if (subString != null && !avisynth()) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str";
  }
 else   if (subString == null) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str";
  }
  cmdArray[cmdArray.length - 8]="String_Node_Str";
  cmdArray[cmdArray.length - 7]="String_Node_Str";
  if (configuration.isMencoderForceFps() && !configuration.isFix25FPSAvMismatch()) {
    cmdArray[cmdArray.length - 8]="String_Node_Str";
    cmdArray[cmdArray.length - 7]="String_Node_Str";
  }
  cmdArray[cmdArray.length - 6]="String_Node_Str";
  cmdArray[cmdArray.length - 5]="String_Node_Str";
  if (frameRateRatio != null) {
    cmdArray[cmdArray.length - 5]=frameRateRatio;
    if (configuration.isMencoderForceFps()) {
      if (configuration.isFix25FPSAvMismatch()) {
        cmdArray[cmdArray.length - 8]="String_Node_Str";
        cmdArray[cmdArray.length - 7]="String_Node_Str";
        cmdArray[cmdArray.length - 5]="String_Node_Str";
      }
 else {
        cmdArray[cmdArray.length - 7]=cmdArray[cmdArray.length - 5];
      }
    }
  }
  if (avisynth() && configuration.getAvisynthInterFrame() && !"String_Node_Str".equals(frameRateRatio)&& !"String_Node_Str".equals(frameRateRatio)&& !"String_Node_Str".equals(frameRateRatio)) {
    if ("String_Node_Str".equals(frameRateRatio)) {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
 else     if ("String_Node_Str".equals(frameRateRatio)) {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
 else {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
  }
  if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null) {
    if (params.sid.getType() == SubtitleType.VOBSUB) {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]=subString.substring(0,subString.length() - 4);
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]="String_Node_Str" + params.sid.getLang();
    }
 else {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]=subString.replace("String_Node_Str","String_Node_Str");
      if (params.sid.getPlayableExternalFile() != null && params.sid.isExternalFileUtf8()) {
        cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 1);
        cmdArray[cmdArray.length - 3]="String_Node_Str";
      }
    }
  }
 else {
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  if (fileName.toLowerCase().endsWith("String_Node_Str")) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  boolean deinterlace=configuration.isMencoderYadif();
  boolean isResolutionTooHighForRenderer=params.mediaRenderer.isVideoRescale() && media != null && ((media.getWidth() > params.mediaRenderer.getMaxVideoWidth()) || (media.getHeight() > params.mediaRenderer.getMaxVideoHeight()));
  boolean scaleBool=isResolutionTooHighForRenderer || (configuration.isMencoderScaler() && (configuration.getMencoderScaleX() != 0 || configuration.getMencoderScaleY() != 0)) || (intOCW > 0 || intOCH > 0);
  if ((deinterlace || scaleBool) && !avisynth()) {
    StringBuilder vfValueOverscanPrepend=new StringBuilder();
    StringBuilder vfValueOverscanMiddle=new StringBuilder();
    StringBuilder vfValueVS=new StringBuilder();
    StringBuilder vfValueComplete=new StringBuilder();
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    String deinterlaceComma="String_Node_Str";
    int scaleWidth=0;
    int scaleHeight=0;
    double rendererAspectRatio;
    if (media != null && media.getWidth() > 0 && media.getHeight() > 0) {
      scaleWidth=media.getWidth();
      scaleHeight=media.getHeight();
    }
    if (intOCW > 0 || intOCH > 0) {
      int intOCWPixels=(media.getWidth() / 100) * intOCW;
      int intOCHPixels=(media.getHeight() / 100) * intOCH;
      scaleWidth=scaleWidth + intOCWPixels;
      scaleHeight=scaleHeight + intOCHPixels;
      if (params.mediaRenderer.isVideoRescale() && ((scaleWidth > params.mediaRenderer.getMaxVideoWidth()) || (scaleHeight > params.mediaRenderer.getMaxVideoHeight()))) {
        double overscannedAspectRatio=scaleWidth / scaleHeight;
        rendererAspectRatio=params.mediaRenderer.getMaxVideoWidth() / params.mediaRenderer.getMaxVideoHeight();
        if (overscannedAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / overscannedAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * overscannedAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      vfValueOverscanPrepend.append("String_Node_Str").append(intOCWPixels).append("String_Node_Str").append(intOCHPixels);
      vfValueOverscanMiddle.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
    if (configuration.isMencoderScaler()) {
      if (configuration.getMencoderScaleX() != 0) {
        if (configuration.getMencoderScaleX() <= params.mediaRenderer.getMaxVideoWidth()) {
          scaleWidth=configuration.getMencoderScaleX();
        }
 else {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
        }
      }
      if (configuration.getMencoderScaleY() != 0) {
        if (configuration.getMencoderScaleY() <= params.mediaRenderer.getMaxVideoHeight()) {
          scaleHeight=configuration.getMencoderScaleY();
        }
 else {
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      vfValueVS.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
 else     if (media != null && media.getWidth() > 0 && media.getHeight() > 0 && (media.getWidth() > params.mediaRenderer.getMaxVideoWidth() || media.getHeight() > params.mediaRenderer.getMaxVideoHeight())) {
      double videoAspectRatio=(double)media.getWidth() / (double)media.getHeight();
      rendererAspectRatio=(double)params.mediaRenderer.getMaxVideoWidth() / (double)params.mediaRenderer.getMaxVideoHeight();
      if (media.getWidth() == 3840 && media.getHeight() == 1080) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 2160) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 1088) {
        scaleWidth=1920;
        scaleHeight=1088;
      }
 else {
        if (videoAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / videoAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * videoAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      vfValueVS.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
    if (intOCW > 0 || intOCH > 0) {
      vfValueComplete.append(vfValueOverscanPrepend).append(vfValueOverscanMiddle).append("String_Node_Str");
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
    }
 else {
      vfValueComplete.append(vfValueVS);
    }
    if (deinterlace) {
      deinterlaceComma="String_Node_Str";
    }
    cmdArray[cmdArray.length - 3]=(deinterlace ? "String_Node_Str" : "String_Node_Str") + (scaleBool ? deinterlaceComma + vfValueComplete : "String_Node_Str");
  }
  if (media != null && (media.getWidth() % 4 != 0) || media.getHeight() % 4 != 0) {
    int expandBorderWidth;
    int expandBorderHeight;
    expandBorderWidth=media.getWidth() % 4;
    expandBorderHeight=media.getHeight() % 4;
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str" + expandBorderWidth + "String_Node_Str"+ expandBorderHeight;
  }
  if (configuration.getMencoderMT() && !avisynth && !dvd&& !(media.getCodecV() != null && (media.getCodecV().equals("String_Node_Str")))) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  boolean noMC0NoSkip=false;
  if (media != null) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    if (sArgs != null && sArgs.length > 0) {
      boolean vfConsumed=false;
      boolean afConsumed=false;
      for (int s=0; s < sArgs.length; s++) {
        if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]="String_Node_Str" + vcodec + "String_Node_Str"+ (configuration.isMencoderAc3Fixed() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ CodecUtil.getAC3Bitrate(configuration,params.aid)+ "String_Node_Str"+ configuration.getMencoderMaxThreads()+ "String_Node_Str"+ sArgs[s + 1];
              addMaximumBitrateConstraints(cmdArray[c + 1],media,cmdArray[c + 1],params.mediaRenderer,"String_Node_Str");
              sArgs[s + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
              vfConsumed=true;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
              afConsumed=true;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          noMC0NoSkip=true;
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          noMC0NoSkip=true;
        }
      }
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + sArgs.length);
      for (int s=0; s < sArgs.length; s++) {
        if (sArgs[s].equals("String_Node_Str") || sArgs[s].equals("String_Node_Str") || sArgs[s].equals("String_Node_Str")|| (sArgs[s].equals("String_Node_Str") & vfConsumed)|| (sArgs[s].equals("String_Node_Str") && afConsumed)|| sArgs[s].equals("String_Node_Str")|| sArgs[s].equals("String_Node_Str")|| sArgs[s].equals("String_Node_Str")) {
          cmdArray[cmdArray.length - sArgs.length - 2 + s]="String_Node_Str";
        }
 else {
          cmdArray[cmdArray.length - sArgs.length - 2 + s]=sArgs[s];
        }
      }
    }
  }
  if ((pcm || dtsRemux || ac3Remux) || (configuration.isMencoderNoOutOfSync() && !noMC0NoSkip)) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 3);
    cmdArray[cmdArray.length - 5]="String_Node_Str";
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
    if (configuration.isFix25FPSAvMismatch()) {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]="String_Node_Str";
    }
  }
  if (params.timeend > 0) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str" + params.timeend;
  }
  String rate="String_Node_Str";
  if (params.mediaRenderer.isXBOX()) {
    rate="String_Node_Str";
  }
  if (media != null && !pcm && !dtsRemux && !ac3Remux) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 4);
    cmdArray[cmdArray.length - 6]="String_Node_Str";
    cmdArray[cmdArray.length - 5]="String_Node_Str" + rate;
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]=rate;
  }
  if (params.stdin != null) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  PipeProcess pipe=null;
  cmdArray[cmdArray.length - 2]="String_Node_Str";
  ProcessWrapperImpl pw=null;
  if (pcm || dtsRemux || ac3Remux) {
    boolean channels_filter_present=false;
    for (    String s : cmdArray) {
      if (isNotBlank(s) && s.startsWith("String_Node_Str")) {
        channels_filter_present=true;
        break;
      }
    }
    if (params.avidemux) {
      pipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),(pcm || dtsRemux || ac3Remux) ? null : params);
      params.input_pipes[0]=pipe;
      cmdArray[cmdArray.length - 1]=pipe.getInputPipe();
      if (pcm && !channels_filter_present && params.aid != null) {
        String mixer=getLPCMChannelMappingForMencoder(params.aid);
        if (isNotBlank(mixer)) {
          cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
          cmdArray[cmdArray.length - 2]="String_Node_Str";
          cmdArray[cmdArray.length - 1]=mixer;
        }
      }
      pw=new ProcessWrapperImpl(cmdArray,params);
      PipeProcess videoPipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str","String_Node_Str");
      PipeProcess audioPipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str","String_Node_Str");
      ProcessWrapper videoPipeProcess=videoPipe.getPipeProcess();
      ProcessWrapper audioPipeProcess=audioPipe.getPipeProcess();
      params.output_pipes[0]=videoPipe;
      params.output_pipes[1]=audioPipe;
      pw.attachProcess(videoPipeProcess);
      pw.attachProcess(audioPipeProcess);
      videoPipeProcess.runInNewThread();
      audioPipeProcess.runInNewThread();
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      videoPipe.deleteLater();
      audioPipe.deleteLater();
    }
 else {
      for (int s=0; s < cmdArray.length; s++) {
        if (cmdArray[s].equals("String_Node_Str")) {
          cmdArray[s]="String_Node_Str";
          cmdArray[s + 1]="String_Node_Str";
          break;
        }
      }
      pipe=new PipeProcess(System.currentTimeMillis() + "String_Node_Str");
      TSMuxerVideo ts=new TSMuxerVideo(configuration);
      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);
      cmdArray[cmdArray.length - 1]=ffVideoPipe.getInputPipe();
      OutputParams ffparams=new OutputParams(configuration);
      ffparams.maxBufferSize=1;
      ffparams.stdin=params.stdin;
      ProcessWrapperImpl ffVideo=new ProcessWrapperImpl(cmdArray,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();
      String aid=null;
      if (media != null && media.getAudioTracksList().size() > 1 && params.aid != null) {
        if (media.getContainer() != null && (media.getContainer().equals(FormatConfiguration.AVI) || media.getContainer().equals(FormatConfiguration.FLV))) {
          aid="String_Node_Str" + (params.aid.getId() + 1);
        }
 else {
          aid="String_Node_Str" + params.aid.getId();
        }
      }
      PipeIPCProcess ffAudioPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
      StreamModifier sm=new StreamModifier();
      sm.setPcm(pcm);
      sm.setDtsembed(dtsRemux);
      sm.setSampleFrequency(48000);
      sm.setBitspersample(16);
      String mixer=null;
      if (pcm && !dtsRemux) {
        mixer=getLPCMChannelMappingForMencoder(params.aid);
      }
      sm.setNbchannels(channels);
      String ffmpegLPCMextract[]=new String[]{executable(),"String_Node_Str","String_Node_Str",fileName,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + channels,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",dtsRemux ? "String_Node_Str" : "String_Node_Str","String_Node_Str",(aid == null) ? "String_Node_Str" : "String_Node_Str",(aid == null) ? "String_Node_Str" : aid,"String_Node_Str",sm.isDtsembed() ? "String_Node_Str" : "String_Node_Str",(isNotBlank(mixer) && !channels_filter_present) ? "String_Node_Str" : "String_Node_Str",(isNotBlank(mixer) && !channels_filter_present) ? mixer : "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ffAudioPipe.getInputPipe()};
      if (!params.mediaRenderer.isMuxDTSToMpeg()) {
        ffAudioPipe.setModifier(sm);
      }
      if (media != null && media.getDvdtrack() > 0) {
        ffmpegLPCMextract[3]="String_Node_Str";
        ffmpegLPCMextract[4]=fileName;
        ffmpegLPCMextract[5]="String_Node_Str" + media.getDvdtrack();
      }
 else       if (params.stdin != null) {
        ffmpegLPCMextract[3]="String_Node_Str";
      }
      if (fileName.toLowerCase().endsWith("String_Node_Str")) {
        ffmpegLPCMextract[4]="String_Node_Str";
        ffmpegLPCMextract[5]="String_Node_Str";
      }
      if (params.timeseek > 0) {
        ffmpegLPCMextract[2]="String_Node_Str" + params.timeseek;
      }
      OutputParams ffaudioparams=new OutputParams(configuration);
      ffaudioparams.maxBufferSize=1;
      ffaudioparams.stdin=params.stdin;
      ProcessWrapperImpl ffAudio=new ProcessWrapperImpl(ffmpegLPCMextract,ffaudioparams);
      params.stdin=null;
      PrintWriter pwMux=new PrintWriter(f);
      pwMux.println("String_Node_Str");
      String videoType="String_Node_Str";
      if (params.no_videoencode && params.forceType != null) {
        videoType=params.forceType;
      }
      String fps="String_Node_Str";
      if (params.forceFps != null) {
        fps="String_Node_Str" + params.forceFps + "String_Node_Str";
      }
      String audioType="String_Node_Str";
      if (params.mediaRenderer.isMuxDTSToMpeg()) {
        audioType="String_Node_Str";
      }
      if (params.lossyaudio) {
        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");
      pwMux.close();
      ProcessWrapper pipe_process=pipe.getPipeProcess();
      pw.attachProcess(pipe_process);
      pipe_process.runInNewThread();
      try {
        Thread.sleep(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 {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      ffAudioPipe.deleteLater();
      pw.attachProcess(ffAudio);
      ffAudio.runInNewThread();
    }
  }
 else {
    boolean directpipe=Platform.isMac() || Platform.isFreeBSD();
    if (directpipe) {
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 3);
      cmdArray[cmdArray.length - 3]="String_Node_Str";
      cmdArray[cmdArray.length - 2]="String_Node_Str";
      cmdArray[cmdArray.length - 1]="String_Node_Str";
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      params.input_pipes=new PipeProcess[2];
    }
 else {
      pipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),(pcm || dtsRemux || mux) ? null : params);
      params.input_pipes[0]=pipe;
      cmdArray[cmdArray.length - 1]=pipe.getInputPipe();
    }
    cmdArray=finalizeTranscoderArgs(this,fileName,dlna,media,params,cmdArray);
    pw=new ProcessWrapperImpl(cmdArray,params);
    if (!directpipe) {
      ProcessWrapper mkfifo_process=pipe.getPipeProcess();
      pw.attachProcess(mkfifo_process);
      mkfifo_process.runInNewThread();
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      pipe.deleteLater();
    }
  }
  pw.runInNewThread();
  try {
    Thread.sleep(100);
  }
 catch (  InterruptedException e) {
  }
  return pw;
}

Fixed version (ground truth):
@Override public ProcessWrapper launchTranscode(String fileName,DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  params.manageFastStart();
  boolean avisynth=avisynth();
  setAudioAndSubs(fileName,media,params,configuration);
  String subString=null;
  if (params.sid != null && params.sid.getPlayableExternalFile() != null) {
    subString=ProcessUtil.getShortFileNameIfWideChars(params.sid.getPlayableExternalFile().getAbsolutePath());
  }
  InputFile newInput=new InputFile();
  newInput.setFilename(fileName);
  newInput.setPush(params.stdin);
  dvd=false;
  if (media != null && media.getDvdtrack() > 0) {
    dvd=true;
  }
  boolean forceMencoder=!configuration.getHideTranscodeEnabled() && dlna.isNoName() && (dlna.getParent() instanceof FileTranscodeVirtualFolder);
  ovccopy=false;
  int intOCW=0;
  int intOCH=0;
  try {
    intOCW=Integer.parseInt(configuration.getMencoderOverscanCompensationWidth());
  }
 catch (  NumberFormatException e) {
    LOGGER.error("String_Node_Str",configuration.getMencoderOverscanCompensationWidth());
  }
  try {
    intOCH=Integer.parseInt(configuration.getMencoderOverscanCompensationHeight());
  }
 catch (  NumberFormatException e) {
    LOGGER.error("String_Node_Str",configuration.getMencoderOverscanCompensationHeight());
  }
  if (!forceMencoder && params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && media.isMuxable(params.mediaRenderer) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS() && (intOCW == 0 && intOCH == 0)) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    boolean nomux=false;
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        nomux=true;
      }
    }
    if (!nomux) {
      TSMuxerVideo tv=new TSMuxerVideo(configuration);
      params.forceFps=media.getValidFps(false);
      if (media.getCodecV().equals("String_Node_Str")) {
        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(fileName,dlna,media,params);
    }
  }
 else   if (params.sid == null && dvd && configuration.isMencoderRemuxMPEG2() && params.mediaRenderer.isMpeg2Supported()) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    boolean nomux=false;
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        nomux=true;
      }
    }
    if (!nomux) {
      ovccopy=true;
    }
  }
  String vcodec="String_Node_Str";
  wmv=false;
  if (params.mediaRenderer.isTranscodeToWMV()) {
    wmv=true;
    vcodec="String_Node_Str";
  }
  mpegts=params.mediaRenderer.isTranscodeToMPEGTSAC3();
  boolean ps3_and_stereo_and_384_kbits=params.aid != null && (params.mediaRenderer.getRendererUniqueID().equalsIgnoreCase(RENDERER_ID_PLAYSTATION3) && params.aid.getAudioProperties().getNumberOfChannels() == 2) && (params.aid.getBitRate() > 370000 && params.aid.getBitRate() < 400000);
  if (configuration.isRemuxAC3() && params.aid != null && params.aid.isAC3() && !ps3_and_stereo_and_384_kbits && !avisynth() && params.mediaRenderer.isTranscodeToAC3()) {
    ac3Remux=true;
  }
 else {
    dtsRemux=configuration.isDTSEmbedInPCM() && (!dvd || configuration.isMencoderRemuxMPEG2()) && params.aid != null && params.aid.isDTS() && !avisynth() && params.mediaRenderer.isDTSPlayable();
    pcm=configuration.isMencoderUsePcm() && (!dvd || configuration.isMencoderRemuxMPEG2()) && !(media.getContainer().equals("String_Node_Str") && !media.getCodecV().equals("String_Node_Str"))&& params.aid != null && ((params.aid.isDTS() && params.aid.getAudioProperties().getNumberOfChannels() <= 6) || params.aid.isLossless() || params.aid.isTrueHD()|| (!configuration.isMencoderUsePcmForHQAudioOnly() && (params.aid.isAC3() || params.aid.isMP3() || params.aid.isAAC()|| params.aid.isVorbis()|| params.aid.isMpegAudio()))) && params.mediaRenderer.isLPCMPlayable();
  }
  if (dtsRemux || pcm) {
    params.losslessaudio=true;
    params.forceFps=media.getValidFps(false);
  }
  if (!pcm && !dtsRemux && !ac3Remux&& ovccopy) {
    ovccopy=false;
  }
  if (pcm && avisynth()) {
    params.avidemux=true;
  }
  int channels;
  if (ac3Remux) {
    channels=params.aid.getAudioProperties().getNumberOfChannels();
  }
 else   if (dtsRemux || wmv) {
    channels=2;
  }
 else   if (pcm) {
    channels=params.aid.getAudioProperties().getNumberOfChannels();
  }
 else {
    channels=configuration.getAudioChannelCount();
  }
  LOGGER.trace("String_Node_Str" + channels);
  String add="String_Node_Str";
  String rendererMencoderOptions=params.mediaRenderer.getCustomMencoderOptions();
  String mencoderCustomOptions=configuration.getMencoderCustomOptions();
  String combinedCustomOptions=defaultString(mencoderCustomOptions) + "String_Node_Str" + defaultString(rendererMencoderOptions);
  if (!combinedCustomOptions.contains("String_Node_Str")) {
    add="String_Node_Str";
  }
  if (isNotBlank(rendererMencoderOptions)) {
    if (rendererMencoderOptions.contains("String_Node_Str") || dvd) {
      rendererMencoderOptions=null;
    }
  }
  StringTokenizer st=new StringTokenizer("String_Node_Str" + channels + (isNotBlank(mencoderCustomOptions) ? "String_Node_Str" + mencoderCustomOptions : "String_Node_Str")+ (isNotBlank(rendererMencoderOptions) ? "String_Node_Str" + rendererMencoderOptions : "String_Node_Str")+ add,"String_Node_Str");
  overriddenMainArgs=new String[st.countTokens()];
  int i=0;
  boolean handleToken=false;
  int nThreads=(dvd || fileName.toLowerCase().endsWith("String_Node_Str")) ? 1 : configuration.getMencoderMaxThreads();
  while (st.hasMoreTokens()) {
    String token=st.nextToken().trim();
    if (handleToken) {
      token+="String_Node_Str" + nThreads;
      if (configuration.getSkipLoopFilterEnabled() && !avisynth()) {
        token+="String_Node_Str";
      }
      handleToken=false;
    }
    if (token.toLowerCase().contains("String_Node_Str")) {
      handleToken=true;
    }
    overriddenMainArgs[i++]=token;
  }
  if (configuration.getMencoderMainSettings() != null) {
    String mainConfig=configuration.getMencoderMainSettings();
    String customSettings=params.mediaRenderer.getCustomMencoderQualitySettings();
    if (isNotBlank(customSettings)) {
      mainConfig=customSettings;
    }
    if (mainConfig.contains("String_Node_Str")) {
      mainConfig=mainConfig.substring(mainConfig.indexOf("String_Node_Str"));
    }
    int cbr_bitrate=params.mediaRenderer.getCBRVideoBitrate();
    String cbr_settings=(cbr_bitrate > 0) ? "String_Node_Str" + cbr_bitrate + "String_Node_Str"+ cbr_bitrate+ "String_Node_Str"+ ((cbr_bitrate > 16000) ? cbr_bitrate * 1000 : cbr_bitrate) : "String_Node_Str";
    String encodeSettings="String_Node_Str" + vcodec + (wmv ? "String_Node_Str" : (cbr_settings + "String_Node_Str" + (configuration.isMencoderAc3Fixed() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ CodecUtil.getAC3Bitrate(configuration,params.aid)))+ "String_Node_Str"+ (wmv ? 1 : configuration.getMencoderMaxThreads())+ ("String_Node_Str".equals(mainConfig) ? "String_Node_Str" : "String_Node_Str" + mainConfig);
    String audioType="String_Node_Str";
    if (dtsRemux) {
      audioType="String_Node_Str";
    }
 else     if (pcm) {
      audioType="String_Node_Str";
    }
    encodeSettings=addMaximumBitrateConstraints(encodeSettings,media,mainConfig,params.mediaRenderer,audioType);
    st=new StringTokenizer(encodeSettings,"String_Node_Str");
    int oldc=overriddenMainArgs.length;
    overriddenMainArgs=Arrays.copyOf(overriddenMainArgs,overriddenMainArgs.length + st.countTokens());
    i=oldc;
    while (st.hasMoreTokens()) {
      overriddenMainArgs[i++]=st.nextToken();
    }
  }
  boolean foundNoassParam=false;
  if (media != null) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    for (    String s : sArgs) {
      if (s.equals("String_Node_Str")) {
        foundNoassParam=true;
      }
    }
  }
  StringBuilder sb=new StringBuilder();
  if (!configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null) {
    int subtitleMargin=0;
    int userMargin=0;
    boolean apply_ass_styling=params.sid.getType() != SubtitleType.VOBSUB && params.sid.getType() != SubtitleType.PGS && configuration.isMencoderAss() && !foundNoassParam && !dvd;
    if (apply_ass_styling) {
      sb.append("String_Node_Str");
      boolean override_ass_style=!configuration.isMencoderAssDefaultStyle() || params.sid.getType() == SubtitleType.SUBRIP || params.sid.getType() == SubtitleType.TX3G;
      if (override_ass_style) {
        String assSubColor="String_Node_Str";
        if (configuration.getSubsColor() != 0) {
          assSubColor=Integer.toHexString(configuration.getSubsColor());
          if (assSubColor.length() > 2) {
            assSubColor=assSubColor.substring(2) + "String_Node_Str";
          }
        }
        sb.append("String_Node_Str").append(assSubColor).append("String_Node_Str").append(configuration.getMencoderAssScale());
        if (configuration.getMencoderFont() != null && configuration.getMencoderFont().length() > 0) {
          sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
          sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
        }
 else {
          String font=CodecUtil.getDefaultFontPath();
          if (isNotBlank(font)) {
            sb.append("String_Node_Str").append(font).append("String_Node_Str");
            sb.append("String_Node_Str").append(font).append("String_Node_Str");
          }
 else {
            sb.append("String_Node_Str");
            sb.append("String_Node_Str");
          }
        }
        if (intOCH > 0) {
          subtitleMargin=(media.getHeight() / 100) * intOCH;
        }
        sb.append("String_Node_Str").append(configuration.getMencoderAssOutline()).append("String_Node_Str").append(configuration.getMencoderAssShadow());
        try {
          userMargin=Integer.parseInt(configuration.getMencoderAssMargin());
        }
 catch (        NumberFormatException n) {
          LOGGER.debug("String_Node_Str" + configuration.getMencoderAssMargin() + "String_Node_Str");
        }
        subtitleMargin=subtitleMargin + userMargin;
        sb.append("String_Node_Str").append(subtitleMargin).append("String_Node_Str");
      }
 else       if (intOCH > 0) {
        sb.append("String_Node_Str").append(subtitleMargin).append("String_Node_Str");
      }
      if (!params.sid.isEmbedded()) {
        sb.append("String_Node_Str");
      }
    }
 else {
      if (configuration.getMencoderFont() != null && configuration.getMencoderFont().length() > 0) {
        sb.append("String_Node_Str").append(configuration.getMencoderFont()).append("String_Node_Str");
      }
 else {
        String font=CodecUtil.getDefaultFontPath();
        if (isNotBlank(font)) {
          sb.append("String_Node_Str").append(font).append("String_Node_Str");
        }
      }
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssScale());
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssOutline());
      sb.append("String_Node_Str").append(configuration.getMencoderNoAssBlur());
      if (intOCH > 0) {
        subtitleMargin=intOCH;
      }
      try {
        userMargin=Integer.parseInt(configuration.getMencoderNoAssSubPos());
      }
 catch (      NumberFormatException n) {
        LOGGER.debug("String_Node_Str" + configuration.getMencoderNoAssSubPos() + "String_Node_Str");
      }
      subtitleMargin=subtitleMargin + userMargin;
      sb.append("String_Node_Str").append(100 - subtitleMargin).append("String_Node_Str");
    }
    sb.append("String_Node_Str").append(configuration.isMencoderFontConfig() ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str");
    if (params.sid.getType() == SubtitleType.VOBSUB && configuration.getMencoderVobsubSubtitleQuality() != null) {
      String subtitleQuality=configuration.getMencoderVobsubSubtitleQuality();
      sb.append("String_Node_Str").append(subtitleQuality).append("String_Node_Str");
    }
    if (!configuration.isMencoderDisableSubs() && configuration.getMencoderSubCp() != null && configuration.getMencoderSubCp().length() > 0) {
      sb.append("String_Node_Str").append(configuration.getMencoderSubCp()).append("String_Node_Str");
      if (configuration.isMencoderSubFribidi()) {
        sb.append("String_Node_Str").append(configuration.getMencoderSubCp()).append("String_Node_Str");
      }
    }
  }
  st=new StringTokenizer(sb.toString(),"String_Node_Str");
  int oldc=overriddenMainArgs.length;
  overriddenMainArgs=Arrays.copyOf(overriddenMainArgs,overriddenMainArgs.length + st.countTokens());
  i=oldc;
  handleToken=false;
  while (st.hasMoreTokens()) {
    String s=st.nextToken();
    if (handleToken) {
      s="String_Node_Str";
      handleToken=false;
    }
    if ((!configuration.isMencoderAss() || dvd) && s.contains("String_Node_Str")) {
      s="String_Node_Str";
      handleToken=true;
    }
    overriddenMainArgs[i++]=s;
  }
  String cmdArray[]=new String[18 + args().length];
  cmdArray[0]=executable();
  cmdArray[1]="String_Node_Str";
  if (params.timeseek > 0) {
    cmdArray[2]="String_Node_Str" + params.timeseek;
  }
 else {
    cmdArray[2]="String_Node_Str";
  }
  if (dvd) {
    cmdArray[3]="String_Node_Str";
  }
 else {
    cmdArray[3]="String_Node_Str";
  }
  String frameRateRatio=null;
  String frameRateNumber=null;
  if (media != null) {
    frameRateRatio=media.getValidFps(true);
    frameRateNumber=media.getValidFps(false);
  }
  if (avisynth && !fileName.toLowerCase().endsWith("String_Node_Str")) {
    File avsFile=FFMpegAviSynthVideo.getAVSScript(fileName,params.sid,params.fromFrame,params.toFrame,frameRateRatio,frameRateNumber,false);
    cmdArray[4]=ProcessUtil.getShortFileNameIfWideChars(avsFile.getAbsolutePath());
  }
 else {
    cmdArray[4]=fileName;
    if (params.stdin != null) {
      cmdArray[4]="String_Node_Str";
    }
  }
  if (dvd) {
    cmdArray[5]="String_Node_Str" + media.getDvdtrack();
  }
 else {
    cmdArray[5]="String_Node_Str";
  }
  String arguments[]=args();
  for (i=0; i < arguments.length; i++) {
    cmdArray[6 + i]=arguments[i];
    if (arguments[i].contains("String_Node_Str") && media.getAspect() != null && media.getValidAspect(true) != null) {
      cmdArray[6 + i]+="String_Node_Str" + media.getValidAspect(true);
    }
  }
  cmdArray[cmdArray.length - 12]="String_Node_Str";
  cmdArray[cmdArray.length - 11]="String_Node_Str";
  cmdArray[cmdArray.length - 10]="String_Node_Str";
  cmdArray[cmdArray.length - 9]="String_Node_Str";
  if (!dtsRemux && !pcm && !avisynth()&& params.aid != null && media.getAudioTracksList().size() > 1) {
    cmdArray[cmdArray.length - 12]="String_Node_Str";
    boolean lavf=false;
    cmdArray[cmdArray.length - 11]="String_Node_Str" + (lavf ? params.aid.getId() + 1 : params.aid.getId());
  }
  if (subString == null && params.sid != null) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str" + params.sid.getId();
  }
 else   if (subString != null && !avisynth()) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str";
  }
 else   if (subString == null) {
    cmdArray[cmdArray.length - 10]="String_Node_Str";
    cmdArray[cmdArray.length - 9]="String_Node_Str";
  }
  cmdArray[cmdArray.length - 8]="String_Node_Str";
  cmdArray[cmdArray.length - 7]="String_Node_Str";
  if (configuration.isMencoderForceFps() && !configuration.isFix25FPSAvMismatch()) {
    cmdArray[cmdArray.length - 8]="String_Node_Str";
    cmdArray[cmdArray.length - 7]="String_Node_Str";
  }
  cmdArray[cmdArray.length - 6]="String_Node_Str";
  cmdArray[cmdArray.length - 5]="String_Node_Str";
  if (frameRateRatio != null) {
    cmdArray[cmdArray.length - 5]=frameRateRatio;
    if (configuration.isMencoderForceFps()) {
      if (configuration.isFix25FPSAvMismatch()) {
        cmdArray[cmdArray.length - 8]="String_Node_Str";
        cmdArray[cmdArray.length - 7]="String_Node_Str";
        cmdArray[cmdArray.length - 5]="String_Node_Str";
      }
 else {
        cmdArray[cmdArray.length - 7]=cmdArray[cmdArray.length - 5];
      }
    }
  }
  if (avisynth() && configuration.getAvisynthInterFrame() && !"String_Node_Str".equals(frameRateRatio)&& !"String_Node_Str".equals(frameRateRatio)&& !"String_Node_Str".equals(frameRateRatio)) {
    if ("String_Node_Str".equals(frameRateRatio)) {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
 else     if ("String_Node_Str".equals(frameRateRatio)) {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
 else {
      cmdArray[cmdArray.length - 5]="String_Node_Str";
    }
  }
  if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null) {
    if (params.sid.getType() == SubtitleType.VOBSUB) {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]=subString.substring(0,subString.length() - 4);
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]="String_Node_Str" + params.sid.getLang();
    }
 else {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]=subString.replace("String_Node_Str","String_Node_Str");
      if (params.sid.getPlayableExternalFile() != null && params.sid.isExternalFileUtf8()) {
        cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 1);
        cmdArray[cmdArray.length - 3]="String_Node_Str";
      }
    }
  }
 else {
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  if (fileName.toLowerCase().endsWith("String_Node_Str")) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  boolean deinterlace=configuration.isMencoderYadif();
  boolean isResolutionTooHighForRenderer=params.mediaRenderer.isVideoRescale() && media != null && ((media.getWidth() > params.mediaRenderer.getMaxVideoWidth()) || (media.getHeight() > params.mediaRenderer.getMaxVideoHeight()));
  boolean scaleBool=isResolutionTooHighForRenderer || (configuration.isMencoderScaler() && (configuration.getMencoderScaleX() != 0 || configuration.getMencoderScaleY() != 0)) || (intOCW > 0 || intOCH > 0);
  if ((deinterlace || scaleBool) && !avisynth()) {
    StringBuilder vfValueOverscanPrepend=new StringBuilder();
    StringBuilder vfValueOverscanMiddle=new StringBuilder();
    StringBuilder vfValueVS=new StringBuilder();
    StringBuilder vfValueComplete=new StringBuilder();
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    String deinterlaceComma="String_Node_Str";
    int scaleWidth=0;
    int scaleHeight=0;
    double rendererAspectRatio;
    if (media != null && media.getWidth() > 0 && media.getHeight() > 0) {
      scaleWidth=media.getWidth();
      scaleHeight=media.getHeight();
    }
    if (intOCW > 0 || intOCH > 0) {
      int intOCWPixels=(media.getWidth() / 100) * intOCW;
      int intOCHPixels=(media.getHeight() / 100) * intOCH;
      scaleWidth=scaleWidth + intOCWPixels;
      scaleHeight=scaleHeight + intOCHPixels;
      if (params.mediaRenderer.isVideoRescale() && ((scaleWidth > params.mediaRenderer.getMaxVideoWidth()) || (scaleHeight > params.mediaRenderer.getMaxVideoHeight()))) {
        double overscannedAspectRatio=scaleWidth / scaleHeight;
        rendererAspectRatio=params.mediaRenderer.getMaxVideoWidth() / params.mediaRenderer.getMaxVideoHeight();
        if (overscannedAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / overscannedAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * overscannedAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      vfValueOverscanPrepend.append("String_Node_Str").append(intOCWPixels).append("String_Node_Str").append(intOCHPixels);
      vfValueOverscanMiddle.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
    if (configuration.isMencoderScaler()) {
      if (configuration.getMencoderScaleX() != 0) {
        if (configuration.getMencoderScaleX() <= params.mediaRenderer.getMaxVideoWidth()) {
          scaleWidth=configuration.getMencoderScaleX();
        }
 else {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
        }
      }
      if (configuration.getMencoderScaleY() != 0) {
        if (configuration.getMencoderScaleY() <= params.mediaRenderer.getMaxVideoHeight()) {
          scaleHeight=configuration.getMencoderScaleY();
        }
 else {
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      vfValueVS.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
 else     if (media != null && media.getWidth() > 0 && media.getHeight() > 0 && (media.getWidth() > params.mediaRenderer.getMaxVideoWidth() || media.getHeight() > params.mediaRenderer.getMaxVideoHeight())) {
      double videoAspectRatio=(double)media.getWidth() / (double)media.getHeight();
      rendererAspectRatio=(double)params.mediaRenderer.getMaxVideoWidth() / (double)params.mediaRenderer.getMaxVideoHeight();
      if (media.getWidth() == 3840 && media.getHeight() == 1080) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 2160) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 1088) {
        scaleWidth=1920;
        scaleHeight=1088;
      }
 else {
        if (videoAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / videoAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * videoAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      vfValueVS.append("String_Node_Str").append(scaleWidth).append("String_Node_Str").append(scaleHeight);
    }
    if (intOCW > 0 || intOCH > 0) {
      vfValueComplete.append(vfValueOverscanPrepend).append(vfValueOverscanMiddle).append("String_Node_Str");
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
    }
 else {
      vfValueComplete.append(vfValueVS);
    }
    if (deinterlace) {
      deinterlaceComma="String_Node_Str";
    }
    cmdArray[cmdArray.length - 3]=(deinterlace ? "String_Node_Str" : "String_Node_Str") + (scaleBool ? deinterlaceComma + vfValueComplete : "String_Node_Str");
  }
  if (media != null && (media.getWidth() % 4 != 0) || media.getHeight() % 4 != 0) {
    int expandBorderWidth;
    int expandBorderHeight;
    expandBorderWidth=media.getWidth() % 4;
    expandBorderHeight=media.getHeight() % 4;
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str" + expandBorderWidth + "String_Node_Str"+ expandBorderHeight;
  }
  if (configuration.getMencoderMT() && !avisynth && !dvd&& !(media.getCodecV() != null && (media.getCodecV().equals("String_Node_Str")))) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  boolean noMC0NoSkip=false;
  if (media != null) {
    String sArgs[]=getSpecificCodecOptions(configuration.getCodecSpecificConfig(),media,params,fileName,subString,configuration.isMencoderIntelligentSync(),false);
    if (sArgs != null && sArgs.length > 0) {
      boolean vfConsumed=false;
      boolean afConsumed=false;
      for (int s=0; s < sArgs.length; s++) {
        if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c]="String_Node_Str";
              cmdArray[c + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]="String_Node_Str" + vcodec + "String_Node_Str"+ (configuration.isMencoderAc3Fixed() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ CodecUtil.getAC3Bitrate(configuration,params.aid)+ "String_Node_Str"+ configuration.getMencoderMaxThreads()+ "String_Node_Str"+ sArgs[s + 1];
              addMaximumBitrateConstraints(cmdArray[c + 1],media,cmdArray[c + 1],params.mediaRenderer,"String_Node_Str");
              sArgs[s + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
              vfConsumed=true;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          for (int c=0; c < cmdArray.length; c++) {
            if (cmdArray[c] != null && cmdArray[c].equals("String_Node_Str")) {
              cmdArray[c + 1]+="String_Node_Str" + sArgs[s + 1];
              sArgs[s + 1]="String_Node_Str";
              s++;
              afConsumed=true;
            }
          }
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          noMC0NoSkip=true;
        }
 else         if (sArgs[s].equals("String_Node_Str")) {
          noMC0NoSkip=true;
        }
      }
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + sArgs.length);
      for (int s=0; s < sArgs.length; s++) {
        if (sArgs[s].equals("String_Node_Str") || sArgs[s].equals("String_Node_Str") || sArgs[s].equals("String_Node_Str")|| (sArgs[s].equals("String_Node_Str") & vfConsumed)|| (sArgs[s].equals("String_Node_Str") && afConsumed)|| sArgs[s].equals("String_Node_Str")|| sArgs[s].equals("String_Node_Str")|| sArgs[s].equals("String_Node_Str")) {
          cmdArray[cmdArray.length - sArgs.length - 2 + s]="String_Node_Str";
        }
 else {
          cmdArray[cmdArray.length - sArgs.length - 2 + s]=sArgs[s];
        }
      }
    }
  }
  if ((pcm || dtsRemux || ac3Remux) || (configuration.isMencoderNoOutOfSync() && !noMC0NoSkip)) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 3);
    cmdArray[cmdArray.length - 5]="String_Node_Str";
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
    if (configuration.isFix25FPSAvMismatch()) {
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      cmdArray[cmdArray.length - 3]="String_Node_Str";
    }
  }
  if (params.timeend > 0) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str" + params.timeend;
  }
  String rate="String_Node_Str";
  if (params.mediaRenderer.isXBOX()) {
    rate="String_Node_Str";
  }
  if (media != null && !pcm && !dtsRemux && !ac3Remux) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 4);
    cmdArray[cmdArray.length - 6]="String_Node_Str";
    cmdArray[cmdArray.length - 5]="String_Node_Str" + rate;
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]=rate;
  }
  if (params.stdin != null) {
    cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
    cmdArray[cmdArray.length - 4]="String_Node_Str";
    cmdArray[cmdArray.length - 3]="String_Node_Str";
  }
  PipeProcess pipe=null;
  cmdArray[cmdArray.length - 2]="String_Node_Str";
  ProcessWrapperImpl pw=null;
  if (pcm || dtsRemux || ac3Remux) {
    boolean channels_filter_present=false;
    for (    String s : cmdArray) {
      if (isNotBlank(s) && s.startsWith("String_Node_Str")) {
        channels_filter_present=true;
        break;
      }
    }
    if (params.avidemux) {
      pipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),(pcm || dtsRemux || ac3Remux) ? null : params);
      params.input_pipes[0]=pipe;
      cmdArray[cmdArray.length - 1]=pipe.getInputPipe();
      if (pcm && !channels_filter_present && params.aid != null) {
        String mixer=getLPCMChannelMappingForMencoder(params.aid);
        if (isNotBlank(mixer)) {
          cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 2);
          cmdArray[cmdArray.length - 2]="String_Node_Str";
          cmdArray[cmdArray.length - 1]=mixer;
        }
      }
      pw=new ProcessWrapperImpl(cmdArray,params);
      PipeProcess videoPipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str","String_Node_Str");
      PipeProcess audioPipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str","String_Node_Str");
      ProcessWrapper videoPipeProcess=videoPipe.getPipeProcess();
      ProcessWrapper audioPipeProcess=audioPipe.getPipeProcess();
      params.output_pipes[0]=videoPipe;
      params.output_pipes[1]=audioPipe;
      pw.attachProcess(videoPipeProcess);
      pw.attachProcess(audioPipeProcess);
      videoPipeProcess.runInNewThread();
      audioPipeProcess.runInNewThread();
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      videoPipe.deleteLater();
      audioPipe.deleteLater();
    }
 else {
      for (int s=0; s < cmdArray.length; s++) {
        if (cmdArray[s].equals("String_Node_Str")) {
          cmdArray[s]="String_Node_Str";
          cmdArray[s + 1]="String_Node_Str";
          break;
        }
      }
      pipe=new PipeProcess(System.currentTimeMillis() + "String_Node_Str");
      TSMuxerVideo ts=new TSMuxerVideo(configuration);
      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);
      cmdArray[cmdArray.length - 1]=ffVideoPipe.getInputPipe();
      OutputParams ffparams=new OutputParams(configuration);
      ffparams.maxBufferSize=1;
      ffparams.stdin=params.stdin;
      ProcessWrapperImpl ffVideo=new ProcessWrapperImpl(cmdArray,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();
      String aid=null;
      if (media != null && media.getAudioTracksList().size() > 1 && params.aid != null) {
        if (media.getContainer() != null && (media.getContainer().equals(FormatConfiguration.AVI) || media.getContainer().equals(FormatConfiguration.FLV))) {
          aid="String_Node_Str" + (params.aid.getId() + 1);
        }
 else {
          aid="String_Node_Str" + params.aid.getId();
        }
      }
      PipeIPCProcess ffAudioPipe=new PipeIPCProcess(System.currentTimeMillis() + "String_Node_Str",System.currentTimeMillis() + "String_Node_Str",false,true);
      StreamModifier sm=new StreamModifier();
      sm.setPcm(pcm);
      sm.setDtsembed(dtsRemux);
      sm.setSampleFrequency(48000);
      sm.setBitspersample(16);
      String mixer=null;
      if (pcm && !dtsRemux) {
        mixer=getLPCMChannelMappingForMencoder(params.aid);
      }
      sm.setNbchannels(channels);
      String ffmpegLPCMextract[]=new String[]{executable(),"String_Node_Str","String_Node_Str",fileName,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + channels,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",dtsRemux ? "String_Node_Str" : "String_Node_Str","String_Node_Str",(aid == null) ? "String_Node_Str" : "String_Node_Str",(aid == null) ? "String_Node_Str" : aid,"String_Node_Str",sm.isDtsembed() ? "String_Node_Str" : "String_Node_Str",(isNotBlank(mixer) && !channels_filter_present) ? "String_Node_Str" : "String_Node_Str",(isNotBlank(mixer) && !channels_filter_present) ? mixer : "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ffAudioPipe.getInputPipe()};
      if (!params.mediaRenderer.isMuxDTSToMpeg()) {
        ffAudioPipe.setModifier(sm);
      }
      if (media != null && media.getDvdtrack() > 0) {
        ffmpegLPCMextract[3]="String_Node_Str";
        ffmpegLPCMextract[4]=fileName;
        ffmpegLPCMextract[5]="String_Node_Str" + media.getDvdtrack();
      }
 else       if (params.stdin != null) {
        ffmpegLPCMextract[3]="String_Node_Str";
      }
      if (fileName.toLowerCase().endsWith("String_Node_Str")) {
        ffmpegLPCMextract[4]="String_Node_Str";
        ffmpegLPCMextract[5]="String_Node_Str";
      }
      if (params.timeseek > 0) {
        ffmpegLPCMextract[2]="String_Node_Str" + params.timeseek;
      }
      OutputParams ffaudioparams=new OutputParams(configuration);
      ffaudioparams.maxBufferSize=1;
      ffaudioparams.stdin=params.stdin;
      ProcessWrapperImpl ffAudio=new ProcessWrapperImpl(ffmpegLPCMextract,ffaudioparams);
      params.stdin=null;
      PrintWriter pwMux=new PrintWriter(f);
      pwMux.println("String_Node_Str");
      String videoType="String_Node_Str";
      if (params.no_videoencode && params.forceType != null) {
        videoType=params.forceType;
      }
      String fps="String_Node_Str";
      if (params.forceFps != null) {
        fps="String_Node_Str" + params.forceFps + "String_Node_Str";
      }
      String audioType="String_Node_Str";
      if (params.mediaRenderer.isMuxDTSToMpeg()) {
        audioType="String_Node_Str";
      }
      if (params.lossyaudio) {
        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");
      pwMux.close();
      ProcessWrapper pipe_process=pipe.getPipeProcess();
      pw.attachProcess(pipe_process);
      pipe_process.runInNewThread();
      try {
        Thread.sleep(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 {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      ffAudioPipe.deleteLater();
      pw.attachProcess(ffAudio);
      ffAudio.runInNewThread();
    }
  }
 else {
    boolean directpipe=Platform.isMac() || Platform.isFreeBSD();
    if (directpipe) {
      cmdArray=Arrays.copyOf(cmdArray,cmdArray.length + 3);
      cmdArray[cmdArray.length - 3]="String_Node_Str";
      cmdArray[cmdArray.length - 2]="String_Node_Str";
      cmdArray[cmdArray.length - 1]="String_Node_Str";
      cmdArray[cmdArray.length - 4]="String_Node_Str";
      params.input_pipes=new PipeProcess[2];
    }
 else {
      pipe=new PipeProcess("String_Node_Str" + System.currentTimeMillis(),(pcm || dtsRemux || mux) ? null : params);
      params.input_pipes[0]=pipe;
      cmdArray[cmdArray.length - 1]=pipe.getInputPipe();
    }
    cmdArray=finalizeTranscoderArgs(this,fileName,dlna,media,params,cmdArray);
    pw=new ProcessWrapperImpl(cmdArray,params);
    if (!directpipe) {
      ProcessWrapper mkfifo_process=pipe.getPipeProcess();
      pw.attachProcess(mkfifo_process);
      mkfifo_process.runInNewThread();
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
      }
      pipe.deleteLater();
    }
  }
  pw.runInNewThread();
  try {
    Thread.sleep(100);
  }
 catch (  InterruptedException e) {
  }
  return pw;
}