-1

i am working on a web page to upload MP4 video and getting a thumbnail from the video

i am using NReco FFMpeg Converter to achieve this . it is working fine locally but upload it on a shared hosting it crashes at ffMpeg.GetVideoThumbnail

        string VideoUrl = dataMediaUrl.ImageUrl;
        string extension = VideoUrl.Split('.')[VideoUrl.Split('.').Length - 1];
        var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
        string thumbnailJPEGpath = Server.MapPath(VideoUrl.Replace("~/upload/MediaGallery/", "~/upload/MediaGallery/Thumb_").Replace("." + extension, ".jpg"));
        ffMpeg.GetVideoThumbnail(Server.MapPath(VideoUrl), thumbnailJPEGpath);
        dataThumbUrl.ImageUrl = VideoUrl.Replace("~/upload/MediaGallery/", "~/upload/MediaGallery/Thumb_").Replace("." + extension, ".jpg");

This is the error I am getting:

Server Error in '/' Application.
This program is blocked by group policy. For more information, contact your system administrator
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ComponentModel.Win32Exception: This program is blocked by group policy. For more information, contact your system administrator

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[Win32Exception (0x80004005): This program is blocked by group policy. For more information, contact your system administrator]
   System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) +1889
   System.Diagnostics.Process.Start() +119
   System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +49
   NReco.VideoConverter.FFMpegConverter.ConvertMedia(Media input, Media output, ConvertSettings settings) +1163
   NReco.VideoConverter.FFMpegConverter.GetVideoThumbnail(String inputFile, String outputFile, Nullable`1 frameTime) +155
   Admin_MediaGalleryVideoUpload.InsertButton_Click(Object sender, EventArgs e) +591
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9782698
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3394.0
Naeem Khan
  • 950
  • 4
  • 13
  • 34
Mariam Nagy
  • 75
  • 2
  • 11
  • I don't think you can fix this. Seems it is blocked explicitly on the server `blocked by group policy`. Better ask the hosting provider. – VDWWD Jul 15 '19 at 07:55
  • Have you contacted your shared hosting provider? The exception seems to be pretty clear that there is a policy in place that is preventing execution. Maybe your shared hosting does not allow the launching of another process? Many shared hosting environments have these type of restrictions. – pstrjds Jul 15 '19 at 07:55
  • 1
    Just FYI - if you check the [documentation](https://www.nrecosite.com/video_converter_net.aspx) (look under FAQ #3) for NReco you will find this line: `VideoConverter invokes FFMpeg in a separate process (with System.Diagnostics.Process) and your project environment/platform should allow that. This might be not possible in the following cases: partial-trust environments: most shared ASP.NET hostings` – pstrjds Jul 15 '19 at 08:02
  • thank i will ask the hosting support another time with this info .. as contcted them but dont know how to help me – Mariam Nagy Jul 15 '19 at 08:05
  • I'm voting to close this question as off-topic because the problem is not code related, but rather is server permission related and the library in question contains an answer to this question directly in the `FAQ` where they list limitations including shared ASP.Net hosting environments. – pstrjds Jul 15 '19 at 08:06
  • @MariamNagy - Most likely the hosting support cannot help you as they can't/won't change the group policy for the shared environment. Probably your only solution would be to move to a higher tiered hosting package where launching of an external process is allowed. Another option would be to explore creating a managed wrapper around the FFMPEG dll itself or making p/invoke calls into it so that you don't have to call an external process. – pstrjds Jul 15 '19 at 08:11

1 Answers1

1

Your problem is that part of the code (probably inside of one of the methods you call):

System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

If it execute a process on a remote machine the user that execute it need to have the permissions to execute programs on it (not granted by default).

To help you more we need to know the source code of method where StartWithCreateProcess is called ( NReco.VideoConverter.FFMpegConverter.GetVideoThumbnail(...)).

EDIT: Googling a bit seems that NReco is an external library, i suggest to open a ticket to their support.

pstrjds
  • 16,840
  • 6
  • 52
  • 61
Legion
  • 760
  • 6
  • 23
  • 1
    No need to open a ticket, they explicitly list this problem in their `Technical Limitations` section of the FAQ. – pstrjds Jul 15 '19 at 08:07