FFMPEG를 asp.net 웹 사이트에 통합하려고합니다. 내가 완료하려고하는 과정은 비디오를 업로드하고 .avi, .mov 또는 .wmv인지 확인한 다음 x264를 사용하여이 비디오를 mp4로 변환하여 플래시 플레이어가 재생할 수 있도록합니다.ASP.net FFMPEG 비디오 변환 수신 오류 : "오류 번호 -2가 발생했습니다"
내 업로드를 처리하기 위해 http 처리기 (ashx) 파일을 사용하고 있습니다. 여기서도 전환 코드를 입력합니다. 나는 이것이 이것이 놓이는 가장 좋은 곳인지 확신하지 못한다. 그러나 적어도 내가 일하게 할 수 있는지 알고 싶었다.
또한 cmd 행을 통해 수동으로 변환을 완료 할 수있었습니다. 내가 수행 한 프로세스에서 표준 오류를 출력 할 때 오류 -2가 발생합니다.
이
내가 나타나는 오류입니다 :는 FFmpeg 버전 SVN-r23001, 저작권 (C)
는 GCC 4.4 2010년 5월 1일 6시 6분 15초을 기반으로 2000-2010는 FFmpeg 개발자 .2
구성 : --enable-memalign-hack --cross-prefix = i686-mingw32- --cc = ccache-i686-mingw32-gcc --arch = i686 --target-os = mingw32 - enable-runtime-cpudetect - 사용 가능 avisynth - 사용 가능 - gpl - 사용 가능 버전 3 - 사용 가능 -bzlib - 사용 가능 libgsm - 사용 가능 - libfaad - 사용 가능 - pthreads - 사용 가능 - libvorbis - 사용 가능 libheor --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-libopencore_amrnb 50.15 libavutil
. 0/50.15. 0 libavcodec 52.66. 0/52.66. 0 libavformat 52.61. 0/52.61. 0 libavdevice 52. 2. 0/52. 2. 0 libswscale 0.10. 0/0.10. 0
는 532010_Robotica_720.wmv :
<%@ WebHandler Language="VB" Class="upload" %>
수입 시스템 수입 System.Web 수입 System.IO 수입 System.Diagnostics 네임 : 오류 번호는 -2 여기
아래의 코드 발생 Imports System.Threading
공용 클래스 업로드 : 구현 IHttpHandler
Public currentTime As System.DateTime
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
currentTime = System.DateTime.Now
If (Not context.Request.Files("Filedata") Is Nothing) Then
Dim file As HttpPostedFile : file = context.Request.Files("Filedata")
Dim targetDirectory As String : targetDirectory = HttpContext.Current.Server.MapPath(context.Request("folder"))
Dim targetFilePath As String : targetFilePath = Path.Combine(targetDirectory, currentTime.Month & currentTime.Day & currentTime.Year & "_" & file.FileName)
Dim fileNameArray As String()
fileNameArray = Split(file.FileName, ".")
If (System.IO.File.Exists(targetFilePath)) Then
System.IO.File.Delete(targetFilePath)
End If
file.SaveAs(targetFilePath)
Select Case fileNameArray(UBound(fileNameArray))
Case "avi", "mov", "wmv"
Dim fileargs As String =
fileargs = "-y -i " & currentTime.Month & currentTime.Day &
currentTime.Year & "_" & file.FileName & " -ab 96k -vcodec libx264
-vpre normal -level 41 "
fileargs += "-crf 25 -bufsize 20000k -maxrate 25000k -g 250 -r 20
-s 900x506 -coder 1 -flags +loop "
fileargs += "-cmp +chroma -partitions +parti4x4+partp8x8+partb8x8
-subq 7 -me_range 16 -keyint_min 25 "
fileargs += "-sc_threshold 40 -i_qfactor 0.71
-rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 "
fileargs += "-refs 6 -deblockalpha 0 -deblockbeta 0 -f mp4 " &
currentTime.Month & currentTime.Day & currentTime.Year & "_" &
file.FileName & ".mp4"
Dim proc As New Diagnostics.Process()
proc.StartInfo.FileName "ffmpeg.exe"
proc.StartInfo.Arguments = fileargs
proc.StartInfo.UseShellExecute = False
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.RedirectStandardError = True
AddHandler proc.OutputDataReceived, AddressOf SaveTextToFile
proc.Start()
SaveTextToFile2(proc.StandardError.ReadToEnd())
proc.WaitForExit()
proc.Close()
End Select
context.Response.Write("1")
End If
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
Private Shared Sub SaveTextToFile(ByVal sendingProcess As Object, ByVal strData As DataReceivedEventArgs)
Dim FullPath As String = "text.txt"
Dim Contents As String = ""
Dim objReader As StreamWriter
objReader = New StreamWriter(FullPath)
If Not String.IsNullOrEmpty(strData.Data) Then
objReader.Write(Environment.NewLine + strData.Data)
End If
objReader.Close()
End Sub
Private Sub SaveTextToFile2(ByVal strData As String)
Dim FullPath As String = "texterror.txt"
Dim Contents As String = ""
Dim objReader As StreamWriter
objReader = New StreamWriter(FullPath)
objReader.Write(Environment.NewLine + strData)
objReader.Close()
End Sub
최종 등급은
동일한 문제가 있습니다. 업데이트 한 사용 권한에 대한 자세한 내용을 제공 할 수 있습니까? – mateuscb