locked
How to generate image file from a stored video file RRS feed

  • Question

  • User657893922 posted

    Hello all, if anyone can tel me how to generate images of jpeg/gif format from a stored video file in asp.net 2.0 using  vb.net . I have searched many post . they all say ffshow.exe . can anybody forwrd me the code,. it will be of great help.

    please provide it ASAP.

    i tried with

      Sub take_snap()
            Dim sourceURL As String
            sourceURL = Server.MapPath("~/Data/" + "itsmylife.mpeg")

            Dim buffer As Byte() = New Byte(1) {}

            Dim read As Integer
            Dim total As Integer
            total = 0

            'create HTTP request

            Dim req As WebRequest = WebRequest.Create(sourceURL)


            'get response

            Dim resp As WebResponse = req.GetResponse()
            ' get response stream

            Dim stream As System.IO.Stream = resp.GetResponseStream()


            ' read data from stream

            While ((read = stream.Read(buffer, total, 1)) <> 0)

                total += read
            End While
            ' get bitmap

            Dim imageStream As New MemoryStream(buffer, 0, total)
            Dim bmp As Bitmap = Bitmap.FromStream(imageStream, False) // System.ArgumentException: Parameter is not valid.



            ' Dim bmp As Bitmap = Bitmap.FromStream(New MemoryStream(buffer, 0, total))  // ERRor At this line

          
        End Sub

     

     

    Friday, December 26, 2008 3:18 PM

Answers

  • User-1136466523 posted

    Hi,

    The following code in VB should be like this:

    Dim p As Process

    Dim info As New ProcessStartInfo()

    info.FileName = "ffmpeg.exe"

    info.WindowStyle = ProcessWindowStyle.Hidden

    info.Arguments = (" -i " & your_video_name & " -vframes 1 ") + your_extracted_image_name & "%d.jpg"

    p = Process.Start(info)

    While Not p.HasExited
        Thread.Sleep(10)
    End While

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 29, 2008 10:37 PM

All replies

  • User657893922 posted

     i tried with this but was not able to convert it in vb.net

    Process p; // unable to create process

    ProcessStartInfo info = new ProcessStartInfo();
    info.FileName = "ffmpeg.exe";
    info.WindowStyle = ProcessWindowStyle.Hidden;
    info.Arguments = " -i " + your_video_name + " -vframes 1 " + your_extracted_image_name + "%d.jpg";

    p = Process.Start(info);

    while (!p.HasExited) { Thread.Sleep(10); }
    Friday, December 26, 2008 3:38 PM
  • User-1136466523 posted

    Hi,

    The following code in VB should be like this:

    Dim p As Process

    Dim info As New ProcessStartInfo()

    info.FileName = "ffmpeg.exe"

    info.WindowStyle = ProcessWindowStyle.Hidden

    info.Arguments = (" -i " & your_video_name & " -vframes 1 ") + your_extracted_image_name & "%d.jpg"

    p = Process.Start(info)

    While Not p.HasExited
        Thread.Sleep(10)
    End While

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 29, 2008 10:37 PM