I have been trying to just change the resolution of a video and I don’t want to re-compress or transcode the video, is there any way in which I can simply change the resolution?
Using FFmpeg, you can change a video’s resolution without having to recompress or convert it. Known as “resizing” or “scaling” the video, this procedure lets you change the video’s dimensions without compromising its original quality.
Here’s how to make this happen:
I assume that you have installed FFmpeg on your system and if not please follow the below given instructions:
Use the scale Filter: The scale filter is a useful tool for scaling videos and is provided by FFmpeg. The following is the basic command to change the resolution:
ffmpeg -i input.mp4 -vf "scale=new_width:new_height" output.mp4
Enter the real name of your input video file instead of input.mp4, and output.mp4 should be the name of the desired output file. Indicate the new resolution in the scale=new_width:new_height
section by giving the desired width and height, for example, 1280:720 for 720p resolution.
For example:
ffmpeg -i input.mp4 -vf "scale=1920:1080" output.mp4
This command resizes the video to 1920x1080 (Full HD) resolution without requiring transcoding. The bitrate, quality, and codec of the original video are retained.
Any thoughts on how to preserve the video aspect ratio while scaling a video with new dimensions?
Same here, I have a video with a width of 800 and a height of 480 pixels. The video aspect ratio is 5:3. What should I set as the new width and height if, I want to convert it to 240p while keeping the same aspect ratio?
For your use case, you have to consider 240 pixels as your new height and calculate the new width with the following formula.
new_width = 5 / 3 * 240 = 400
So your new width and height will be 400 and 240 pixels accordingly.
Or you can look into the list of common resolutions.
Thanks