public bool Transcode(string filenameOut, ETranscode modifiers, string actBytes = null, TimeSpan?from = null, TimeSpan?to = null) { _error = false; _success = false; _aborted = false; _matchedDuration = false; AudioMeta.Time.Duration = TimeSpan.Zero; string param = FFMPEG_TRANSCODE; if (!(_filenameMeta is null)) { param = FFMPEG_TRANSCODE2; } if (actBytes is null) { param = param.Replace(ACTIVATION, string.Empty); } else { param = param.Replace(ACTIVATION, ACTIVATION_PARAM); param = param.Replace(ACT_BYTES, actBytes); } if (from.HasValue) { param = param.Replace(BEGIN, BEGIN_PARAM); string secs = from.Value.TotalSeconds.ToString("f3"); param = param.Replace(TS_FROM, secs); AudioMeta.Time.Begin = from.Value; } else { param = param.Replace(BEGIN, string.Empty); } if (to.HasValue) { param = param.Replace(END, END_PARAM); string secs = to.Value.TotalSeconds.ToString("f3"); param = param.Replace(TS_TO, secs); AudioMeta.Time.End = to.Value; } else { param = param.Replace(END, string.Empty); } param = param.Replace(INPUT, _filenameIn); param = param.Replace(OUTPUT, filenameOut); if (!_bitrateParam.IsNullOrWhiteSpace()) { param = param.Replace(BITRATE, _bitrateParam); } else { param = param.Replace(BITRATE, string.Empty); } if (modifiers.HasFlag(ETranscode.copy) && _bitrateParam.IsNullOrWhiteSpace()) { param = param.Replace(COPY, COPY_PARAM); } else { param = param.Replace(COPY, string.Empty); } if (!(_filenameMeta is null)) { param = param.Replace(INPUT2, _filenameMeta); } Log(4, this, () => ID + param.SubstitUser().SubstitActiv()); string result = runProcess(FFmpegExePath, param, true, ffMpegAsyncHandlerTranscode); return(_success && !_aborted && !_error); }
//-------------------------------------------------- public bool Transcode(string filenameOut, ETranscode modifiers, string actBytes = null, TimeSpan?from = null, TimeSpan?to = null) { _success = false; _aborted = false; AudioMeta.Time.Duration = TimeSpan.Zero; string param = FFMPEG_TRANSCODE; if (actBytes is null) { param = param.Replace(ACTIVATION, string.Empty); } else { param = param.Replace(ACTIVATION, ACTIVATION_PARAM); param = param.Replace(ACT_BYTES, actBytes); } if (from.HasValue) { param = param.Replace(BEGIN, BEGIN_PARAM); string secs = from.Value.TotalSeconds.ToString("f3"); param = param.Replace(TS_FROM, secs); AudioMeta.Time.Begin = from.Value; } else { param = param.Replace(BEGIN, string.Empty); } if (to.HasValue) { param = param.Replace(END, END_PARAM); string secs = to.Value.TotalSeconds.ToString("f3"); param = param.Replace(TS_TO, secs); AudioMeta.Time.End = to.Value; } else { param = param.Replace(END, string.Empty); } param = param.Replace(INPUT, _filename); param = param.Replace(OUTPUT, filenameOut); if (modifiers.HasFlag(ETranscode.copy)) { param = param.Replace(COPY, COPY_PARAM); } else { param = param.Replace(COPY, string.Empty); } if (modifiers.HasFlag(ETranscode.noChapters)) { param = param.Replace(NO_CHAPT, NO_CHAPT_PARAM); } else { param = param.Replace(NO_CHAPT, string.Empty); } string result = runProcess(FFmpegExePath, param, true, ffMpegAsyncHandlerTranscode); return(_success && !_aborted); }