{"id":36203,"date":"2024-10-25T07:00:00","date_gmt":"2024-10-25T14:00:00","guid":{"rendered":"https:\/\/cloudinary.com\/blog\/?p=36203"},"modified":"2025-03-30T14:16:02","modified_gmt":"2025-03-30T21:16:02","slug":"how-to-optimize-video-next-js","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js","title":{"rendered":"How to Optimize Video in Next.js With Cloudinary"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>Users worldwide have varying internet speeds, data caps, and other restrictions, making it difficult to stream heavy content like videos. To ensure a smooth experience, videos must be compressed and optimized to load quickly without sacrificing quality.<\/p>\n<p>In this blog post, I\u2019ll show you how to create a custom video player in <a href=\"https:\/\/nextjs.org\/\">Next.js<\/a> while leveraging <a href=\"https:\/\/cloudinary.com\/\">Cloudinary<\/a> for video optimization and delivery. We\u2019ll use Cloudinary to ensure that videos are served in a format that suits the user\u2019s device, reducing load times and improving performance. By the end, you\u2019ll have a fully functional and optimized video player integrated into your Next.js app with minimal effort.<\/p>\n<h2>Set up the Project<\/h2>\n<p>To get started, I used the command <code>npx create-next-app@latest<\/code> and followed the prompts.<\/p>\n<p>Once the project was ready, I added the next-cloudinary package by running:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">npm install next-cloudinary\n<\/code><\/span><\/pre>\n<p>After that, I set the <code>NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME<\/code> environment variable in my <code>.env.local<\/code> file so Cloudinary could adequately handle the image hosting.<\/p>\n<h2>Create the Custom Video Player Component<\/h2>\n<p>To optimize video delivery in our Next.js app, I created a custom video player component using next-cloudinary. This allows us to use Cloudinary\u2019s optimization features while keeping the implementation simple.<\/p>\n<p>Here\u2019s the code for the custom <code>VideoPlayer<\/code> component:<\/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\"><span class=\"hljs-string\">\"use client\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> { CldVideoPlayer, CldVideoPlayerProps } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"next-cloudinary\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"next-cloudinary\/dist\/cld-video-player.css\"<\/span>;\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">VideoPlayer<\/span>(<span class=\"hljs-params\">options: {\n  src: string;\n  width: string | number;\n  height: string | number;\n  variant?: <span class=\"hljs-string\">\"primary\"<\/span> | <span class=\"hljs-string\">\"background\"<\/span>;\n  className?: string;\n}<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">const<\/span> { src, width, height, variant = <span class=\"hljs-string\">\"primary\"<\/span>, className = <span class=\"hljs-string\">\"\"<\/span> } = options;\n\n  <span class=\"hljs-comment\">\/\/ See https:\/\/cloudinary.com\/glossary\/video-autoplay<\/span>\n  <span class=\"hljs-keyword\">let<\/span> specialOptions: Partial&lt;CldVideoPlayerProps&gt; = {};\n  <span class=\"hljs-keyword\">if<\/span> (variant === <span class=\"hljs-string\">\"background\"<\/span>) {\n    specialOptions = {\n      <span class=\"hljs-attr\">autoplay<\/span>: <span class=\"hljs-literal\">true<\/span>,\n      <span class=\"hljs-attr\">muted<\/span>: <span class=\"hljs-literal\">true<\/span>,\n      <span class=\"hljs-attr\">loop<\/span>: <span class=\"hljs-literal\">true<\/span>,\n      <span class=\"hljs-attr\">controls<\/span>: <span class=\"hljs-literal\">false<\/span>,\n    };\n  }\n\n  <span class=\"hljs-keyword\">return<\/span> (\n    <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">CldVideoPlayer<\/span>\n      <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{src}<\/span>\n      <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">{width}<\/span>\n      <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">{height}<\/span>\n      <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{<\/span>`${<span class=\"hljs-attr\">className<\/span>} ${\n        <span class=\"hljs-attr\">variant<\/span> === <span class=\"hljs-string\">\"background\"<\/span> ? \"<span class=\"hljs-attr\">cursor-default<\/span>\" <span class=\"hljs-attr\">:<\/span> \"\"\n      }`}\n      <span class=\"hljs-attr\">transformation<\/span>=<span class=\"hljs-string\">{{<\/span>\n        <span class=\"hljs-attr\">fetch_format:<\/span> \"<span class=\"hljs-attr\">auto<\/span>\",\n        <span class=\"hljs-attr\">quality:<\/span> <span class=\"hljs-attr\">variant<\/span> === <span class=\"hljs-string\">\"primary\"<\/span> ? \"<span class=\"hljs-attr\">auto:good<\/span>\" <span class=\"hljs-attr\">:<\/span> \"<span class=\"hljs-attr\">auto:low<\/span>\",\n        <span class=\"hljs-attr\">crop:<\/span> \"<span class=\"hljs-attr\">fill<\/span>\",\n      }}\n      {<span class=\"hljs-attr\">...specialOptions<\/span>}\n    \/&gt;<\/span><\/span>\n  );\n}\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>This component utilizes Cloudinary\u2019s <code>CldVideoPlayer<\/code> to handle video optimization automatically. The <code>VideoPlayer<\/code> component accepts several props:<\/p>\n<ul>\n<li>\n<strong><code>src<\/code>.<\/strong> The source of the video, which should be the public ID of your video on Cloudinary.<\/li>\n<li>\n<strong><code>width<\/code> and <code>height<\/code>.<\/strong> Define the dimensions of the video player.<\/li>\n<li>\n<strong><code>variant<\/code>.<\/strong> This optional prop lets you choose between two styles: <code>&quot;primary&quot;<\/code> (for regular video playback) and <code>&quot;background&quot;<\/code> (for auto-playing background videos without controls).<\/li>\n<li>\n<strong><code>className<\/code>.<\/strong> Additional classes for custom styling.<\/li>\n<\/ul>\n<p>The <code>variant<\/code> prop is especially useful, allowing us to switch between different optimization options. For example, when the video is used as a background, the component automatically applies lower-quality settings and removes controls to save resources. For a primary video, it serves well using Cloudinary\u2019s <code>auto<\/code> format and <code>quality<\/code> options for the best user experience.<\/p>\n<p>Cloudinary provides excellent control and performance when using the <code>auto<\/code> format and quality options, as it automatically adjusts the video for optimal delivery based on the user\u2019s device and connection speed. This is a simple but effective way to ensure videos load quickly without compromising quality.<\/p>\n<p>However, I highly recommend checking out <a href=\"https:\/\/cloudinary.com\/documentation\/video_optimization\">Cloudinary\u2019s video optimization documentation<\/a> for more advanced performance optimization strategies. Depending on your specific use case, you can apply many tips and techniques, such as choosing different formats, adjusting bitrates, or using adaptive bitrate streaming.<\/p>\n<h2>Render Your Video Component<\/h2>\n<p>Now that we have the custom video player component let\u2019s put it to use on the home page. Here\u2019s a simple example where I use the video player in \u201cprimary\u201d mode to showcase a video from Cloudinary:<\/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\"><span class=\"hljs-keyword\">import<\/span> VideoPlayer <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@\/components\/video-player\/VideoPlayer.client\"<\/span>;\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">Home<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-keyword\">return<\/span> (\n    <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"flex items-center justify-center h-screen w-full\"<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"w-1\/2\"<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">VideoPlayer<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"samples\/sea-turtle\"<\/span> <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">{1920}<\/span> <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">{1080}<\/span> \/&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n  );\n}\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>In this example, the video is displayed in the center of the screen in \u201cprimary\u201d mode, using the <code>VideoPlayer<\/code> component with a 1920&#215;1080 resolution. The video is served in an optimized format, ensuring good performance across devices. Here\u2019s a preview of the result:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1729812491\/Web_Assets\/blog\/video_player_example_primary_mode\/video_player_example_primary_mode-gif?_i=AA\" alt=\"video player example in primary mode\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"800\" height=\"450\"\/><\/p>\n<h3>Render the Video With `variant=\u201cbackground\u2019\u201d<\/h3>\n<p>Next, we can switch the player to \u201cbackground\u201d mode by passing the <code>variant=&quot;background&quot;<\/code> prop. This makes the video autoplay in the background without controls, perfect for use cases where you want a looping, muted background video:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" 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\">VideoPlayer<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"samples\/sea-turtle\"<\/span> <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">{1920}<\/span> <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">{1080}<\/span> <span class=\"hljs-attr\">variant<\/span>=<span class=\"hljs-string\">\"background\"<\/span> \/&gt;<\/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\">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>Here\u2019s a preview of how it looks:<\/p>\n<p><img width=\"800\" height=\"450\" data-public-id=\"Web_Assets\/blog\/video_player_example_background_mode\/video_player_example_background_mode.gif\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_800,h_450,c_scale\/f_auto,q_auto\/v1729812495\/Web_Assets\/blog\/video_player_example_background_mode\/video_player_example_background_mode.gif?_i=AA\" alt=\"video player example in background mode\" loading=\"lazy\" class=\"c-transformed-asset wp-image-36204\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1729812495\" data-seo=\"1\" \/><\/p>\n<p>By using different modes, you can quickly adapt the video player to fit your specific needs, whether showcasing video content or enhancing the user experience with a background video.<\/p>\n<h2>Conclusion<\/h2>\n<p>Combining Next.js and Cloudinary allows you to easily create a custom video player that serves videos in the most efficient format and quality, adapting to different use cases like primary content or background visuals.<\/p>\n<p>For more in-depth tips and strategies on video optimization for the web, I highly recommend checking out this other post on the Cloudinary Blog: <a href=\"https:\/\/cloudinary.com\/blog\/optimize-video-web-using-cloudinary\">Optimize Video for the Web Using Cloudinary<\/a>. It\u2019s an excellent resource for learning about advanced techniques to help you take your video performance even further. And to try Cloudinary, <a href=\"https:\/\/cloudinary.com\/users\/register_free\">sign up for a free account<\/a> today.<\/p>\n<p>Thanks for following along, and I hope this post helps you optimize video content in your Next.js applications!<\/p>\n<p>If you found this blog post helpful and want to discuss it in more detail, head over to the <a href=\"https:\/\/community.cloudinary.com\/\">Cloudinary Community forum<\/a> and its associated <a href=\"https:\/\/community.cloudinary.com\/\">Discord<\/a>.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":87,"featured_media":36207,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[212,227,303],"class_list":["post-36203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-next-js","tag-performance-optimization","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 Optimize Video in Next.js With Cloudinary<\/title>\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-optimize-video-next-js\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Optimize Video in Next.js With Cloudinary\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-25T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-30T21:16:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"melindapham\" \/>\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-optimize-video-next-js#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\"},\"author\":{\"name\":\"melindapham\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\"},\"headline\":\"How to Optimize Video in Next.js With Cloudinary\",\"datePublished\":\"2024-10-25T14:00:00+00:00\",\"dateModified\":\"2025-03-30T21:16:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\"},\"wordCount\":9,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA\",\"keywords\":[\"Next.js\",\"Performance Optimization\",\"Video\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2024\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\",\"url\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\",\"name\":\"How to Optimize Video in Next.js With Cloudinary\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA\",\"datePublished\":\"2024-10-25T14:00:00+00:00\",\"dateModified\":\"2025-03-30T21:16:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Optimize Video in Next.js With Cloudinary\"}]},{\"@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\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\",\"name\":\"melindapham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"caption\":\"melindapham\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Optimize Video in Next.js With Cloudinary","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-optimize-video-next-js","og_locale":"en_US","og_type":"article","og_title":"How to Optimize Video in Next.js With Cloudinary","og_url":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js","og_site_name":"Cloudinary Blog","article_published_time":"2024-10-25T14:00:00+00:00","article_modified_time":"2025-03-30T21:16:02+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog-jpg?_i=AA","type":"image\/jpeg"}],"author":"melindapham","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js"},"author":{"name":"melindapham","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9"},"headline":"How to Optimize Video in Next.js With Cloudinary","datePublished":"2024-10-25T14:00:00+00:00","dateModified":"2025-03-30T21:16:02+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js"},"wordCount":9,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA","keywords":["Next.js","Performance Optimization","Video"],"inLanguage":"en-US","copyrightYear":"2024","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js","url":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js","name":"How to Optimize Video in Next.js With Cloudinary","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA","datePublished":"2024-10-25T14:00:00+00:00","dateModified":"2025-03-30T21:16:02+00:00","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/how-to-optimize-video-next-js#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Optimize Video in Next.js With Cloudinary"}]},{"@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":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9","name":"melindapham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","caption":"melindapham"}}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1729271583\/video_nextjs_optimize-blog\/video_nextjs_optimize-blog.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36203","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\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=36203"}],"version-history":[{"count":2,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36203\/revisions"}],"predecessor-version":[{"id":37333,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36203\/revisions\/37333"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/36207"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=36203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=36203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=36203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}