none
invalid data found wen processing input RRS feed

  • Question

  • Hi hello i try to extract a frame from a video.mp4 to image.jpg with ffmpeg on visual studio 2012

    wen i try to extract the frame it give me an error on ffmpeg.

    wen the form is load you have a button to chose a video.mp4 the its copy this file to the same folder of ffmpeg and then the command to extract, bellow image

    This is my error

    invalid data found wen processing input

    This is my code

    Private Sub executeffmpegextractthumb()
            
    
            'Dim p As Process = Process.Start("cmd", "/k ffmpeg.exe -i " + TextBox1.Text + " -framerate 5/1 -filter:v fps=" + TextBox2.Text + " C:\Program Files\mdlabs_media_browser\media video maker\temp\out%02d.jpg")
            Dim p As Process = Process.Start("cmd", "/k ffmpeg -i " + TextBox1.Text + " -vcodec mjpeg -qscale 0 -f image2 temp.jpg")
    
            p.WaitForExit()
    
            If p.HasExited Then
                MsgBox("The Extraction Are Finish...")
    
    
    
            End If
    
    
        End Sub

    Monday, January 7, 2019 5:28 PM

All replies

  • If the filename contains spaces, then try adding quotation marks:

    Dim p As Process = Process.Start("cmd", "/k ffmpeg -i """ & TextBox1.Text & """ -vcodec . . .

    And use '&' instead of '+'.

    • Edited by Viorel_MVP Monday, January 7, 2019 6:26 PM
    • Proposed as answer by IronRazerz Monday, January 7, 2019 11:40 PM
    Monday, January 7, 2019 6:24 PM
  •  As Viorel has suggested, you need to add quotes around the input and output file paths.  You can use the double quote method as Viorel has shown,  or you can add the quote characters in as i show in the old example I posted below,  using the Chr(34) char.  It uses an AxWindowsMediaPlayer to let you select a frame from anywhere in the video and then save a (.jpg) image of it.

     Requires 1 AxWindowsMediaPlayer control and 2 Buttons,  one for opening the video file and the other for saving the currently showing frame as a jpg image.

    Public Class Form1
        Private OpenedVideo As String = ""

        Private Sub Button_Open_Click(sender As Object, e As EventArgs) Handles Button_Open.Click
            Dim ofd As New OpenFileDialog
            ofd.Title = "Open A Video..."
            ofd.Filter = "Video Files|*.avi;*.flv;*.mp4"
            ofd.Multiselect = False
            If ofd.ShowDialog = DialogResult.OK Then
                OpenedVideo = ofd.FileName
                AxWindowsMediaPlayer1.URL = OpenedVideo
            End If
        End Sub

        Private Sub Button_SaveFrame_Click(sender As Object, e As EventArgs) Handles Button_SaveFrame.Click
            Dim proc As New Process
            proc.StartInfo.UseShellExecute = False
            proc.StartInfo.CreateNoWindow = True
            proc.StartInfo.FileName = "C:\Test\ffmpeg.exe"
            Dim FrameTime As Double = AxWindowsMediaPlayer1.Ctlcontrols.currentPosition
            Dim SaveAs As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Picture_" & FrameTime.ToString.Replace(".", "-") & ".jpg")
            proc.StartInfo.Arguments = "-ss " & FrameTime.ToString & " -i " & Chr(34) & OpenedVideo & Chr(34) & " -vframes 1 -f image2 " & Chr(34) & SaveAs & Chr(34)
            proc.Start()
        End Sub
    End Class




    If you say it can`t be done then i`ll try it

    Tuesday, January 8, 2019 12:13 AM