Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reducing video size with same format and reducing frame size

This question might be very basic

Is there a way to reduce the frame size/rate of Lossy compressed (WMV, MPEG) format, to get a smaller video, of lesser size, with same format.

Are there any open source or proprietary apis for this?

like image 221
Vignesh Avatar asked Dec 20 '10 13:12

Vignesh


People also ask

Does reducing frame rate reduce file size?

The frame rate has a significant impact on the file size. US television has a frame rate of 30 frames per second (fps), while films in theatres are usually shown at 24 frames per second. Lowering the frame rate of your video to 15 or 10 fps can reduce the file size by as much as 200% or 300%.

Which video format reduces size?

You may have heard of the h. 264 codec (you may not have, but hang in there). This codec produces an MP4, which typically delivers the best quality, with smallest file size. Because of this, MP4 is very popular for web-based delivery including YouTube, Facebook, Twitter and Instagram.


1 Answers

ffmpeg provides this functionality. All you need to do is run someting like

ffmpeg -i <inputfilename> -s 640x480 -b 512k -vcodec mpeg1video -acodec copy <outputfilename> 

For newer versions of ffmpeg you need to change -b to -b:v:

ffmpeg -i <inputfilename> -s 640x480 -b:v 512k -vcodec mpeg1video -acodec copy <outputfilename> 

to convert the input video file to a video with a size of 640 x 480 and a bitrate of 512 kilobits/sec using the MPEG 1 video codec and just copying the original audio stream. Of course, you can plug in any values you need and play around with the size and bitrate to achieve the quality/size tradeoff you are looking for. There are also a ton of other options described in the documentation

Run ffmpeg -formats or ffmpeg -codecs for a list of all of the available formats and codecs. If you don't have to target a specific codec for the final output, you can achieve better compression ratios with minimal quality loss using a state of the art codec like H.264.

like image 194
Jason B Avatar answered Sep 21 '22 03:09

Jason B