0

While generating video thumbnail from c#, when video in portrait mode then that video thumbnail image automatic convert into landscape mode.

I am using NReco.VideoConverter.FFMpegConverter library Below is my code snippet

var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.GetVideoThumbnail(filePath, SnippetsVideoThumbUploadPath + guid + ".jpeg", 1);

1 Answers1

0

ffmpeg (which is internally used when GetVideoThumbnail is called) automatically rotates video frame according to the video metadata. If you want to get the frame 'as is' you need to specify -noautorotate option:

ffMpeg.ConvertMedia(filePath, null, SnippetsVideoThumbUploadPath + guid + ".jpeg", "mjpeg",
  new ConvertSettings() {
    VideoFrameCount = 1,
    Seek = 1,  // this is 3rd param of GetVideoThumbnail
    MaxDuration = 1,
    CustomInputArgs = "-noautorotate"
  });

(this call is equivalent to "GetVideoThumbnail" functionality but allows you to specify any additional ffmpeg options)

Vitaliy Fedorchenko
  • 8,447
  • 3
  • 37
  • 34
  • While i am using your solution i am facing error please check error and stack trace Error : Error splitting the argument list: Option not found Stack Trace : at NReco.VideoConverter.FFMpegConverter.ConvertMedia(Media input, Media output, ConvertSettings settings) at MobileService.Service.UploadSnippets_V2(String CustomerId, String SnippetsType) – Dharmin Gheewala Jul 12 '18 at 06:39