public AdvancedSettingsForm(FFMpegCore.IMediaAnalysis videoData, double startTime, double endTime, bitrate bitrate, bool twoPass) { InitializeComponent(); this.bitrate = bitrate; this.videoData = videoData; this.twoPass = twoPass; populateVideoData(videoData, startTime, endTime, bitrate, twoPass); }
private void populateVideoData(FFMpegCore.IMediaAnalysis videoData, double startTime, double endTime, bitrate bitrate, bool twoPass) { try { double endTimeTemp = endTime; double startTimeTemp = startTime; if (endTime == -1) { endTimeTemp = videoData.PrimaryVideoStream.Duration.TotalMilliseconds; } if (startTime == -1) { startTimeTemp = 0; } this.duration = endTimeTemp - startTimeTemp; labelVideoLength.Text = "Output Video Length: " + TimeSpan.FromMilliseconds(this.duration).ToString(@"mm\m\:ss\s"); labelAverageBitrate.Text = "Video Average Bitrate: " + (int)(videoData.PrimaryVideoStream.BitRate / 1000) + " kbps"; labelAudioBitrate.Text = "No Audio Tracks"; if (videoData.PrimaryAudioStream != null && !double.IsNaN(videoData.PrimaryAudioStream.BitRate)) { labelAudioBitrate.Text = "Audio Average Bitrate: " + (int)(videoData.PrimaryAudioStream.BitRate / 1000) + " kbps"; } textBoxMinBitrate.Text = bitrate.minBitrate.ToString(); textBoxAvgBitrate.Text = bitrate.avgBitrate.ToString(); textBoxMaxBitrate.Text = bitrate.maxBitrate.ToString(); checkBoxTwoPass.Checked = twoPass; } catch (Exception err) { Console.WriteLine(err.ToString()); } }