6

Edit Videos with FFMPEG

 1 year ago
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.
neoserver,ios ssh client

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



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

Frequently Commands

Merge Videos



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

Split Videos



  1. [[email protected]]# ffmpeg -ss 00:00:00 -t 00:08:40 -i IMG_2266.MOV -acodec copy -vcodec copy game3.mp4
  2. [[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:



  1. [[email protected]]# ffmpeg -i filename.mp4 filename.mp3

Precise control:



  1. [[email protected]]# ffmpeg -i video.mp4 -b:a 192K -vn music.mp3
© 2012-2020 路人的技术 版权所有. Powered by LauZoo. Theme based on Nuo.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK