예제 #1
0
        private string BuildTags(GoProVideoInfo info)
        {
            var tags = $"{info.Width}x{info.Height}x";

            tags += Math.Round(info.FrameRate, 0).ToString("00");
            //tags += info.CodecName;
            return(tags);
        }
예제 #2
0
        private GoProVideoInfo ExtractMetadata(string videoUri)
        {
            var data = new GoProVideoInfo();

            var probe = new FFProbe();
            var info  = probe.GetMediaInfo(videoUri);

            data.VideoUri = videoUri;
            data.Duration = info.Duration;

            foreach (var tag in info.FormatTags)
            {
                switch (tag.Key.ToLowerInvariant())
                {
                case "creation_time":     // creation_time=2016-01-11T12:37:02.000000Z
                    data.Recorded = ExtractDateTime(tag.Value);
                    break;

                case "location":     // location=-45.0267+168.6460/;
                    data.Latitude  = ExtractLatitude(tag.Value);
                    data.Longitude = ExtractLongitude(tag.Value);
                    break;

                case "firmware":     //firmware=HD7.01.01.61.00
                    data.Firmware = tag.Value;
                    break;
                }
            }

            var stream = info.Streams[0];

            data.CodecName = stream.CodecName;
            data.FrameRate = stream.FrameRate;
            data.Height    = stream.Height;
            data.Width     = stream.Width;

            foreach (var tag in stream.Tags)
            {
                switch (tag.Key.ToLowerInvariant())
                {
                case "rotate":      // rotate=180
                    data.IsRotated = tag.Value == "180";
                    break;
                }
            }

            return(data);
        }
예제 #3
0
 public GoProVideo(FileInfo file, GoProVideoInfo info)
 {
     File = file;
     Info = info;
 }
예제 #4
0
        public void SelectGroup(ListViewGroup group)
        {
            // clear list
            if (PictureBox.Image != null)
            {
                PictureBox.Image.Dispose();
                PictureBox.Image = null;
            }

            Meta.Items.Clear();
            if (group == null)
            {
                _selectedSet = null;

                Title.BackColor = SystemColors.Window;
                Date.BackColor  = SystemColors.Window;
                Tags.BackColor  = SystemColors.Window;

                Title.Text = "";
                Date.Text  = "";
                Tags.Text  = "";

                Location.Enabled = false;
                Location.Text    = "Location";

                TrackBar.Enabled = false;
                TrackBar.Value   = 0;
                TrackBar.Maximum = 0;

                foreach (ListViewItem item in VideoList.Items)
                {
                    item.ForeColor = SystemColors.ControlText;
                    item.BackColor = SystemColors.Control;
                }
            }
            else
            {
                _selectedSet = (GoProSet)group.Tag;
                Title.Text   = _selectedSet.Title;
                Date.Text    = _selectedSet.Date;
                Tags.Text    = _selectedSet.Tags;

                GoProVideoInfo info     = null;
                var            duration = TimeSpan.FromTicks(0);
                foreach (ListViewItem item in group.Items)
                {
                    item.ForeColor = SystemColors.HighlightText;
                    item.BackColor = SystemColors.Highlight;
                    if (item.Checked)
                    {
                        var video = (GoProVideo)item.Tag;
                        duration += video.Info.Duration;
                        if (info == null)
                        {
                            info                = video.Info;
                            TrackBar.Tag        = video.File.FullName;
                            PictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                            PictureBox.Image    = (Image)video.Thumbnail.Clone();
                        }
                    }
                }

                Meta.Items.Add($"Duration:\t\t{duration.Hours} h {duration.Minutes} m {duration.Seconds} s");
                if (info != null)
                {
                    TrackBar.Enabled = true;
                    TrackBar.Maximum = Convert.ToInt32(Math.Floor(info.Duration.TotalMinutes));
                    Meta.Items.Add($"Resolution:\t{info.Width}x{info.Height}");
                    Meta.Items.Add($"Compression:\t{info.FrameRate.ToString("0.0")} FPS {info.CodecName}");
                    Meta.Items.Add($"Firmware:\t\t{info.Firmware}");
                }

                if (info.Latitude.HasValue && info.Longitude.HasValue)
                {
                    Location.Enabled = true;
                    Location.Text    = $"{info.Latitude.Value.ToString("0.0000")}x{info.Longitude.Value.ToString("0.0000")}";
                }
            }
        }