Cutting video file using ffmpeg command in Ubuntu server 16.04
Article Id :51 / 21/03/18 Uploader name: Jomon Oonnittan
In this article I like to explain how we can cut a video by using ffmpeg command in Ubuntu server 16 . 04 LT. Before that I like to ex plane how we can install ffmpeg server in Ubuntu. For that, first we have to connect our Ubuntu server with ssh client putty. After that we have to run the command below.
The below command is using to add the repositories to the server.
sudo add-apt-repository ppa:jonathonf/ffmpeg-3
sudo add-apt-repository ppa:jonathonf/tesseract
Now we have to install ffmpeg by running the below command.
sudo apt-get update
sudo apt-get install ffmpeg libav-tools x264 x265
now we can check the status of the installation by run the command
Then we can see the version of ffmpeg installed. Now the installation part of the ffmpeg is completed and we can go for to learn how we can cut the video files by using ffmpeg command.
First we have to load our video file in the working directory of the server. To find the working directory of the server we can run the command
Then it will out put the working directory like home/myname
Now we have to load our video file in that directory, and also consider the filename of the video is cut1.mp4 for this tutorial. Now we can run the bellow command for cutting a portion of the video file we loaded.
ffmpeg -i cut1.mp4 -ss 00:05:00 -t 00:04:25 -async 1 cut2.mp4
Please note that the time mention after -ss operator will be the starting time of the new video from the loaded video. And also note that the time mention after -t operator is the duration of the new video. for example the above command will cut a portion of video from the cut1.mp4 from the time 00 hour,05Minute, and 00sec for a duration of 04 Minute and 25 sec and put it in a new file called cut2.mp4. On otherwise it will cut from 00:05:00 to 00:09:25.
Please also note if any error says about sricts2 then just use the bellow command instead of the above command
ffmpeg -i cut1.mp4 -ss 00:05:00 -t 00:04:25 -async 1 -strict -2 cut2.mp4
we can also simply change the output file format by changing the extension of the output file. For example instead of cut2.mp4 we can use cut2.vob.
******* END OF THE ARTICLE *******