Summary

Often when watching or processing video, I have small, simple needs, such as intercepting a certain period of the video, or splitting a video into multiple videos according to the number of matches, because this need is so simple, it is not cost-effective to install a video processing software. So I tried to learn how to use it to process a simple video, and this article summarises the commands I used.

Install

  1. [root@liqiang.io]# yum install epel-release
  2. [root@liqiang.io]# rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
  3. [root@liqiang.io]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  4. [root@liqiang.io]# yum install -y ffmpeg ffmpeg-devel

Frequently Commands

Merge Videos

  1. [root@liqiang.io]# cat filelist.txt
  2. file '1.mp4'
  3. file '2.mp4'
  4. file '3.mp4'
  5. file '4.mp4'
  6. [root@liqiang.io]# ffmpeg -f concat -i filelist.txt -c copy final.mp4

Split Videos

  1. [root@liqiang.io]# ffmpeg -ss 00:00:00 -t 00:08:40 -i IMG_2266.MOV -acodec copy -vcodec copy game3.mp4
  2. [root@liqiang.io]# ffmpeg -ss 00:09:20 -t 00:18:00 -i IMG_2266.MOV -acodec copy -vcodec copy game4.mp4

Convert MP4 to Mp3

Simplify method:

  1. [root@liqiang.io]# ffmpeg -i filename.mp4 filename.mp3

Precise control:

  1. [root@liqiang.io]# ffmpeg -i video.mp4 -b:a 192K -vn music.mp3

Ref