从 c# 生成视频缩略图时,当视频处于纵向模式时,该视频缩略图图像会自动转换为横向模式。
我正在使用NReco.VideoConverter.FFMpegConverter库下面是我的代码片段
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.GetVideoThumbnail(filePath, SnippetsVideoThumbUploadPath + guid + ".jpeg", 1);
从 c# 生成视频缩略图时,当视频处于纵向模式时,该视频缩略图图像会自动转换为横向模式。
我正在使用NReco.VideoConverter.FFMpegConverter库下面是我的代码片段
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.GetVideoThumbnail(filePath, SnippetsVideoThumbUploadPath + guid + ".jpeg", 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 选项)