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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nhanatv
    New Member
    • Sep 2016
    • 1

    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.
  • IronRazer
    New Member
    • Jan 2013
    • 83

    #2
    You could use an axWindowsMediaP layer 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 axWindowsMediaP layer control may not support some video formats.

    Code:
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            AxWindowsMediaPlayer1.URL = "C:\test\vids\cc.avi"
        End Sub
    
        Private Sub AxWindowsMediaPlayer1_StatusChange(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.StatusChange
            If AxWindowsMediaPlayer1.status.ToLower.Contains("playing") Then
                AxWindowsMediaPlayer1.Ctlcontrols.stop()
                Dim ts As TimeSpan = TimeSpan.FromSeconds(AxWindowsMediaPlayer1.currentMedia.duration)
                Me.Text = If(ts.ToString.Contains("."), ts.ToString.Remove(ts.ToString.IndexOf(".")), ts.ToString).ToString
            End If
        End Sub
    End Class

    Comment

    • !NoItAll
      Contributor
      • May 2006
      • 297

      #3
      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.

      Comment

      Working...