{"id":2075,"date":"2022-06-03T02:31:25","date_gmt":"2022-06-02T21:01:25","guid":{"rendered":"https:\/\/smarttech101.com\/?p=2075"},"modified":"2022-06-24T20:51:10","modified_gmt":"2022-06-24T15:21:10","slug":"ffmpeg-compress-rescale-video-and-image","status":"publish","type":"post","link":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/","title":{"rendered":"FFmpeg: Compress and Rescale Video and Image"},"content":{"rendered":"\n<p>In this article, I will help you compress any video or image using FFmpeg with\/without losing quality. All of the commands given below should work with all encoders. I will also be talking about an efficient and modern encoder <strong>x265<\/strong>. At the same time, I will also help you in changing your image and video resolution to some lower value.  <\/p>\n\n\n\n<p><strong>Note: <\/strong>I have tested all the commands given below on Linux. For Mac OS, which is based on UNIX, they should work fine. And for Windows, you can use Windows Subsystem for Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"table-of-contents\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#1-installation-of-ffmpeg\">1. Installation of FFmpeg<\/a><\/li><li><a href=\"#2-how-to-compress-a-video-using-ffmpeg-without-losing-quality\">2. How to Compress a Video Using FFmpeg Without Losing Quality?<\/a><ul><li><a href=\"#2-1-compression-with-ffmpeg-s-default-settings\">2.1. Compression With FFmpeg\u2019s Default Settings<\/a><\/li><li><a href=\"#2-2-compression-using-libx265-encoder-in-ffmpeg\">2.2. Compression Using libx265 Encoder in FFmpeg<\/a> <\/li><\/ul><\/li><li><a href=\"#3-how-to-change-video-resolution-using-ffmpeg\">3. How to Change Video Resolution Using FFmpeg?<\/a><ul><li><a href=\"#3-1-get-video-resolution-using-ffmpeg\">3.1. Get Video Resolution Using FFmpeg<\/a><\/li><li><a href=\"#3-2-scale-video-to-given-width-and-height-using-ffmpeg\">3.2. Scale Video to Given Width and Height Using FFmpeg<\/a><\/li><li><a href=\"#3-3-scale-video-to-given-width-while-preserving-the-aspect-ratio-using-ffmpeg\">3.3. Scale Video to Given Width While Preserving the Aspect Ratio Using FFmpeg<\/a><\/li><\/ul><\/li><li><a href=\"#4-compress-rescale-without-losing-any-audio-or-subtitle-track-in-an-mkv-video-using-ffmpeg\">4. Compress\/Rescale Without Losing Any Audio or Subtitle Track in an Mkv Video Using FFmpeg<\/a><\/li><li><a href=\"#5-compress-rescale-all-videos-in-a-directory-using-ffmpeg\">5. Compress\/Rescale All Videos in a Directory Using FFmpeg<\/a><\/li><li><a href=\"#6-compress-rescale-images-using-ffmpeg\">6. Compress\/Rescale Images using FFmpeg<\/a><\/li><li><a href=\"#7-way-ahead\">7. Way Ahead<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-installation-of-ffmpeg\">1. Installation of FFmpeg<\/h2>\n\n\n\n<p>FFmpeg is one of the most widely used applications. Therefore, <strong>by default, it comes installed with all major distributions\/packages. <\/strong><\/p>\n\n\n\n<p>If you are not sure whether your computer has FFmpeg or not, install it using one of the following commands:<\/p>\n\n\n\n<p><strong>Debian based distributions ( Ubuntu, Raspbian, and Kali Linux)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ sudo apt-get install ffmpeg <\/code><\/pre>\n\n\n\n<p><strong>Alpine Linux<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ sudo apk add ffmpeg<\/code><\/pre>\n\n\n\n<p><strong>Arch Linux based distributions (Manjaro)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ sudo pacman -S ffmpeg <\/code><\/pre>\n\n\n\n<p><strong>Fedora and CentOS<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ sudo dnf install ffmpeg<\/code><\/pre>\n\n\n\n<p>Now that you have installed FFmpeg, you can start compressing your videos.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-how-to-compress-a-video-using-ffmpeg-without-losing-quality\">2. How to Compress a Video Using FFmpeg Without Losing Quality?<\/h2>\n\n\n\n<p>Here, first I will talk about compression using the<strong> default encoder (x264)<\/strong> and then the <strong>efficient one &#8211; x265.<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-1-compression-with-ffmpeg-s-default-settings\">2.1. Compression With FFmpeg\u2019s Default Settings<\/h3>\n\n\n\n<p>First of all, the FFmpeg&#8217;s <strong>default settings <\/strong>are already highly optimized. I was able to <strong>reduce the size of one of my files by 80% without any quality loss<\/strong>! For you, the result might be a little different and hence you should try it first.<\/p>\n\n\n\n<p><strong>Syntax<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT_VIDEO OUTPUT_VIDEO.EXT<\/code><\/pre>\n\n\n\n<p>In the above command, replace INPUT_VIDEO, OUTPUT_VIDEO, and EXT with your input video, output filename, and its extension (such as mp4, webm, and mkv) respectively.<\/p>\n\n\n\n<p>For <strong>example<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i input_video.mp4 output_video.mp4<\/code><\/pre>\n\n\n\n<p><strong>Note<\/strong>: this FFmpeg command <strong>can also be used to convert from one video format (say mkv) to another (say mp4)<\/strong> by using the appropriate EXT value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-2-compression-using-libx265-encoder-in-ffmpeg\">2.2. Compression Using libx265 Encoder in FFmpeg<\/h3>\n\n\n\n<p>The name libx265 is a portmanteau for the &#8216;library x265&#8217;. <a href=\"https:\/\/www.streamingmedia.com\/Articles\/Editorial\/Featured-Articles\/Netflix-Finds-x265-20-More-Efficient-than-VP9-113346.aspx\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Netflix conducted a survey in Aug 2016 and found that x265 outperforms<\/a> many of its competitors both in terms of quality and file size.<\/p>\n\n\n\n<p>To use this, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT_VIDEO -codec:v libx265 OUTPUT_VIDEO.EXT<\/code><\/pre>\n\n\n\n<p>Here, <code>v<\/code> in the <code>-codec:v<\/code> stands for video. Similarly, there is another flag called <code>-codec:a<\/code> for audio encoders. <strong>Changing the audio codec does not change the file size much<\/strong> so I will be skipping it. <\/p>\n\n\n\n<p>In my case, I found that the above command reduced the size of one of my files by 90%! For your case, please comment below. It will help other readers.<\/p>\n\n\n\n<p>To control the video quality, you can use x265&#8217;s<strong> CRF <\/strong>(<strong>Constant Rate Factor). <\/strong>And for this, use the <code>-crf<\/code> flag:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT_VIDEO -codec:v libx265 -crf CRF OUTPUT_VIDEO.EXT<\/code><\/pre>\n\n\n\n<p>The <strong>CRF can take any value from 0 to 51. <\/strong>0 means lossless compression and 51 means maximum losses. If you increase the CRF, the file size will reduce at the cost of visual quality and vice versa. If you don&#8217;t supply the <code>-crf CRF<\/code>, FFmpeg assumes the <strong>default value of 28.<\/strong> <\/p>\n\n\n\n<p>All of the above commands reduce video file size while keeping the visual quality almost the same. But nowadays videos are available in very high resolution (like 4K) and no matter how much compression you apply you cannot reduce the file size enough to fit these videos in your SSDs and smartphones. In that case, you might consider scaling down the resolution and that is explained below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-how-to-change-video-resolution-using-ffmpeg\">3. How to Change Video Resolution Using FFmpeg?<\/h2>\n\n\n\n<p>Before you start resizing\/rescaling your video, you need to get its resolution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-1-get-video-resolution-using-ffmpeg\">3.1. Get Video Resolution Using FFmpeg<\/h3>\n\n\n\n<p>For this purpose, use the<strong> ffprobe<\/strong> command included in the FFmpeg package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffprobe INPUT_VIDEO<\/code><\/pre>\n\n\n\n<p>Sample <strong>Output (I have boldened and underlined the resolution and removed unimportant information):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n...\n...\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\/home\/ajay\/Videos\/Video.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 1\n    compatible_brands: isomavc1\n    creation_time   : 2014-03-30T20:52:44.000000Z\n  Duration: 01:42:00.94, start: 0.000000, bitrate: 1102 kb\/s\n  Stream #0:0(und): Video: h264 (High) (avc1 \/ 0x31637661), yuv420p(tv, bt709\/bt709\/unknown), <span style=\"text-decoration: underline;\"><strong>1280x544<\/strong><\/span> &#91;SAR 1:1 DAR 40:17], 1004 kb\/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)\n    Metadata:\n      creation_time   : 2014-03-30T20:52:44.000000Z\n      handler_name    : video.264#trackID=1:fps=23.976 - Imported with GPAC 0.5.0-rev\n      vendor_id       : &#91;0]&#91;0]&#91;0]&#91;0]\n  Stream #0:1(eng): Audio: aac (LC) (mp4a \/ 0x6134706D), 48000 Hz, stereo, fltp, 93 kb\/s (default)\n    Metadata:\n      creation_time   : 2014-03-30T20:52:48.000000Z\n      handler_name    : GPAC ISO Audio Handler\n      vendor_id       : &#91;0]&#91;0]&#91;0]&#91;0]\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-2-scale-video-to-given-width-and-height-using-ffmpeg\">3.2. Scale Video to Given Width and Height Using FFmpeg<\/h3>\n\n\n\n<p>To change video resolution to the WIDTH x HEIGHT, you need to use <code>-filter:v scale=WIDTH:HEIGHT<\/code> as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT -filter:v scale=WIDTH:HEIGHT OUTPUT.EXT<\/code><\/pre>\n\n\n\n<p>So, for example, if you want to scale down your video to 1280p x 720p, use<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i input.mp4 -filter:v scale=1280:720 output.mp4<\/code><\/pre>\n\n\n\n<p><strong>Note 1:<\/strong> <strong>both WIDTH and HEIGHT should be divisible by n where n is 1 or 2 or 3&#8230; <\/strong>That is, if you get any error, just try to change WIDTH and HEIGHT a little bit so that both are divisible by 2. And if you again get errors, try to make them divisible by 3 or so.<\/p>\n\n\n\n<p><strong>Note 2: <\/strong>If there is little imperfection in the WIDTH and HEIGHT, you might end up with a video that is too much stretched horizontally or vertically as in the following image. To prevent this behavior, you need to tell the FFmpeg to preserve the <strong>ratio of width and height (called Aspect Ratio)<\/strong> as given in the next heading. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"640\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/tux.png?resize=350%2C640&#038;ssl=1\" alt=\"Image with Poor Aspect Ratio\" class=\"wp-image-1635\"\/><figcaption>Figure: Image with Poor Aspect Ratio<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-3-scale-video-to-given-width-while-preserving-the-aspect-ratio-using-ffmpeg\">3.3. Scale Video to Given Width While Preserving the Aspect Ratio Using FFmpeg<\/h3>\n\n\n\n<p>Here, you need to set only the HEIGHT. The WIDTH will be calculated by FFmpeg based on the input video&#8217;s aspect ratio.  For this purpose, <strong>set the WIDTH to some negative value. <\/strong><\/p>\n\n\n\n<p>So for <strong>example<\/strong>, to change video resolution to 720p, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> ~$ ffmpeg -i INPUT_VIDEO -filter:v scale=-2:360 OUTPUT_VIDEO.EXT<\/code><\/pre>\n\n\n\n<p>As you can see, I am using -2 instead of -1 because the <strong>FFmpeg&#8217;s default encoder (libx264 on 5 Jan 2021 <\/strong>on Arch Linux) accepts only those WIDTH and HEIGHT which are divisible by 2. This divisibility by 2 is also a requirement in the libx265 mentioned above. <\/p>\n\n\n\n<p>Similarly, you can also assign HEIGHT some negative value while setting the WIDTH your desired value.<\/p>\n\n\n\n<p>All of the above-mentioned commands in this article only transfer one audio track from the input file to the output file. But what if you want to transfer all tracks?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-compress-rescale-without-losing-any-audio-or-subtitle-track-in-an-mkv-video-using-ffmpeg\">4. Compress\/Rescale Without Losing Any Audio or Subtitle Track in an Mkv Video Using FFmpeg<\/h2>\n\n\n\n<p>Before proceeding, you should know a little bit about mkv files. Unlike an mp4 file, <strong>an mkv file supports an unlimited number of subtitles and audio tracks. <\/strong>And now you can use some shortcut keys in your video player to switch between these tracks. This is especially helpful for multilingual support.<\/p>\n\n\n\n<p>To check if your video has multiple audio and subtitle tracks, use the <strong>ffprobe<\/strong> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffprobe INPUT<\/code><\/pre>\n\n\n\n<p>Sample <strong>Output<\/strong> <strong>(I have boldened and underlined important information and removed unimportant information):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ ffprobe sample.mkv\n...\n...\n...\nInput #0, matroska,webm, from '\/home\/ajay\/sample.mkv':\n  Metadata:\n    encoder         : libebml v1.3.3 + libmatroska v1.4.4\n    creation_time   : 2018-05-22T02:41:21.000000Z\n  Duration: 00:23:55.11, start: 0.000000, bitrate: 731 kb\/s\n  <strong><span style=\"text-decoration: underline;\">Stream #0:0: Video<\/span><\/strong>: hevc (Main), yuv420p(tv, bt709), 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)\n    Metadata:\n      BPS             : 543787\n      BPS-eng         : 543787\n      DURATION        : 00:23:55.017000000\n      DURATION-eng    : 00:23:55.017000000\n      NUMBER_OF_FRAMES: 34406\n      NUMBER_OF_FRAMES-eng: 34406\n      NUMBER_OF_BYTES : 97543101\n      NUMBER_OF_BYTES-eng: 97543101\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:1(eng): Audio<\/span><\/strong>: aac (LC), 44100 Hz, stereo, fltp (default)\n    Metadata:\n      title           : <strong><span style=\"text-decoration: underline;\">English<\/span><\/strong> Stereo\n      BPS             : 88552\n      BPS-eng         : 88552\n      DURATION        : 00:23:50.000000000\n      DURATION-eng    : 00:23:50.000000000\n      NUMBER_OF_FRAMES: 61585\n      NUMBER_OF_FRAMES-eng: 61585\n      NUMBER_OF_BYTES : 15828794\n      NUMBER_OF_BYTES-eng: 15828794\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:2(jpn): Audio<\/span><\/strong>: aac (LC), 44100 Hz, stereo, fltp\n    Metadata:\n      title           : <strong><span style=\"text-decoration: underline;\">Japanese<\/span><\/strong> Stereo\n      BPS             : 94767\n      BPS-eng         : 94767\n      DURATION        : 00:23:55.109000000\n      DURATION-eng    : 00:23:55.109000000\n      NUMBER_OF_FRAMES: 61805\n      NUMBER_OF_FRAMES-eng: 61805\n      NUMBER_OF_BYTES : 17000200\n      NUMBER_OF_BYTES-eng: 17000200\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:3(eng): Subtitle: ass<\/span><\/strong>\n    Metadata:\n      title           : <strong><span style=\"text-decoration: underline;\">English<\/span><\/strong>\n      BPS             : 119\n      BPS-eng         : 119\n      DURATION        : 00:23:41.950000000\n      DURATION-eng    : 00:23:41.950000000\n      NUMBER_OF_FRAMES: 335\n      NUMBER_OF_FRAMES-eng: 335\n      NUMBER_OF_BYTES : 21251\n      NUMBER_OF_BYTES-eng: 21251\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:4(ara): Subtitle: subrip<\/span><\/strong>\n    Metadata:\n      title           : <strong><span style=\"text-decoration: underline;\">Arabic<\/span><\/strong>\n      BPS             : 116\n      BPS-eng         : 116\n      DURATION        : 00:23:13.780000000\n      DURATION-eng    : 00:23:13.780000000\n      NUMBER_OF_FRAMES: 348\n      NUMBER_OF_FRAMES-eng: 348\n      NUMBER_OF_BYTES : 20250\n      NUMBER_OF_BYTES-eng: 20250\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES<\/code><\/pre>\n\n\n\n<p>In the above output, my video has 1 video,  2 audio, and 2 subtitle tracks.<\/p>\n\n\n\n<p>For transferring all such tracks, you need to use <code>-map<\/code> flag:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ffmpeg -i INPUT -map 0:a'?' -map 0:s'?' -map 0:v'?' OUTPUT.EXT<\/code><\/pre>\n\n\n\n<p>In the above command, <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>&#8216;a&#8217; in <code>-map 0:a:'?'<\/code> stands for audio; similarly &#8216;v&#8217; for video and &#8216;s&#8217; for subtitles.<\/li><li>Quoted question marks (<code>'?'<\/code> ) next to <code>-map 0:s<\/code> makes the subtitle mapping optional i.e. if the subtitle track does not exist in the INPUT, ignore this mapping. This is true for other quoted question marks as well.<\/li><\/ol>\n\n\n\n<p>Sample <strong>Output<\/strong> <strong> (I have removed unimportant information and boldened and underlined important information):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ ffmpeg -i sample.mkv -map 0:a'?' -map 0:s'?' -map 0:v'?' output.mkv            \n...\n...\n...\n<strong><span style=\"text-decoration: underline;\">Input #0, matroska,webm, from 'sample.mkv':<\/span><\/strong>\n  Metadata:\n    encoder         : libebml v1.3.3 + libmatroska v1.4.4\n    creation_time   : 2018-05-22T02:41:21.000000Z\n  Duration: 00:23:55.11, start: 0.000000, bitrate: 731 kb\/s\n  Stream #0:0: Video: hevc (Main), yuv420p(tv, bt709), 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)\n    Metadata:\n      BPS             : 543787\n      BPS-eng         : 543787\n      DURATION        : 00:23:55.017000000\n      DURATION-eng    : 00:23:55.017000000\n      NUMBER_OF_FRAMES: 34406\n      NUMBER_OF_FRAMES-eng: 34406\n      NUMBER_OF_BYTES : 97543101\n      NUMBER_OF_BYTES-eng: 97543101\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:1(eng): Audio<\/span><\/strong>: aac (LC), 44100 Hz, stereo, fltp (default)\n    Metadata:\n      title           : English Stereo\n      BPS             : 88552\n      BPS-eng         : 88552\n      DURATION        : 00:23:50.000000000\n      DURATION-eng    : 00:23:50.000000000\n      NUMBER_OF_FRAMES: 61585\n      NUMBER_OF_FRAMES-eng: 61585\n      NUMBER_OF_BYTES : 15828794\n      NUMBER_OF_BYTES-eng: 15828794\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <span style=\"text-decoration: underline;\"><strong>Stream #0:2(jpn): Audio<\/strong><\/span>: aac (LC), 44100 Hz, stereo, fltp\n    Metadata:\n      title           : Japanese Stereo\n      BPS             : 94767\n      BPS-eng         : 94767\n      DURATION        : 00:23:55.109000000\n      DURATION-eng    : 00:23:55.109000000\n      NUMBER_OF_FRAMES: 61805\n      NUMBER_OF_FRAMES-eng: 61805\n      NUMBER_OF_BYTES : 17000200\n      NUMBER_OF_BYTES-eng: 17000200\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:3(eng): Subtitle: ass<\/span><\/strong>\n    Metadata:\n      title           : English\n      BPS             : 119\n      BPS-eng         : 119\n      DURATION        : 00:23:41.950000000\n      DURATION-eng    : 00:23:41.950000000\n      NUMBER_OF_FRAMES: 335\n      NUMBER_OF_FRAMES-eng: 335\n      NUMBER_OF_BYTES : 21251\n      NUMBER_OF_BYTES-eng: 21251\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n  <strong><span style=\"text-decoration: underline;\">Stream #0:4(ara): Subtitle: subrip<\/span><\/strong>\n    Metadata:\n      title           : Arabic\n      BPS             : 116\n      BPS-eng         : 116\n      DURATION        : 00:23:13.780000000\n      DURATION-eng    : 00:23:13.780000000\n      NUMBER_OF_FRAMES: 348\n      NUMBER_OF_FRAMES-eng: 348\n      NUMBER_OF_BYTES : 20250\n      NUMBER_OF_BYTES-eng: 20250\n      _STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit\n      _STATISTICS_WRITING_DATE_UTC: 2018-05-22 02:41:21\n      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-22 02:41:21\n      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES\n<strong><span style=\"text-decoration: underline;\">Stream mapping:<\/span><\/strong>\n<strong><span style=\"text-decoration: underline;\">  Stream #0:1 -&gt; #0:0 (aac (native) -&gt; vorbis (libvorbis))\n  Stream #0:2 -&gt; #0:1 (aac (native) -&gt; vorbis (libvorbis))\n  Stream #0:3 -&gt; #0:2 (ass (ssa) -&gt; ass (ssa))\n  Stream #0:4 -&gt; #0:3 (subrip (srt) -&gt; ass (ssa))\n  Stream #0:0 -&gt; #0:4 (hevc (native) -&gt; h264 (libx264))<\/span><\/strong>\nPress &#91;q] to stop, &#91;?] for help\n...\n...\n...<\/code><\/pre>\n\n\n\n<p>All of the above-mentioned commands are to help you compress\/rescale a single video using FFmpeg. But what if you want to apply these commands on multiple files together i.e. batch video compression\/rescaling?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-compress-rescale-all-videos-in-a-directory-using-ffmpeg\">5. Compress\/Rescale All Videos in a Directory Using FFmpeg<\/h2>\n\n\n\n<p>For this, in Linux, you can use the<strong> <\/strong><code>find<\/code> command with its <code>-exec<\/code> flag or <code>for<\/code> loops. Personally, I find the <code>find<\/code> command more useful than <code>for<\/code> loops because it takes care of special characters such as single quotes and spaces in the input videos&#8217; file names. <\/p>\n\n\n\n<p>For <strong>example<\/strong>, to compress all mp4 videos in a <code>~\/test-dir<\/code> using the FFmpeg&#8217;s default settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ find ~\/test-dir -name '*.mp4' -exec ffmpeg -i {} {}_compressed.mp4 \\;\n<\/code><\/pre>\n\n\n\n<p>In the above command:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The output video files will be created in their respective directories.  For example, for an input video file <code>~\/test-dir\/dir2\/file.mp4<\/code>, output file <code>~\/test-dir\/dir2\/file.mp4_compressed.mp4<\/code> will be created.<\/li><li>For each found mp4 file, the find command replaces all the brackets (<code>{}<\/code>) with its filename and then executes the formed FFmpeg command. <\/li><li>Only mp4 files will be touched. The rest of the files in the <code>~\/test-dir<\/code> will be ignored.<\/li><\/ol>\n\n\n\n<p><strong>Fun Fact<\/strong> \ud83d\ude42: The given find command with the  <code>-exec<\/code> flag is quite versatile. You can use this to execute any command on a group of files. <\/p>\n\n\n\n<p>Many of the above-mentioned commands not only work for videos but also for images. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-compress-rescale-images-using-ffmpeg\">6. Compress\/Rescale Images using FFmpeg<\/h2>\n\n\n\n<p><strong>Images are nothing but videos with just one frame.<\/strong> This is the reason why most of the video commands are applicable here as well. <\/p>\n\n\n\n<p>For <strong>example<\/strong>,<strong> to compress an image to a lower resolution, say 360p<\/strong>, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT.jpg -filter:v scale=-2:360 OUTPUT.jpg       <\/code><\/pre>\n\n\n\n<p>The above command will reduce the file size, but the visual quality will also be reduced. To prevent such reduction, use the FFmpeg&#8217;s default settings i.e. no need to supply any flags:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~$ ffmpeg -i INPUT.jpg OUTPUT.jpg<\/code><\/pre>\n\n\n\n<p>You should try to play with all other video compression methods mentioned above and see which one works for you. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-way-ahead\">7. Way Ahead<\/h2>\n\n\n\n<p>As a going-away present, you should know that although I have mentioned<strong> compression and rescaling in separate headings, you can also use them together by using their flags side by side and thus get more file size reduction.<\/strong> The same goes for the mapping flag ( <code>-map<\/code>) and other flags also.<\/p>\n\n\n\n<p>That&#8217;s all. That was the short magic of FFmpeg. FFmpeg is a very versatile tool and you can use it as a screen recorder tool, screenshot tool, and media information tool as well. <\/p>\n\n\n\n<p>Thank you for staying so long. If there is any mistake\/question\/ recommendation\/appreciation, please comment below. It helps the community.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compress video or image using FFmpeg with\/without losing quality &#8211; use default or x265 encoder, get\/change resolution, keep the aspect ratio.<\/p>\n","protected":false},"author":2,"featured_media":1648,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[18,42],"class_list":["post-2075","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line-tools","tag-command-line-tools","tag-ffmpeg"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FFmpeg: Compress and Rescale Video and Image | SmartTech101<\/title>\n<meta name=\"description\" content=\"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FFmpeg: Compress and Rescale Video and Image | SmartTech101\" \/>\n<meta property=\"og:description\" content=\"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\" \/>\n<meta property=\"og:site_name\" content=\"SmartTech101\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-02T21:01:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-24T15:21:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ajay_yadav\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\"},\"author\":{\"name\":\"Ajay\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\"},\"headline\":\"FFmpeg: Compress and Rescale Video and Image\",\"datePublished\":\"2022-06-02T21:01:25+00:00\",\"dateModified\":\"2022-06-24T15:21:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\"},\"wordCount\":1589,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1\",\"keywords\":[\"Command Line Tools\",\"ffmpeg\"],\"articleSection\":[\"Command Line Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\",\"url\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\",\"name\":\"FFmpeg: Compress and Rescale Video and Image | SmartTech101\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1\",\"datePublished\":\"2022-06-02T21:01:25+00:00\",\"dateModified\":\"2022-06-24T15:21:10+00:00\",\"description\":\"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.\",\"breadcrumb\":{\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"Compress and Rescale Videos and Images using FFmpeg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smarttech101.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FFmpeg: Compress and Rescale Video and Image\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smarttech101.com\/#website\",\"url\":\"https:\/\/smarttech101.com\/\",\"name\":\"SmartTech101\",\"description\":\"Do Everything in Linux\",\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smarttech101.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\",\"name\":\"Ajay Yadav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"width\":180,\"height\":60,\"caption\":\"Ajay Yadav\"},\"logo\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\",\"name\":\"Ajay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"caption\":\"Ajay\"},\"sameAs\":[\"https:\/\/x.com\/ajay_yadav\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FFmpeg: Compress and Rescale Video and Image | SmartTech101","description":"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/","og_locale":"en_US","og_type":"article","og_title":"FFmpeg: Compress and Rescale Video and Image | SmartTech101","og_description":"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.","og_url":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/","og_site_name":"SmartTech101","article_published_time":"2022-06-02T21:01:25+00:00","article_modified_time":"2022-06-24T15:21:10+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png","type":"image\/png"}],"author":"Ajay","twitter_card":"summary_large_image","twitter_creator":"@ajay_yadav","twitter_misc":{"Written by":"Ajay","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#article","isPartOf":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/"},"author":{"name":"Ajay","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334"},"headline":"FFmpeg: Compress and Rescale Video and Image","datePublished":"2022-06-02T21:01:25+00:00","dateModified":"2022-06-24T15:21:10+00:00","mainEntityOfPage":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/"},"wordCount":1589,"commentCount":5,"publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"image":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1","keywords":["Command Line Tools","ffmpeg"],"articleSection":["Command Line Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/","url":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/","name":"FFmpeg: Compress and Rescale Video and Image | SmartTech101","isPartOf":{"@id":"https:\/\/smarttech101.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage"},"image":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1","datePublished":"2022-06-02T21:01:25+00:00","dateModified":"2022-06-24T15:21:10+00:00","description":"Compress video or image using FFmpeg with\/without losing quality - use default or x265 encoder, get\/change resolution, keep the aspect ratio.","breadcrumb":{"@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#primaryimage","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"Compress and Rescale Videos and Images using FFmpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/smarttech101.com\/ffmpeg-compress-rescale-video-and-image\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smarttech101.com\/"},{"@type":"ListItem","position":2,"name":"FFmpeg: Compress and Rescale Video and Image"}]},{"@type":"WebSite","@id":"https:\/\/smarttech101.com\/#website","url":"https:\/\/smarttech101.com\/","name":"SmartTech101","description":"Do Everything in Linux","publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smarttech101.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633","name":"Ajay Yadav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","width":180,"height":60,"caption":"Ajay Yadav"},"logo":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334","name":"Ajay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","caption":"Ajay"},"sameAs":["https:\/\/x.com\/ajay_yadav"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/01\/compress_rescale_video_images_using_ffmpeg.png?fit=1280%2C720&ssl=1","_links":{"self":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2075"}],"collection":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/comments?post=2075"}],"version-history":[{"count":3,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2075\/revisions"}],"predecessor-version":[{"id":2203,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2075\/revisions\/2203"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media\/1648"}],"wp:attachment":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media?parent=2075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/categories?post=2075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/tags?post=2075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}