tomaszzmuda / Xabe.FFmpeg

.NET Standard wrapper for FFmpeg. It allows to process media without know how FFmpeg works, and can be used to pass customized arguments to FFmpeg from dotnet core application.

Home Page:https://xabe.net/product/xabe_ffmpeg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Struggling with commands

jh197033 opened this issue · comments

I have been working on using xabe.FFmpeg for over 4 days now, using all the examples in the documentations
https://ffmpeg.xabe.net/docs.html

Also looking at the src code samples but I just cannot get it working, it keeps saving vdo's in a stretched format.

All I need to do is take an existing uploaded video then:
1 - Find its width and height and convert if too big (I want 680 max either width or height keeping aspect ratio)
2 - Save it as an .mp4
3 - Grab multiple thumbnails (max 4)

I get the original vdo info from:
var mediaInfo = await FFmpeg.GetMediaInfo(sVideoPathOrig);
var videoStream = mediaInfo.VideoStreams.First();
var audioStream = mediaInfo.AudioStreams.First();

int iWidth = videoStream.Width;
int iHeight = videoStream.Height;

All I want to do is check if the sVideoPathOrig is bigger than 680 width or height, if yes, resize the video keeping the aspect ratio of the video (this is where I have the issue, it will save a vdo stretched if the height is more than the width or if the aspect ratio is not uploaded in a standard aspect ratio).

Is there a definitive example that someone can share taking a single vdo, check if it is over 680 width or height, if no then save the vdo as an .mp4 at the original resolution, if bigger, resize down to 680 max resolution (width or height) and then grab 4 thumnails?

Thanks to anyone in advance if you can help me.

Regards

James