سؤال

أنا أبحث عن برنامج تعليمي جيد أو كيفية استخدام SharpFFMpeg أو إذا كانت هناك طريقة سهلة لاستخدام ffmpeg في c# ...

أرغب في تحويل الفيديو (تنسيق x) إلى video.flv مع التقاط لقطات الشاشة وحفظها أثناء التنقل.

إذا كان هناك برنامج تعليمي جيد أو كنت تعرف طريقة سهلة للقيام به، فيرجى نشره هنا.

شكرا ، كيران

هل كانت مفيدة؟

المحلول 2

تشغيل سطر الأوامر args www.codeproject.com/kb/cs/execute_command_in_csharp.aspx

استخراج الصورhttp://stream0.org/2008/02/howto-extract-images-from-a-vi.html

    protected void BTN_convert_Click(object sender, EventArgs e) {

  String runMe = @"C:\Documents and Settings\Wasabi Digital\My Documents\Visual Studio 2008\Projects\Evo\WEB\Bin\ffmpeg.exe";  
  String pathToFiles = @"C:\Documents and Settings\Wasabi Digital\My Documents\Visual Studio 2008\Evo\WEB\test\";    
  String convertVideo = " -i \"" + pathToFiles + "out.wmv\" \"" + pathToFiles + "sample3.flv\" ";
  String makeImages = " -i \"" + pathToFiles + "out.wmv\" -r 1 -ss 00:00:01 -t 00:00:15 -f image2 -s 120x96 \"" + pathToFiles + "images%05d.png\"";
  this.ExecuteCommandSync(runMe,convertVideo);
  this.ExecuteCommandSync(runMe, makeImages);
 }

وهذا مقتطف الكود مأخوذ من الرابط الأول.تسمح علامات الاقتباس الإضافية حول استخدام الأمر بتشغيله بمسافات في اسمه.على سبيل المثال ".../المستندات/..."

public void ExecuteCommandSync(String command, String args) {


 try {   
   System.Diagnostics.ProcessStartInfo procStartInfo =
    new System.Diagnostics.ProcessStartInfo("\""+command+"\"",args);

   Process.StandardOutput StreamReader.
   procStartInfo.RedirectStandardOutput = true;
   procStartInfo.UseShellExecute = false;

   procStartInfo.CreateNoWindow = true;

   System.Diagnostics.Process proc = new System.Diagnostics.Process();
   proc.StartInfo = procStartInfo;
   proc.Start();

   string result = proc.StandardOutput.ReadToEnd();

   Debug.WriteLine(result);
  } catch (Exception objException) {   
   // Log the exception
  }

نصائح أخرى

وهذا باستخدام ffmpeg.exe مع c # لا تستخدم فمبيج حاد.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top