【问题标题】:While generating video thumbnail, Image automatic rotate into landscape生成视频缩略图时,图像自动旋转成横向
【发布时间】:2018-07-11 14:50:36
【问题描述】:

在从 c# 生成视频缩略图时,当视频处于纵向模式时,该视频缩略图图像会自动转换为横向模式。

我正在使用 NReco.VideoConverter.FFMpegConverter 库 下面是我的代码sn-p

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

【问题讨论】:

  • 你的问题是什么?
  • 我不明白你想做什么。
  • @nilsK 我的问题是,当我生成视频缩略图时,如果我在纵向模式下拍摄视频,那么那个特定的视频缩略图图像会以横向图像生成。如果我以纵向模式拍摄视频,我需要生成纵向图像
  • @DanWilson 请看我上面的评论,如果看不懂请再告诉我,

标签: c# video video-thumbnails video-conversion nreco


【解决方案1】:

ffmpeg(内部调用GetVideoThumbnail时使用)根据视频元数据自动旋转视频帧。如果您想“按原样”获取框架,则需要指定 -noautorotate 选项:

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

(此调用等效于“GetVideoThumbnail”功能,但允许您指定任何其他 ffmpeg 选项)

【讨论】:

  • 当我使用您的解决方案时,我遇到了错误,请检查错误和堆栈跟踪错误:拆分参数列表时出错:找不到选项堆栈跟踪:在 NReco.VideoConverter.FFMpegConverter.ConvertMedia(媒体输入, MobileService.Service.UploadSnippets_V2(String CustomerId, String SnippetsType) 处的媒体输出、ConvertSettings 设置)
猜你喜欢
  • 2016-05-05
  • 2021-03-08
  • 2012-09-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-04
  • 2011-02-19
  • 2018-06-06
  • 1970-01-01
相关资源
最近更新 更多