如何向ffmpeg提供登录用户名和密码?

时间:2021-10-05 19:21:48

how can i provide username and password to ffmpeg to enable it to write data to some folder in ftp server? the folder is protected by password and if possible i dont want to remove that password. so, can i simply just pass the password to ffmpeg? or is there any other solutions?

如何向ffmpeg提供用户名和密码,使其能够将数据写入ftp服务器中的某个文件夹?该文件夹受密码保护,如果可能,我不想删除该密码。那么,我可以简单地将密码传递给ffmpeg吗?或者还有其他的解决办法吗?

example of ffmpeg process to create thumbnail from video file

ffmpeg过程的例子,从视频文件创建缩略图

string thumbpath, thumbname, videofile;
videofile = "Video Source path";
thumbpath = "thumbnail path";
thumbname = thumbpath + "20120910160600.mjpeg";

string thumbargs = "-i \"" + videofile + "\" -vframes 1 -s 60*30 -ss 00:00:00 -f image2 \"" + thumbname + "\"";

Process process = new Process();

process.StartInfo.FileName = Server.MapPath("~\\ffmpeg\\bin\\ffmpeg.exe");
process.StartInfo.Arguments = thumbargs;

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = false;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

New Learner, Please guide me....

新学习者,请指导我....

1 个解决方案

#1


1  

Provided that you have the possibility to set permissions on the folder(s) you are making ffmpeg write to, you can set up the account that the ASP.NET process is running under to have write access. You can control which account ASP.NET is running under either by configuring the app pool or by using impersonation. This is the easiest approach.

如果您有可能对正在编写ffmpeg的文件夹设置权限,您可以设置ASP的帐户。NET进程正在运行,以具有写访问权限。您可以控制哪个帐户ASP。NET通过配置应用程序池或使用模拟来运行。这是最简单的方法。

Application level impersonation is done by putting this in the web.config:

应用程序级别的模拟是通过把这个放到web.config:

<identity impersonate="true" userName="accountname" password="password" />

This will cause the web application to run as the provided user all the time.

这将导致web应用程序始终作为提供的用户运行。

If you want to tighten security, you can make only the process that is running ffmpeg run under a user with write access. You can achieve this using code level impersonation (as described in the impersonation link above).

如果您希望加强安全性,那么只能让运行ffmpeg的进程在具有写访问权限的用户下运行。您可以使用代码级别的模拟来实现这一点(如上面的模拟链接所述)。

Regardless of the approach ffmpeg shouldn't need to know which user it's running as.

不管采用哪种方法,ffmpeg都不需要知道它运行的是哪个用户。

#1


1  

Provided that you have the possibility to set permissions on the folder(s) you are making ffmpeg write to, you can set up the account that the ASP.NET process is running under to have write access. You can control which account ASP.NET is running under either by configuring the app pool or by using impersonation. This is the easiest approach.

如果您有可能对正在编写ffmpeg的文件夹设置权限,您可以设置ASP的帐户。NET进程正在运行,以具有写访问权限。您可以控制哪个帐户ASP。NET通过配置应用程序池或使用模拟来运行。这是最简单的方法。

Application level impersonation is done by putting this in the web.config:

应用程序级别的模拟是通过把这个放到web.config:

<identity impersonate="true" userName="accountname" password="password" />

This will cause the web application to run as the provided user all the time.

这将导致web应用程序始终作为提供的用户运行。

If you want to tighten security, you can make only the process that is running ffmpeg run under a user with write access. You can achieve this using code level impersonation (as described in the impersonation link above).

如果您希望加强安全性,那么只能让运行ffmpeg的进程在具有写访问权限的用户下运行。您可以使用代码级别的模拟来实现这一点(如上面的模拟链接所述)。

Regardless of the approach ffmpeg shouldn't need to know which user it's running as.

不管采用哪种方法,ffmpeg都不需要知道它运行的是哪个用户。