470,616 Members | 3,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,616 developers. It's quick & easy.

get Lengh video. as HH:MM:SS:FF

Hi all, i am new babie in vb.net.I use mediainfo to get lengh video and display as HH:MM:SS, so can i display it as HH:MM:SS:FF, thanks all advance.
Sep 15 '16 #1
2 1201
83 64KB
You could use an axWindowsMediaPlayer control to get the length of a video as a Double type value. Then use the TimeSpan class to get a String formatted as "HH:MM:SS". You could modify the example to format it to include milliseconds too if needed.

I am not sure what the "FF" stands for in your post so, i`m not sure what to tell you for that.

Also, you will want to test any video formats that you want to use this for. The axWindowsMediaPlayer control may not support some video formats.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  3.         AxWindowsMediaPlayer1.URL = "C:\test\vids\cc.avi"
  4.     End Sub
  6.     Private Sub AxWindowsMediaPlayer1_StatusChange(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.StatusChange
  7.         If AxWindowsMediaPlayer1.status.ToLower.Contains("playing") Then
  8.             AxWindowsMediaPlayer1.Ctlcontrols.stop()
  9.             Dim ts As TimeSpan = TimeSpan.FromSeconds(AxWindowsMediaPlayer1.currentMedia.duration)
  10.             Me.Text = If(ts.ToString.Contains("."), ts.ToString.Remove(ts.ToString.IndexOf(".")), ts.ToString).ToString
  11.         End If
  12.     End Sub
  13. End Class
Oct 10 '16 #2
296 100+
FF is Frames and will vary depending upon the frame-rate of the video. Also - if working with 59.94 don't forget to account for drop-frame.
Oct 11 '16 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by $hiv..... | last post: by
8 posts views Thread by Oscar Arreyano | last post: by
reply views Thread by tdrsam | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.