我正在尝试线程与通过参数化调用的视频转换同步。
StartTheThread(inputpath, outputconvertpath);
此调用转到相对线程方法,该方法接受参数并以此方式转换视频的方式启动线程 -
public Thread StartTheThread(string inputpath, string outputconvertpath)
{
var t = new Thread(() => RealStart(inputpath, outputconvertpath));
t.Start();
return t;
}
public void RealStart(string inputpath, string outputconvertpath)
{
Monitor.Enter(this);
try
{
FFMpegConverter ff = new FFMpegConverter();
ff.ConvertMedia(inputpath, outputconvertpath, Format.mp4);
}
finally
{
Monitor.Exit(this);
}
}
视频转换参考 -
http://www.nrecosite.com/video_converter_net.aspx
什么行不通 -
直到我对方法StartTheThread
的调用,这工作正常,但当它实际上尝试处理方法RealStart
中的线程时;它永远不会在后台启动这个方法。
我研究过如何锁定流程 - http://www.codeproject.com/Articles/26130/Threads-and-Thread-Synchronization-in-C
但这对我没有帮助。
如何启动此主题,以便我的视频转换在后台运行?