

Edit Videos with FFMPEG
source link: https://en.liqiang.io/post/edit-videos-with-ffmpeg-command-0a7aeb53?lang=US_EN
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

All Posts
Edit Videos with FFMPEG
@SOLUTION· 2023-05-07 15:44 · 15 min read
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
[[email protected]]# yum install epel-release
[[email protected]]# rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
[[email protected]]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
[[email protected]]# yum install -y ffmpeg ffmpeg-devel
Frequently Commands
Merge Videos
[[email protected]]# cat filelist.txt
file '1.mp4'
file '2.mp4'
file '3.mp4'
file '4.mp4'
[[email protected]]# ffmpeg -f concat -i filelist.txt -c copy final.mp4
Split Videos
[[email protected]]# ffmpeg -ss 00:00:00 -t 00:08:40 -i IMG_2266.MOV -acodec copy -vcodec copy game3.mp4
[[email protected]]# ffmpeg -ss 00:09:20 -t 00:18:00 -i IMG_2266.MOV -acodec copy -vcodec copy game4.mp4
-t
的意思是时长,例如第二句的意思就是从视频的 09:20 分开始,截取一段时长为 18:00 的视频,所以这里实际山视频在原视频的时间段为09:20 ~ 27:20
Convert MP4 to Mp3
Simplify method:
[[email protected]]# ffmpeg -i filename.mp4 filename.mp3
Precise control:
[[email protected]]# ffmpeg -i video.mp4 -b:a 192K -vn music.mp3
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK