{"id":21883,"date":"2019-05-13T15:24:24","date_gmt":"2019-05-13T15:24:24","guid":{"rendered":"http:\/\/how_to_automate_compression_of_video_files_with_one_line_of_code"},"modified":"2025-02-09T13:33:47","modified_gmt":"2025-02-09T21:33:47","slug":"how_to_automate_compression_of_video_files_with_one_line_of_code","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code","title":{"rendered":"How to Compress Video Size Automatically With One Line of Code"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>As technologies advance apace, the volume of online <a href=\"https:\/\/cloudinary.com\/video_api\">videos<\/a> continues to increase fast. Instagram, WhatsApp, Facebook, YouTube, TikTok are just a few platforms among many that massively share and distribute videos around the clock.<\/p>\n<p>In addition to cloud-based video compression solutions like Cloudinary, local video compression methods using libraries such as <code>react-native-ffmpeg<\/code> have also emerged, especially for React Native developers. This allows for compression right on the user\u2019s device before the upload process.<\/p>\n<p>When compared to other media files, such as those for audios and images, video files are larger, consuming a lion\u2019s share of data bandwidth. Compressing video files enables faster downloads, uploads, and streaming online.<\/p>\n<p>For people in remote areas and developing regions, where download and upload speeds usually range between 720 kb and 1.5 Mb per second, compressing video files is not optional\u2014it\u2019s mandatory! To do that and deliver videos of a smaller file size to users with Cloudinary, you as developers can choose either of these two ways:<\/p>\n<ul>\n<li>Compression as part of the upload request<\/li>\n<li>On-the-fly <a href=\"https:\/\/cloudinary.com\/glossary\/inter-frame-compression\">compression<\/a> during delivery<\/li>\n<\/ul>\n<div class='c-callout  c-callout--note'><strong class='c-callout__title'> Update<\/strong> <p>On October 29th, 2019 Cloudinary released the new auto-quality setting for content-aware video compression. By using the <code>q_auto<\/code> parameter, Cloudinary intelligently encodes video using the most optimized settings, for the best trade-off between file size and quality. <a href=\"https:\/\/cloudinary.com\/blog\/new_auto_quality_setting_for_content_aware_video_compression\">Read more<\/a>.<\/p><\/div>\n<p>However, if you\u2019re working in a React Native environment and wish to compress videos on the client side before even uploading, you can use the <code>react-native-ffmpeg<\/code> library. This enables you to directly compress videos using <a href=\"https:\/\/cloudinary.com\/guides\/video-formats\/ffmpeg-features-use-cases-and-pros-cons-you-should-know\">FFmpeg<\/a> commands right within your React Native app. The benefit is that you can have more granular control over compression settings and also reduce upload times since the video is already compressed before being sent to the server.<\/p>\n<p>This is part of a series of articles about <a href=\"https:\/\/cloudinary.com\/guides\/web-performance\/video-optimization-why-you-need-it-and-5-critical-best-practices\">video optimization<\/a>.<\/p>\n<h2>Compression As Part of the Upload Request<\/h2>\n<p>This technique involves applying compression transformation to the videos during upload before storage. <a href=\"https:\/\/cloudinary.com\/video_api\">Cloudinary<\/a> makes the process a walk in the park with just one line of code in Ruby, Python, or PHP:<\/p>\n<p><em>Ruby<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">Cloudinary::Uploader.upload(<span class=\"hljs-string\">\"cool_video.mp4\"<\/span>, :<span class=\"hljs-function\"><span class=\"hljs-params\">resource_type<\/span> =&gt;<\/span> :video, :<span class=\"hljs-function\"><span class=\"hljs-params\">quality<\/span> =&gt;<\/span> <span class=\"hljs-number\">60<\/span>)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>Python<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">cloudinary.uploader.upload(<span class=\"hljs-string\">\"cool_video.mp4\"<\/span>, resource_type = <span class=\"hljs-string\">\"video\"<\/span>, <span class=\"hljs-string\">\"quality\"<\/span> = <span class=\"hljs-string\">\"60\"<\/span>)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>PHP<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">\\Cloudinary\\Uploader::upload(<span class=\"hljs-string\">\"my_video.mp4\"<\/span>, &#91; <span class=\"hljs-string\">\"resource_type\"<\/span> =&gt; <span class=\"hljs-string\">\"video\"<\/span>, <span class=\"hljs-string\">\"quality\"<\/span> =&gt; <span class=\"hljs-string\">\"60\"<\/span>]);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the code above, you specify the <code>quality<\/code> parameter to manipulate the video\u2019s  quality and size before Cloudinary stores the video in the cloud.<\/p>\n<div class='c-callout  c-callout--inline-title c-callout--note'><strong class='c-callout__title'>Note:<\/strong> <p>If you\u2019re not sure what number to assign to the <code>quality<\/code> parameter, just type <strong><code>auto<\/code><\/strong>. Cloudinary then automatically adjusts the compression quality for your video by applying the optimal balance between the video\u2019s file size and quality.<\/p><\/div>\n<h2>On-the-Fly Compression During Delivery<\/h2>\n<p>With this Cloudinary technique, you upload videos straight to the cloud and then apply the <code>quality<\/code> compression parameter when delivering them to users. You can also serve videos in the <a href=\"https:\/\/cloudinary.com\/documentation\/video_manipulation_and_delivery#supported_video_formats\">formats that pertain to the various web browsers and mobile devices<\/a>.<\/p>\n<p>You configure quality on a <strong>0-100<\/strong> scale. The higher the video quality, the larger the video size; the lower the video quality, the smaller the video size. To compress video size on the fly, adjust their <code>quality<\/code> parameter in a codeline. See the examples below.<\/p>\n<p><em>Node.js<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">cloudinary<\/span><span class=\"hljs-selector-class\">.video<\/span>(\"<span class=\"hljs-selector-tag\">dog<\/span>\", {<span class=\"hljs-attribute\">quality<\/span>: <span class=\"hljs-number\">50<\/span>})\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>Java<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">cloudinary<\/span><span class=\"hljs-selector-class\">.url<\/span>()<span class=\"hljs-selector-class\">.transformation<\/span>(<span class=\"hljs-selector-tag\">new<\/span> <span class=\"hljs-selector-tag\">Transformation<\/span>()<span class=\"hljs-selector-class\">.quality<\/span>(50))<span class=\"hljs-selector-class\">.videoTag<\/span>(\"<span class=\"hljs-selector-tag\">dog<\/span>\");\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>Python<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">CloudinaryVideo(<span class=\"hljs-string\">\"dog\"<\/span>).video(quality=<span class=\"hljs-number\">50<\/span>)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>On-the-fly video compression through the URL<\/em><\/p>\n<pre class=\"js-syntax-highlighted\"><code>https:\/\/res.cloudinary.com\/demo\/video\/upload\/q_50\/dog.mp4\n<\/code><\/pre>\n<p>In <strong><code>q_50<\/code><\/strong> in the above URL, <strong><code>q<\/code><\/strong> stands for quality; <strong><code>50<\/code><\/strong> is the number of your choice on a 0-100 scale.\nFront-end developers, you can drop those components in your app out of the box, like this:\n<em>React.js<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Video<\/span> <span class=\"hljs-attr\">publicId<\/span>=<span class=\"hljs-string\">\"dog\"<\/span> &gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Transformation<\/span> <span class=\"hljs-attr\">quality<\/span>=<span class=\"hljs-string\">\"50\"<\/span> \/&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">Video<\/span>&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>Vue.js<\/em><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">cld-video<\/span> <span class=\"hljs-attr\">publicId<\/span>=<span class=\"hljs-string\">\"dog\"<\/span> &gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">cld-transformation<\/span> <span class=\"hljs-attr\">quality<\/span>=<span class=\"hljs-string\">\"50\"<\/span> \/&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">cld-video<\/span>&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em>dog<\/em> represents the name of the uploaded video, which is usually the public ID (<code>publicId<\/code>) on the Cloudinary storage.<\/p>\n<p>For React and React Native developers, choosing and integrating local video compression methods can be crucial. Using React\u2019s state management tools, you can create a UI component that lets users select videos from their device, compress them locally, and then initiate the upload process. This ensures faster uploads and better user experience. Handling potential compression errors with a <code>try-catch<\/code> mechanism ensures a more resilient app and a smoother user experience.<\/p>\n<h2>Conclusion<\/h2>\n<p>Compress video size automatically with Cloudinary making media much more accessible. Furthermore, Cloudinary\u2019s drop-in tools and services are effective, simple, and intuitive, saving you ample time to focus on your project.<\/p>\n<p>For details, check out the following Cloudinary documentation:<\/p>\n<ul>\n<li>A complete <a href=\"https:\/\/cloudinary.com\/documentation\/video_manipulation_and_delivery#quality_control\">reference<\/a> on video manipulation and transformation with Cloudinary.<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/cloudinary_sdks\">SDKs and libraries: server side, client side, and mobile<\/a>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>Further Reading on Video Manipulation<\/h2>\n<ul>\n<li>\n<a href=\"https:\/\/cloudinary.com\/video_api\">Video Transcoding\nand Manipulation<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/top_10_mistakes_in_handling_website_videos_and_how_to_solve_them\">Top 10 Mistakes in Handling Website Videos and How to Solve Them<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/exoplayer_android_tutorial_easy_video_delivery_and_editing\">ExoPlayer Android Tutorial: Easy Video Delivery and Editing<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/html5_video_player\">Ultimate HTML5 Video Player Showdown: 10 Players Compared<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/how_to_generate_waveform_images_from_audio_files\">How to Generate Waveform Images From Audio Files<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/with_automatic_video_subtitles_silence_speaks_volumes\">Auto Generate Subtitles Based on Video Transcript<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/auto_generate_video_previews_with_great_results_every_time\">Auto-Generate Video Previews with Great Results Every Time<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/html5_video_tags_won_t_do_for_your_videos\">Adaptive HLS Streaming Using the HTML5 Video Tag<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/optimizing_video_with_cloudinary_and_the_html5_video_player_part_1\">Video Optimization With the HTML5 &lt;\\video&gt; Player<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/converting_android_videos_to_animated_gif_images_with_cloudinary_a_tutorial\">Converting Android Videos to Animated GIF Images With Cloudinary: A Tutorial<\/a>\n<\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":21884,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[25,263,303],"class_list":["post-21883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asset-management","tag-sdk","tag-video"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Compress Video Size Automatically With One Line of Code<\/title>\n<meta name=\"description\" content=\"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Compress Video Size Automatically With One Line of Code\" \/>\n<meta property=\"og:description\" content=\"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-13T15:24:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-09T21:33:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"1540\" \/>\n\t<meta property=\"og:image:height\" content=\"847\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"How to Compress Video Size Automatically With One Line of Code\",\"datePublished\":\"2019-05-13T15:24:24+00:00\",\"dateModified\":\"2025-02-09T21:33:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\"},\"wordCount\":11,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA\",\"keywords\":[\"Asset Management\",\"SDK\",\"Video\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2019\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\",\"url\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\",\"name\":\"How to Compress Video Size Automatically With One Line of Code\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA\",\"datePublished\":\"2019-05-13T15:24:24+00:00\",\"dateModified\":\"2025-02-09T21:33:47+00:00\",\"description\":\"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA\",\"width\":1540,\"height\":847},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Compress Video Size Automatically With One Line of Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Compress Video Size Automatically With One Line of Code","description":"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.","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:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code","og_locale":"en_US","og_type":"article","og_title":"How to Compress Video Size Automatically With One Line of Code","og_description":"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.","og_url":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code","og_site_name":"Cloudinary Blog","article_published_time":"2019-05-13T15:24:24+00:00","article_modified_time":"2025-02-09T21:33:47+00:00","og_image":[{"width":1540,"height":847,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code"},"author":{"name":"","@id":""},"headline":"How to Compress Video Size Automatically With One Line of Code","datePublished":"2019-05-13T15:24:24+00:00","dateModified":"2025-02-09T21:33:47+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code"},"wordCount":11,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA","keywords":["Asset Management","SDK","Video"],"inLanguage":"en-US","copyrightYear":"2019","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code","url":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code","name":"How to Compress Video Size Automatically With One Line of Code","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA","datePublished":"2019-05-13T15:24:24+00:00","dateModified":"2025-02-09T21:33:47+00:00","description":"Learn how to compress video size automatically with Cloudinary, to enable faster downloads, uploads, and streaming online.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA","width":1540,"height":847},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/how_to_automate_compression_of_video_files_with_one_line_of_code#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Compress Video Size Automatically With One Line of Code"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649721247\/Web_Assets\/blog\/Compress-Video-Automatically-v1-2000x1100-1\/Compress-Video-Automatically-v1-2000x1100-1.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=21883"}],"version-history":[{"count":11,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21883\/revisions"}],"predecessor-version":[{"id":36783,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21883\/revisions\/36783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/21884"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=21883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=21883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=21883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}