<!-- begin _includes/seo.html --><title>Using ffmpeg for Simple Video Editing - Şahin Akkaya’s Personal Page</title>
<metaname="description"content="Story Today, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds where I misspelled some words and started again. I had to remove that part from the video before uploading it. Since I was low on time, I thought that I better use a GUI program to do this job. I opened up Kdenlive and jumped into editing my video. It was my first time using it so I spent some time to cut and delete the parts that I want to get rid of. When I was ready, I clicked Render button to render my video. It was waaay too slow than I expected. Since I have nothing to do while waiting for render to finish, I thought I could give ffmpeg a shot.">
<metaproperty="og:description"content="Story Today, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds where I misspelled some words and started again. I had to remove that part from the video before uploading it. Since I was low on time, I thought that I better use a GUI program to do this job. I opened up Kdenlive and jumped into editing my video. It was my first time using it so I spent some time to cut and delete the parts that I want to get rid of. When I was ready, I clicked Render button to render my video. It was waaay too slow than I expected. Since I have nothing to do while waiting for render to finish, I thought I could give ffmpeg a shot.">
<!-- insert favicons. use https://realfavicongenerator.net/ -->
<!-- end custom head snippets -->
</head>
<bodyclass="layout--single">
<navclass="skip-links">
<ul>
<li><ahref="#site-nav"class="screen-reader-shortcut">Skip to primary navigation</a></li>
<li><ahref="#main"class="screen-reader-shortcut">Skip to content</a></li>
<li><ahref="#footer"class="screen-reader-shortcut">Skip to footer</a></li>
</ul>
</nav>
<!--[if lt IE 9]>
<divclass="notice--danger align-center"style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <ahref="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
<metaitemprop="headline"content="Using ffmpeg for Simple Video Editing">
<metaitemprop="description"content="StoryToday, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds where I misspelled some words and started again. I had to remove that part from the video before uploading it. Since I was low on time, I thought that I better use a GUI program to do this job. I opened up Kdenlive and jumped into editing my video. It was my first time using it so I spent some time to cut and delete the parts that I want to get rid of. When I was ready, I clicked Render button to render my video. It was waaay too slow than I expected. Since I have nothing to do while waiting for render to finish, I thought I could give ffmpeg a shot.">
<p>Today, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds where I misspelled some words and started again. I had to remove that part from the video before uploading it. Since I was low on time, I thought that I better use a GUI program to do this job. I opened up <ahref="https://kdenlive.org/en/">Kdenlive</a> and jumped into editing my video. It was my first time using it so I spent some time to cut and delete the parts that I want to get rid of. When I was ready, I clicked Render button to render my video. It was waaay too slow than I expected. Since I have nothing to do while waiting for render to finish, I thought I could give <codeclass="language-plaintext highlighter-rouge">ffmpeg</code> a shot.</p>
<h2id="let-the-show-begin">Let the show begin</h2>
<p>Like Kdenlive, I have never used <codeclass="language-plaintext highlighter-rouge">ffmpeg</code> before. Like every normal Linux user do, I opened up a terminal and typed <codeclass="language-plaintext highlighter-rouge">man ffmpeg</code> to learn how to use it… Just kidding :D I opened a browser and typed <em>“ffmpeg cut video by time”</em>. Not the best search query, but it was good enough to find what I am looking for as the <ahref="https://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg">first result</a>.</p>
<h3id="cutting-the-videos-based-on-start-and-end-time">Cutting the videos based on start and end time</h3>
<p>According to answers on the page I mentioned, I run the following commands to cut my video into two parts:</p>
<divclass="language-bash highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>ffmpeg <spanclass="nt">-ss</span> 00:00:00 <spanclass="nt">-to</span> 00:01:55 <spanclass="nt">-i</span> input.mov <spanclass="nt">-c</span> copy part1.mp4 <spanclass="c"># take from 00:00 to 01:55</span>
ffmpeg <spanclass="nt">-ss</span> 00:02:03 <spanclass="nt">-to</span> 00:05:17 <spanclass="nt">-i</span> input.mov <spanclass="nt">-c</span> copy part2.mp4 <spanclass="c"># take from 02:03 to 05:17</span>
</code></pre></div></div>
<p>These two commands run <strong>instantly</strong>! Kdenlive was still rendering… The progress was 46%. Meh… I said “Duck it, I am gonna use ffmpeg only” and cancelled the rendering.</p>
<h3id="concatenating-the-video-files">Concatenating the video files</h3>
<p>Now we have two videos that we want to join. Guess what will be our next search query? <em>“ffmpeg join videos”</em>. And <ahref="https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg">here</a> is the first result:</p>
<p>And we are DONE! How easy was that? Whole process took about 10 minutes including my search on the internet. If I continued waiting for Kdenlive to finish rendering, I would probably be still waiting at that time. I love the power of command line!</p>
<pclass="archive__item-excerpt"itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
In my previous post, I explained how to do port forwarding to access some machine behind private network. I will use this method to fix some issues in ...</p>