locked
Get video duration RRS feed

  • Question

  • User-2057314895 posted

    how do i get the duration of a video?

    Wednesday, April 9, 2008 9:51 AM

Answers

  • User2022958948 posted

    Hi,

    You can use FFMpeg to get the duration of video.

    You can download ffmpeg.exe at http://ffmpeg.mplayerhq.hu/download.html 

    And then, you can use System.Diagnostics to execute this exe file.

            Process ffmpeg; // creating process
            string video;
            video = Page.MapPath("test.flv"); // setting video input name with path
            ffmpeg = new Process();
    
            ffmpeg.StartInfo.Arguments = " -i "+video; // arguments !
            ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg.exe");
            ffmpeg.Start(); // start ! 
    Thus, you can use stream output to get its output stream.
    Hope it helps.
     
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 14, 2008 2:20 AM
  • User-2057314895 posted

    hi, i try and i get the video duration with FFMPEG, with this:


     

    1                Dim process As System.Diagnostics.Process = New System.Diagnostics.Process()
    2                process.StartInfo.UseShellExecute = False
    3                process.StartInfo.WorkingDirectory = ffmpegPath
    4                process.StartInfo.RedirectStandardError = True
    5    
    6                process.StartInfo.FileName = executavel
    7                process.StartInfo.Arguments = parametros
    8                process.StartInfo.RedirectStandardOutput = True
    9                process.Start()
    10               process.WaitForExit()
    11   
    12               Dim erro As String = process.StandardError.ReadToEnd()
    13               process.WaitForExit()
    14   
    15               Response.Write(erro) 
    
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 12:26 PM

All replies

  • User1584506651 posted

    Please be more specific. What format is the video in? Is this a web application or windows?

    Wednesday, April 9, 2008 11:40 AM
  • User-2057314895 posted

    is a web aplication

    the extension of the file is .flv

    i wnat to get the duration of this video

    Wednesday, April 9, 2008 12:22 PM
  • User1584506651 posted

    I am going to have to let someone else answer this, as I am not a FLV expert.

    Wednesday, April 9, 2008 1:42 PM
  • User2022958948 posted

    Hi,

    You can use FFMpeg to get the duration of video.

    You can download ffmpeg.exe at http://ffmpeg.mplayerhq.hu/download.html 

    And then, you can use System.Diagnostics to execute this exe file.

            Process ffmpeg; // creating process
            string video;
            video = Page.MapPath("test.flv"); // setting video input name with path
            ffmpeg = new Process();
    
            ffmpeg.StartInfo.Arguments = " -i "+video; // arguments !
            ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg.exe");
            ffmpeg.Start(); // start ! 
    Thus, you can use stream output to get its output stream.
    Hope it helps.
     
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 14, 2008 2:20 AM
  • User-2057314895 posted

    hi, i use this.

    but how i get a duration of the video with FFMPEG, i dont know do it. 

    Wednesday, April 16, 2008 10:01 AM
  • User-2057314895 posted

    hi, i try and i get the video duration with FFMPEG, with this:


     

    1                Dim process As System.Diagnostics.Process = New System.Diagnostics.Process()
    2                process.StartInfo.UseShellExecute = False
    3                process.StartInfo.WorkingDirectory = ffmpegPath
    4                process.StartInfo.RedirectStandardError = True
    5    
    6                process.StartInfo.FileName = executavel
    7                process.StartInfo.Arguments = parametros
    8                process.StartInfo.RedirectStandardOutput = True
    9                process.Start()
    10               process.WaitForExit()
    11   
    12               Dim erro As String = process.StandardError.ReadToEnd()
    13               process.WaitForExit()
    14   
    15               Response.Write(erro) 
    
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 12:26 PM