0

您好,我正在尝试使以下代码工作...但我在 conv.convertmedia 行收到错误“String”类型的值无法转换为“FFMpegInput()”

    Dim conv = New NReco.VideoConverter.FFMpegConverter()
    AddHandler conv.ConvertProgress, AddressOf converter_progress
    Dim settings As New OutputSettings
    settings.SetVideoFrameSize(320, 320)
    settings.VideoCodec = "h264"
    Dim inputpath = TextBox1.Text
    conv.ConvertMedia(inputpath, "c:\temp\1.mkv", NReco.VideoConverter.Format.matroska, settings)

我试图将 inputpath 声明为 FFMpegInput() 但我无法设法将它与 convertmedia 一起正确使用。

编辑:找到解决方案

 Dim inputpaths As FFMpegInput() = {New FFMpegInput("video.mp4")}

    conv.ConvertMedia(inputpaths, "c:\temp\1.mkv", NReco.VideoConverter.Format.matroska, settings)
4

1 回答 1

0

It seems you've specified incorrect number of ConvertMedia arguments; and you don't need to use overload that expects array of FFMpegInput if you have only one input file. In your original code you forgot to specify 2-nd parameter which determines input format (it can be null and in this case ffmpeg will autodetect input format):

conv.ConvertMedia(inputpath, null, "c:\temp\1.mkv", NReco.VideoConverter.Format.matroska, settings)
于 2018-09-12T16:02:43.410 回答