General Media Properties via Script? Thiago_Sase wrote on 11/20/2024, 8:00 AM @jetdv Hello, Sir. Is that possible to access the general properties tab information via script? Back to post
Comments jetdv wrote on 11/20/2024, 9:18 AM What information, exactly, are you looking for? You can certainly get some of the information: public void Main(Vegas vegas) { myVegas = vegas; TrackEvent evnt = myVegas.Project.Tracks[0].Events[0]; Media myMedia = evnt.ActiveTake.Media; String s = "Path = " + evnt.ActiveTake.MediaPath + Environment.NewLine; s += "Media Type = " + evnt.MediaType + Environment.NewLine; s += "Average Data Rate = " + myMedia.AverageDataRate + Environment.NewLine; foreach (MediaStream myStream in myMedia.Streams) { s += "Stream Index = " + myStream.Index + Environment.NewLine; s += " Stream Info: " + myStream.StreamInfoText + Environment.NewLine; s += " Media Type: " + myStream.MediaType + Environment.NewLine; s += " FourCC: " + myStream.FormatFourCCString + Environment.NewLine; s += " Length: " + myStream.Length + Environment.NewLine; s += " type: " + myStream.GetType().ToString() + Environment.NewLine; } MessageBox.Show(s); } Thiago_Sase wrote on 11/20/2024, 9:47 AM @jetdv Thank you, Sir.And, if a create a button, and when I click on it, it will open the properties window with the general tab selected. Is that allowed via script or custom command? jetdv wrote on 11/20/2024, 9:52 AM No. There is no option to open the 'Properties' dialog - let alone select which tab is selected. Thiago_Sase wrote on 11/20/2024, 9:57 AM @jetdv Understood, Sir. One more information was learned today. Thank you. Thiago_Sase wrote on 11/23/2024, 6:06 AM @jetdv Hello, Sir. Please, if possible; If I select a video event, and need to be displayed its FPS and bit rate information, Which lines of code for FPS and bit rate should I write? Thiago_Sase wrote on 11/23/2024, 8:21 AM @jetdv I found a solution;For Frame Rate I used this; string fps = videoStream.FrameRate.ToString(); For Bit Rate I used this; private string GetBitrateInMbps(string filePath) { try { if (File.Exists(filePath)) { FileInfo fileInfo = new FileInfo(filePath); double fileSizeInBits = fileInfo.Length * 8.0; // File size in bits // Find media in MediaPool by matching file path Media media = null; foreach (Media m in myVegas.Project.MediaPool) { if (m.FilePath.Equals(filePath, StringComparison.OrdinalIgnoreCase)) { media = m; break; } } // If media is found, calculate bitrate if (media != null) { Timecode duration = media.Length; double durationInSeconds = duration.ToMilliseconds() / 1000.0; if (durationInSeconds > 0) { double bitrateInMbps = (fileSizeInBits / durationInSeconds) / 1000000.0; return bitrateInMbps.ToString("F2"); // Format to 2 decimal places } } } } catch (Exception ex) { // Optionally log the exception or display it for debugging MessageBox.Show($"Error calculating bitrate: {ex.Message}"); } return null; } jetdv wrote on 11/23/2024, 9:06 AM foreach(Track myTrack in myVegas.Project.Tracks) { foreach(TrackEvent evnt in myTrack.Events) { if (evnt.Selected && evnt.IsVideo()) { Media media = evnt.ActiveTake.Media; VideoStream vs = media.GetVideoStreamByIndex(0); string s = evnt.ActiveTake.MediaPath + Environment.NewLine; s += " Alpha Channel: " + vs.AlphaChannel + Environment.NewLine; s += " Average Data Rate: " + vs.AverageDataRate + Environment.NewLine; s += " Color Depth: " + vs.ColorDepth + Environment.NewLine; s += " Field Order: " + vs.FieldOrder + Environment.NewLine; s += " Framerate: " + vs.FrameRate + Environment.NewLine; s += " PAR: " + vs.PixelAspectRatio + Environment.NewLine; s += " Rotation: " + vs.Rotation + Environment.NewLine; s += " Stream Info: " + vs.StreamInfoText + Environment.NewLine; MessageBox.Show(s); } } } Thiago_Sase wrote on 11/23/2024, 9:25 AM @jetdv Thank you, Sir! 1