private void LoadMp4Subtitle(string fileName, Trak mp4SubtitleTrack)
        {
            if (mp4SubtitleTrack.Mdia.IsVobSubSubtitle)
            {
                var subPicturesWithTimeCodes = new List<VobSubOcr.SubPicturesWithSeparateTimeCodes>();
                for (int i = 0; i < mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes.Count; i++)
                {
                    if (mp4SubtitleTrack.Mdia.Minf.Stbl.SubPictures.Count > i)
                    {
                        var start = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.StartTimeCodes[i]);
                        var end = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes[i]);
                        subPicturesWithTimeCodes.Add(new VobSubOcr.SubPicturesWithSeparateTimeCodes(mp4SubtitleTrack.Mdia.Minf.Stbl.SubPictures[i], start, end));
                    }
                }

                using (var formSubOcr = new VobSubOcr())
                {
                    formSubOcr.Initialize(subPicturesWithTimeCodes, Configuration.Settings.VobSubOcr, fileName); // TODO: language???
                    if (formSubOcr.ShowDialog(this) == DialogResult.OK)
                    {
                        this.MakeHistoryForUndo(this._language.BeforeImportFromMatroskaFile);
                        this._subtitleListViewIndex = -1;
                        this.FileNew();
                        this._subtitle.WasLoadedWithFrameNumbers = false;
                        foreach (var p in formSubOcr.SubtitleFromOcr.Paragraphs)
                        {
                            this._subtitle.Paragraphs.Add(p);
                        }

                        this.ShowSource();
                        this.SubtitleListview1.Fill(this._subtitle, this._subtitleAlternate);
                        this._subtitleListViewIndex = -1;
                        this.SubtitleListview1.FirstVisibleIndex = -1;
                        this.SubtitleListview1.SelectIndexAndEnsureVisible(0);

                        this._fileName = Path.GetFileNameWithoutExtension(fileName);
                        this._converted = true;
                        this.Text = this.Title;

                        Configuration.Settings.Save();
                    }
                }
            }
            else
            {
                this.MakeHistoryForUndo(this._language.BeforeImportFromMatroskaFile);
                this._subtitleListViewIndex = -1;
                this.FileNew();

                for (int i = 0; i < mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes.Count; i++)
                {
                    if (mp4SubtitleTrack.Mdia.Minf.Stbl.Texts.Count > i)
                    {
                        var start = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.StartTimeCodes[i]);
                        var end = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes[i]);
                        string text = mp4SubtitleTrack.Mdia.Minf.Stbl.Texts[i];
                        var p = new Paragraph(text, start.TotalMilliseconds, end.TotalMilliseconds);
                        if (p.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
                        {
                            p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
                        }

                        if (mp4SubtitleTrack.Mdia.IsClosedCaption && string.IsNullOrEmpty(text))
                        {
                            // do not add empty lines
                        }
                        else
                        {
                            this._subtitle.Paragraphs.Add(p);
                        }
                    }
                }

                this.SetEncoding(Encoding.UTF8);
                this.ShowStatus(this._language.SubtitleImportedFromMatroskaFile);
                this._subtitle.Renumber();
                this._subtitle.WasLoadedWithFrameNumbers = false;
                if (fileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) || fileName.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase))
                {
                    this._fileName = fileName.Substring(0, fileName.Length - 4);
                    this.Text = this.Title + " - " + this._fileName;
                }
                else
                {
                    this.Text = this.Title;
                }

                this._fileDateTime = new DateTime();

                this._converted = true;

                this.SubtitleListview1.Fill(this._subtitle, this._subtitleAlternate);
                if (this._subtitle.Paragraphs.Count > 0)
                {
                    this.SubtitleListview1.SelectIndexAndEnsureVisible(0);
                }

                this.ShowSource();
            }
        }
        private static Subtitle LoadMp4SubtitleForSync(Trak mp4SubtitleTrack)
        {
            var subtitle = new Subtitle();
            if (mp4SubtitleTrack.Mdia.IsVobSubSubtitle)
            {
                return subtitle;
            }
            else
            {
                for (int i = 0; i < mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes.Count; i++)
                {
                    if (mp4SubtitleTrack.Mdia.Minf.Stbl.Texts.Count > i)
                    {
                        var start = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.StartTimeCodes[i]);
                        var end = TimeSpan.FromSeconds(mp4SubtitleTrack.Mdia.Minf.Stbl.EndTimeCodes[i]);
                        string text = mp4SubtitleTrack.Mdia.Minf.Stbl.Texts[i];
                        var p = new Paragraph(text, start.TotalMilliseconds, end.TotalMilliseconds);
                        if (p.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
                        {
                            p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
                        }

                        if (mp4SubtitleTrack.Mdia.IsClosedCaption && string.IsNullOrEmpty(text))
                        {
                            // do not add empty lines
                        }
                        else
                        {
                            subtitle.Paragraphs.Add(p);
                        }
                    }
                }
            }

            return subtitle;
        }