Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="video"></param>
 /// <param name="audio"></param>
 /// <param name="dstFile"></param>
 /// <param name="e"></param>
 /// <returns>如果混流顺利完成,返回true;如果被用户中止或在过程中出错,返回false。</returns>
 private bool Mux(JobItem jobItem, DoWorkEventArgs e)
 {
     try
     {
         jobItem.Event = JobEvent.Muxing;
         jobItem.ProcessMuxing();
         return(this.ProcessingReport(jobItem, jobItem.MuxingInfo, e));
     }
     catch (FormatNotSupportedException)
     {
         MessageBox.Show("合成MP4失败。可能源媒体流中有不支持的格式。", "合成失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.SetJobEventAndReportProgress(jobItem, JobEvent.Error);
         return(false);
     }
     catch (FFmpegBugException)
     {
         MessageBox.Show("合成MP4失败。这是由于FFmpeg的一些Bug, 对某些流无法使用复制。", "合成失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.SetJobEventAndReportProgress(jobItem, JobEvent.Error);
         return(false);
     }
     finally
     {
         if ((jobItem.JobConfig.AudioMode == StreamProcessMode.Encode) && !MyIO.IsSameFile(jobItem.MuxingInfo.AudioFile, jobItem.DestFile))
         {
             File.Delete(jobItem.MuxingInfo.AudioFile);
         }
     }
 }