Is there a software that can perform downsampling of videos by a certain factor given by the user?

For example, if frame size: 1000x1000, and the video has: 25 frames/sec (fps), and I'd like to downsample it by (say): 2 (spatial) and 5 (temporal), then it will generate a video of frame size: 50x50, and 5 fps.

  • Thanks a lot!...I forgot to say, that (regarding temporal downscale), The output video needs to hold ONLY the frames of the desired frame rate. So, if the input video has (say) 1000 frames (25 fps), and the desired frame rate is 5 fps, then, output video: 200 frames....Most commercial tools don't do that...they replace the 'dropped' frames with the same one of the new frame rate (say: f1 f1 f1 f1 f2 f2 f2 f2 f3....fn, where fn_in_video = fn_out_video) – ichos Dec 2 '16 at 9:30

FFMPEG can do both including changing format and encoding, the following example assumes that you wish to downscale to 500x500 and 5 fps.

ffmpeg -i input.avi -vf scale=500:500 -r 5 output.avi


ffmpeg -i input.avi -r 5 -vf scale=500:500 output.avi

It is worth trying both as you may find that one is a lot faster than the other.

If you would like to keep the aspect ration make one of the height or width be -1.

To scale proportionately you will need to find out the existing values using ffprobe and then multiply them yourself, either manually or in a script.

It is Free, Gratis & Open Source and available for most platforms and there are a lot of other flags that you can add.

| improve this answer | |
  • worked, great!..just a minor comment, spatial downscaling is specified by the desired frame size (say, 500x500): >ffmpeg -i input.avi -vf scale=500:500 -r 5 output.avi ...is there a similar command for downscaling factor ('scale=0.5:0.5' didn't work)? – ichos Dec 2 '16 at 12:11

If you are looking for end-user software, I would recommend checking out M2Convert Professional. You can use the LEAD Video Frame Rate Controller Filter and LEAD Video Resize Filter.

If you want to develop an application built around this feature, I would recommend using the LEADTOOLS Multimedia SDK within your application. This library contains programmatic interfaces for C, C++, COM, and .NET applications. Using the aforementioned processing filters, you can write a simple conversion like this:

Leadtools.Multimedia.ConvertCtrl _convertctrl = new Leadtools.Multimedia.ConvertCtrl();
_convertctrl.SourceFile = @"C:\myInputFile.avi";    // Set Source
_convertctrl.SelectedVideoProcessors.Add(_convertctrl.VideoProcessors.FrameRateControl);    // Add processing filter
_convertctrl.SelectedVideoProcessors.Add(_convertctrl.VideoProcessors.Resize);    // Add processing filter

////Optional programmatic settings
//LMVFrameRateCtrlLib.ILMVFrameRateCtrl frameRateCtrl = null;
//frameRateCtrl = _convertctrl.GetSubObject(ConvertObject.SelVideoProcessor + 0) as LMVFrameRateCtrlLib.ILMVFrameRateCtrl;
//frameRateCtrl.Enable = true;
//frameRateCtrl.FrameRate = 5.0;
//frameRateCtrl.ChangeStreamLength = true;

////Optional programmatic settings
//LMVResizeLib.ILMVResize resizeFilter = null;
//resizeFilter = _convertctrl.GetSubObject(ConvertObject.SelVideoProcessor + 1) as LMVResizeLib.ILMVResize;
//resizeFilter.Enabled = true;
//resizeFilter.FillColor = 0;
//resizeFilter.Flags = LMVResizeLib.SIZETYPES.RESIZE_BICUBIC;
//resizeFilter.Width = 50;
//resizeFilter.Height = 50;
//resizeFilter.OutputAspectRatioMode = LMVResizeLib.OutputAspectRatioModeConstants.OUTPUTASPECTRATIO_CUSTOM;
//resizeFilter.CustomOutputAspectRatioWidth = 50;
//resizeFilter.CustomOutputAspectRatioHeight = 50;
//resizeFilter.StretchMode = LMVResizeLib.StretchModeConstants.STRETCHMODE_FITHEIGHT | LMVResizeLib.StretchModeConstants.STRETCHMODE_FITWIDTH;
//resizeFilter.WidthControlMode = LMVResizeLib.SizeControlModeConstants.SIZECONTROL_FIXED;
//resizeFilter.HeightControlMode = LMVResizeLib.SizeControlModeConstants.SIZECONTROL_FIXED;
//resizeFilter.SquarePixelOutputMode = LMVResizeLib.SquarePixelOutputModeConstants.SQUAREPIXELOUTPUT_INCREASESIZE;

//Show property pages
_convertctrl.ShowDialog(Leadtools.Multimedia.ConvertDlg.SelVideoProcessor + 0, this); //frame rate controller
_convertctrl.ShowDialog(Leadtools.Multimedia.ConvertDlg.SelVideoProcessor + 1, this); //resize filter

_convertctrl.VideoCompressors.H264.Selected = true;    // Set video compressor
_convertctrl.AudioCompressors.AAC.Selected = true;    // Set audio compressor
_convertctrl.TargetFormat = Leadtools.Multimedia.TargetFormatType.ISO;    // Set container
_convertctrl.TargetFile = @"C:\myOutputFile.mp4";    // Set destination file

_convertctrl.StartConvert();    // Do conversion

These video filters can be used entirely through the built-in UI or you can control them programmatically (as shown above).

I would recommend dropping the frame rate before resizing the frames, as this will minimize the amount of CPU needed. No point in resize frames you're throwing away anyway.

Disclaimer: I am an employee of the company that wrote this library.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.