{"id":36402,"date":"2024-12-04T07:00:00","date_gmt":"2024-12-04T15:00:00","guid":{"rendered":"https:\/\/cloudinary.com\/blog\/?p=36402"},"modified":"2024-12-05T11:11:35","modified_gmt":"2024-12-05T19:11:35","slug":"clip-videos-social-media-next-js","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js","title":{"rendered":"Clip Long-Form Videos to Social Media Platforms in Next.js"},"content":{"rendered":"\n<p>Video dominates social media feeds, and the demand keeps on growing. Between 2022 and 2023, a<a target=\"_blank\" href=\"https:\/\/www.socialinsider.io\/blog\/instagram-benchmarks\/#reelsgrowth\" rel=\"noreferrer noopener\"> survey<\/a> from SocialInsider revealed <a target=\"_blank\" href=\"https:\/\/quickframe.com\/blog\/instagram-reels-guide-for-marketers\/\" rel=\"noreferrer noopener\">Instagram Reels<\/a> had a year-over-year growth rate of 57.4%. From <a target=\"_blank\" href=\"https:\/\/quickframe.com\/blog\/15-best-video-marketing-content-ideas-for-your-next-promotion\/\" rel=\"noreferrer noopener\">user-generated content<\/a><a target=\"_blank\" href=\"https:\/\/quickframe.com\/blog\/15-best-video-marketing-content-ideas-for-your-next-promotion\/\" rel=\"noreferrer noopener\"> <\/a><a target=\"_blank\" href=\"https:\/\/quickframe.com\/blog\/15-best-video-marketing-content-ideas-for-your-next-promotion\/\" rel=\"noreferrer noopener\">(UGC)<\/a> to paid ads, our social media feeds are full of video content.&nbsp;<\/p>\n\n\n\n<p>Turn your long-form videos into digestible clips that fit the format requirements of these platforms with Next.js and Cloudinary. This blog post will teach you how to build a video snipping tool with Next.js, using Cloudinary&#8217;s trim and resize features to easily customize your videos.<\/p>\n\n\n\n<p>Before we start, you should have a basic understanding of TypeScript or JavaScript and a <a target=\"_blank\" href=\"https:\/\/cloudinary.com\/users\/register_free\" rel=\"noreferrer noopener\">free <\/a><a target=\"_blank\" href=\"https:\/\/cloudinary.com\/users\/register_free\" rel=\"noreferrer noopener\">Cloudinary account<\/a>. You can also find the complete code implementation in this <a target=\"_blank\" href=\"https:\/\/github.com\/folucode\/video-snipping-tool\" rel=\"noreferrer noopener\">GitHub repository<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set Up the Next.js App<\/h2>\n\n\n\n<p>To set up the Next.js project, clone the <a target=\"_blank\" href=\"https:\/\/github.com\/folucode\/video-snipping-tool-starter\" rel=\"noreferrer noopener\">starter project<\/a>. This starter project contains the styles for the app so you can focus on building the core functionality. Clone the repo using the command below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" 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\">code<\/span>&gt;<\/span>git clone https:\/\/github.com\/folucode\/video-snipping-tool-starter.git\u00a0<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">code<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><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\n\n<p>Next, install the Cloudinary packages in the project directory using the command below. The <code>@cloudinary\/react<\/code> package provides React components that make it easy to work directly with Cloudinary&#8217;s media features in your React or NextJS project. In contrast, the <code>@cloudinary\/url-gen<\/code> package allows you to dynamically generate URLs for images and videos with transformations using Cloudinary&#8217;s API.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" 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\">code<\/span>&gt;<\/span>npm install @cloudinary\/react @cloudinary\/url-gen<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">code<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><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\n\n<p>Then, run <code>npm run dev<\/code> to render a development server at <a href=\"https:\/\/localhost:3000\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/localhost:3000\/<\/a> in your browser.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set Up Environment Variables<\/h2>\n\n\n\n<p>In the project\u2019s root directory, add a new file, .env.local, and paste the code below in that file. This file will contain your Cloudinary cloud name. Your cloud name is what you will use to access your Cloudinary account programatically.<\/p>\n\n\n<pre class=\"wp-block-code\" 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\">code<\/span>&gt;<\/span>NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">CLOUDINARY_CLOUD_NAME<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">code<\/span>&gt;<\/span><\/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\n\n<p>To get your cloud name, navigate to the <a href=\"https:\/\/console.cloudinary.com\/pm\/c-44312a85dae383cdb3fedab809bc64\/developer-dashboard\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudinary developer dashboard<\/a>. You should see it under the <strong>Product Environment Credentials <\/strong>section, as shown in the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1024\" height=\"207\" data-public-id=\"Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_207,c_scale\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA\" alt=\"\" class=\"wp-post-36402 wp-image-36403\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1733425747\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 2880w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 1536w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733425747\/Web_Assets\/blog\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1\/blog-Clip-Long-Form-Videos-to-Social-Media-Platforms-in-NextJS-1.png?_i=AA 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Cloudinary developer dashboard<\/figcaption><\/figure>\n\n\n\n<p>After adding your cloud name to the <code>.env.local<\/code> file, in the following section you will build the core functionality of the app.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Build the App Functionality<\/h2>\n\n\n\n<p>Before you proceed, you need to upload a video to your Cloudinary account. Check here to learn how to <a target=\"_blank\" href=\"https:\/\/cloudinary.com\/documentation\/media_library_upload_tutorial\" rel=\"noreferrer noopener\">upload a video to Cloudinary<\/a>.<\/p>\n\n\n\n<p>Next, in the <code>page.tsx<\/code> file, you must first set up the Cloudinary instance object and the video you want to transform. To do this, create a Cloudinary object using the public environment variable for the <code>cloudName<\/code>. This object will allow you to perform the transformations and load the video.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/ src\/page.tsx<\/span>\n\n<span class=\"hljs-comment\">\/\/ ...<\/span>\n\n<span class=\"hljs-keyword\">import<\/span> { Cloudinary } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/url-gen'<\/span>;\n\n<span class=\"hljs-keyword\">const<\/span> cloudName = process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;\n\n<span class=\"hljs-keyword\">const<\/span> cloudinary: Cloudinary = <span class=\"hljs-keyword\">new<\/span> Cloudinary({\n\n\u00a0 <span class=\"hljs-attr\">cloud<\/span>: {\n\n\u00a0 \u00a0 cloudName,\n\n\u00a0 },\n\n});\n\n<span class=\"hljs-keyword\">const<\/span> videoId: string = <span class=\"hljs-string\">'video-public-id'<\/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\n<span class=\"hljs-comment\">\/\/ ...<\/span>\n\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><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\n\n<p>The <code>videoId<\/code> in the code above is the relative path to the video on your Cloudinary account without the file extension. For this <a href=\"https:\/\/res.cloudinary.com\/demo\/video\/upload\/h_190,w_270,c_fill\/e_reverse\/e_progressbar:bar:green\/q_auto\/docs\/walking_talking.webm\" target=\"_blank\" rel=\"noreferrer noopener\">example video<\/a>, the <code>videoId<\/code> will be <code>docs\/walking_talking<\/code>.<\/p>\n\n\n\n<p>In the next section, you&#8217;ll set up the form inputs and corresponding state variables to capture user input for the start time, end time, and aspect ratio. This will allow you to control which section of the video to edit and specify the video\u2019s format for different platforms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting Up Form Inputs and State Management<\/h2>\n\n\n\n<p>To set up the form and state variables, &nbsp;you can use React&#8217;s useState hook to dynamically manage and update these values as you interact with the form. See the code snippet below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/ src\/page.tsx<\/span>\n\n<span class=\"hljs-comment\">\/\/ ...<\/span>\n\n<span class=\"hljs-keyword\">import<\/span> { useState } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'react'<\/span>;\n\n...\n\nexport <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\n<span class=\"hljs-keyword\">const<\/span> &#91;startTime, setStartTime] = useState(<span class=\"hljs-number\">0<\/span>);\n\n<span class=\"hljs-keyword\">const<\/span> &#91;endTime, setEndTime] = useState(<span class=\"hljs-number\">0<\/span>);\n\n<span class=\"hljs-keyword\">const<\/span> &#91;aspectRatio, setAspectRatio] = useState(<span class=\"hljs-string\">''<\/span>);\n\n<span class=\"hljs-comment\">\/\/ Add form inputs for start time, end time, and aspect ratio<\/span>\n\n<span class=\"hljs-keyword\">return<\/span> (\n\n\u00a0 <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.main}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Video Snipping Tool<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.grid}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">label<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Start Time (seconds):\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.input}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">'number'<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">{startTime}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">onChange<\/span>=<span class=\"hljs-string\">{(e)<\/span> =&gt;<\/span> setStartTime(Number(e.target.value))}\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/&gt;\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">label<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">label<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 End Time (seconds):\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.input}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">'number'<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">{endTime}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">onChange<\/span>=<span class=\"hljs-string\">{(e)<\/span> =&gt;<\/span> setEndTime(Number(e.target.value))}\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/&gt;\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">label<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">label<\/span>&gt;<\/span>Platform: <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">label<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">select<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">{aspectRatio}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.input}<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-attr\">onChange<\/span>=<span class=\"hljs-string\">{(e)<\/span> =&gt;<\/span> setAspectRatio(e.target.value)}\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &gt;\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">option<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">'9:16'<\/span>&gt;<\/span>Instagram Reels<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">option<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">option<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">'1:1'<\/span>&gt;<\/span>Instagram Feed<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">option<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">option<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">'16:9'<\/span>&gt;<\/span>YouTube Standard<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">option<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">select<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><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\n\n<p>In the code block above, you set up state variables to capture user input for the start time, end time, and aspect ratio. Then, you created form inputs to allow users to modify these values dynamically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementing Video Transformation and Preview<\/h2>\n\n\n\n<p>Finally, to implement the functionality to transform the video and display a preview, transformations, such as resizing and trimming, must be applied based on the start time, end time, and aspect ratio values provided.&nbsp;<\/p>\n\n\n\n<p>Once the transformations are applied, you can use <a href=\"https:\/\/cloudinary.com\/documentation\/react_integration\">Cloudinary&#8217;s advanced video component<\/a> to render a preview of the transformed video, allowing users to see the changes on the fly.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/ src\/page.tsx<\/span>\n\n...\n\nimport { fill } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/url-gen\/actions\/resize'<\/span>;\n\n<span class=\"hljs-keyword\">import<\/span> { trim } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/url-gen\/actions\/videoEdit'<\/span>;\n\n<span class=\"hljs-keyword\">import<\/span> { AdvancedVideo } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/react'<\/span>;\n\n...\n\nexport <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\n...\n\nconst &#91;transformedVideo, setTransformedVideo] = useState(\n\n\u00a0 \u00a0 <span class=\"hljs-keyword\">new<\/span> CloudinaryVideo(videoId, { cloudName })\n\n\u00a0 );\n\n<span class=\"hljs-comment\">\/\/ Function to transform the video<\/span>\n\n<span class=\"hljs-keyword\">const<\/span> getTransformedVideo = (): <span class=\"hljs-function\"><span class=\"hljs-params\">void<\/span> =&gt;<\/span> {\n\n\u00a0 <span class=\"hljs-keyword\">if<\/span> (endTime &lt;= startTime) {\n\n\u00a0 \u00a0 \u00a0 alert(<span class=\"hljs-string\">'End time must be greater than start time.'<\/span>);\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-keyword\">return<\/span>;\n\n\u00a0 \u00a0 }\n\n\u00a0 \u00a0 <span class=\"hljs-keyword\">const<\/span> adjustedStartTime = <span class=\"hljs-built_in\">Math<\/span>.max(<span class=\"hljs-number\">0<\/span>, startTime);\n\n\u00a0 \u00a0 <span class=\"hljs-keyword\">const<\/span> adjustedEndTime = endTime + <span class=\"hljs-number\">1<\/span>;\n\n\u00a0 \u00a0 <span class=\"hljs-keyword\">const<\/span> videoTransformation = cloudinary\n\n\u00a0 \u00a0 \u00a0 .video(videoId)\n\n\u00a0 \u00a0 \u00a0 .resize(fill().aspectRatio(aspectRatio).gravity(<span class=\"hljs-string\">'center'<\/span>))\n\n\u00a0 \u00a0 \u00a0 .videoEdit(\n\n\u00a0 \u00a0 \u00a0 \u00a0 trim().startOffset(adjustedStartTime).endOffset(adjustedEndTime)\n\n\u00a0 \u00a0 \u00a0 );\n\n\u00a0 \u00a0 setTransformedVideo(videoTransformation);\n\n};\n\n\u00a0 <span class=\"hljs-keyword\">return<\/span> (\n\n\u00a0 \u00a0 <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.main}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Video Snipping Tool<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.grid}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 {\/* Form inputs for video transformation (startTime, endTime, aspectRatio) *\/}\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.button}<\/span> <span class=\"hljs-attr\">onClick<\/span>=<span class=\"hljs-string\">{getTransformedVideo}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 Transform\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.videoContainer}<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h3<\/span>&gt;<\/span>Preview:<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h3<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {transformedVideo &amp;&amp; (\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">AdvancedVideo<\/span> <span class=\"hljs-attr\">cldVid<\/span>=<span class=\"hljs-string\">{transformedVideo}<\/span> <span class=\"hljs-attr\">controls<\/span> \/&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 )}\n\n\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n\u00a0 \u00a0 <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n\n\u00a0 );\n\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\n\n<p>In this code block, you set up a function to apply video transformations based on your defined start time, end time, and aspect ratio. The start and end times are adjusted to ensure that the selected video segment provides a smoother playback experience. The adjusted start time is set to a minimum of zero. In contrast, the adjusted end time is extended by one second to include additional footage beyond the selected endpoint. This approach results in a more polished final video.<\/p>\n\n\n\n<p>The transformation process involves applying resizing and trimming actions using the <a target=\"_blank\" href=\"https:\/\/cloudinary.com\/documentation\/react_integration\" rel=\"noreferrer noopener\">Cloudinary SDK<\/a>. Here\u2019s a breakdown:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong><code>cloudinary.video(videoId)<\/code>.<\/strong> This initiates a video transformation using Cloudinary. The <code>videoId<\/code> is the unique identifier of the video in Cloudinary\u2019s storage, and <code>.video(videoId)<\/code> prepares it for transformations.<\/li>\n\n\n\n<li><code><strong>.resize(fill().aspectRatio(aspectRatio).gravity('center'))<\/strong>.<\/code> This resizes the video:\n<ul class=\"wp-block-list\">\n<li><code><strong>fill()<\/strong>.<\/code>` This resizing mode scales the video to fill the specified dimensions, cropping it as needed to ensure it completely fills the frame.<\/li>\n\n\n\n<li><code><strong>.aspectRatio(aspectRatio)<\/strong>.<\/code> Sets the aspect ratio, which could be something like 16:9 or 1:1. It ensures the video dimensions maintain this ratio.<\/li>\n\n\n\n<li><code><strong>.gravity('center')<\/strong>.<\/code> Ensures that any cropping happens centrally, so the main part of the video stays in the frame.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><code><strong>.videoEdit(trim().startOffset(adjustedStartTime).endOffset(adjustedEndTime))<\/strong>.<\/code> This trims the video:\n<ul class=\"wp-block-list\">\n<li><code><strong>trim()<\/strong>.<\/code> Starts the trimming process, allowing you to specify start and end times.<\/li>\n\n\n\n<li><code><strong>.startOffset(adjustedStartTime)<\/strong>.<\/code> Sets the start time for the trim (in seconds).<\/li>\n\n\n\n<li><code><strong>.endOffset(adjustedEndTime)<\/strong>.<\/code> Sets the end time for the trim.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>After the transformation process, the preview initially shows the video without any transformation applied, allowing you to see the original content before applying your edits. After the transformations are applied, the <code>transformedVideo<\/code> state variable is updated, and the preview reflects the changes, enabling you to review your edits in real time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Final Result<\/h2>\n\n\n\n<p>To see these steps in action, <a href=\"https:\/\/www.loom.com\/share\/05dfb30cfa624b84a0e434ebb051336f?sid=484c67e6-3965-43a0-bd35-a8ddb630ed33\">watch this demo<\/a> showing the automatic transformation of a video hosted on Cloudinary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this blog post, you learned how to implement a video snipping tool using Cloudinary. This tool allows you to resize and trim videos based on user-defined parameters. You can enhance this application by adding features such as the ability for users to <a target=\"_blank\" href=\"https:\/\/cloudinary.com\/blog\/upload-video-to-cloudinary-next-js-app-router\" rel=\"noreferrer noopener\">upload their videos directly<\/a>, implementing validation for user inputs to ensure better usability, or integrating additional transformation options like filters and effects. <a target=\"_blank\" href=\"https:\/\/cloudinary.com\/users\/register_free\" rel=\"noreferrer noopener\">Contact us today<\/a> to learn more about how Cloudinary can help improve your app&#8217;s user experience.<\/p>\n\n\n\n<p>If you found this blog post helpful and want to discuss it more, join the <a target=\"_blank\" href=\"https:\/\/community.cloudinary.com\/\" rel=\"noreferrer noopener\"><u>Cloudinary Community forum<\/u><\/a> and its associated <a target=\"_blank\" href=\"https:\/\/discord.com\/invite\/cloudinary\" rel=\"noreferrer noopener\"><u>Discord<\/u><\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/cloudinary.com\/documentation\/programmable_media_overview\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudinary Overall Media Documentation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/nextjs.org\/docs\" target=\"_blank\" rel=\"noreferrer noopener\">Next.js Documentation<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Video dominates social media feeds, and the demand keeps on growing. Between 2022 and 2023, a survey from SocialInsider revealed Instagram Reels had a year-over-year growth rate of 57.4%. From user-generated content (UGC) to paid ads, our social media feeds are full of video content.&nbsp; Turn your long-form videos into digestible clips that fit the [&hellip;]<\/p>\n","protected":false},"author":87,"featured_media":36404,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[212,305],"class_list":["post-36402","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-next-js","tag-video-api"],"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>Clip Long-Form Videos to Social Media Platforms in Next.js<\/title>\n<meta name=\"description\" content=\"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.\" \/>\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\/clip-videos-social-media-next-js\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clip Long-Form Videos to Social Media Platforms in Next.js\" \/>\n<meta property=\"og:description\" content=\"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-04T15:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-05T19:11:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS-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\/clip-videos-social-media-next-js#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\"},\"author\":{\"name\":\"melindapham\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\"},\"headline\":\"Clip Long-Form Videos to Social Media Platforms in Next.js\",\"datePublished\":\"2024-12-04T15:00:00+00:00\",\"dateModified\":\"2024-12-05T19:11:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\"},\"wordCount\":1040,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA\",\"keywords\":[\"Next.js\",\"Video API\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2024\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\",\"url\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\",\"name\":\"Clip Long-Form Videos to Social Media Platforms in Next.js\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA\",\"datePublished\":\"2024-12-04T15:00:00+00:00\",\"dateModified\":\"2024-12-05T19:11:35+00:00\",\"description\":\"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clip Long-Form Videos to Social Media Platforms in Next.js\"}]},{\"@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":"Clip Long-Form Videos to Social Media Platforms in Next.js","description":"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.","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\/clip-videos-social-media-next-js","og_locale":"en_US","og_type":"article","og_title":"Clip Long-Form Videos to Social Media Platforms in Next.js","og_description":"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.","og_url":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js","og_site_name":"Cloudinary Blog","article_published_time":"2024-12-04T15:00:00+00:00","article_modified_time":"2024-12-05T19:11:35+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS-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\/clip-videos-social-media-next-js#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js"},"author":{"name":"melindapham","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9"},"headline":"Clip Long-Form Videos to Social Media Platforms in Next.js","datePublished":"2024-12-04T15:00:00+00:00","dateModified":"2024-12-05T19:11:35+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js"},"wordCount":1040,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA","keywords":["Next.js","Video API"],"inLanguage":"en-US","copyrightYear":"2024","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js","url":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js","name":"Clip Long-Form Videos to Social Media Platforms in Next.js","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA","datePublished":"2024-12-04T15:00:00+00:00","dateModified":"2024-12-05T19:11:35+00:00","description":"Clip long videos into social-ready clips with Next.js and Cloudinary. Resize, trim, and transform video content for platforms like TikTok and Instagram.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/clip-videos-social-media-next-js#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Clip Long-Form Videos to Social Media Platforms in Next.js"}]},{"@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\/v1733182233\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS\/Clip_Long-Form_Videos_to_Social_Content_in_NextJS.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36402","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=36402"}],"version-history":[{"count":1,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36402\/revisions"}],"predecessor-version":[{"id":36405,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/36402\/revisions\/36405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/36404"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=36402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=36402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=36402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}