```
`-ss 00:00:01`表示从视频的第1秒开始截取,`-t 00:00:09`则是截取9秒的视频。
当你需要检查视频是否正常播放时,可以使用`ffplay output.mp4`命令,而如果你想要获取视频或音频的信息,`ffprobe output.mp4`则是你的好帮手。
FFmpeg就是这样一个简单易用的工具,它不仅能帮你告别视频模糊和卡顿,还能让你在视频处理的道路上越走越远。所以,亲爱的小伙伴们,不要再为视频处理的问题烦恼了,赶紧试试FFmpeg,让它成为你视频剪辑的好伙伴吧!
Hey, friends who are engaged in self-media or video editing. Haven't we all had these frustrating moments? After painstakingly compressing a video, the picture turns out to be as blurry as a mosaic, completely ruining the beauty. When hearing a wonderful background music, we itch to use it as the BGM of our own works or set it as a personalized ringtone, but we just can't find a way to extract it. And when we want to quickly clip a video segment, after using software to operate, what we get is a "defective product" with horrible picture quality. Don't worry. Today, I'm going to introduce you to a super powerful tool - FFmpeg, which will surely make these problems disappear!
FFmpeg, a name that sounds very technical, is actually much more approachable than you think. It's like an invisible video expert, ready to help you solve those seemingly complex problems at any time. And installing FFmpeg is as simple as it gets. If you're a Mac user and have Homebrew installed, you can easily get FFmpeg by typing a command in the terminal. Or Github to install it manually. If you're more accustomed to Windows, just download the installation package from FFmpeg's official website and add it to your environment variables, and you're good to go. FFmpeg supports multiple platforms, so whether you're a Mac, Windows, or Linux user, you can easily master it. Its help command is ‘ffmpeg -h’.
Now, let's unveil the mystery of FFmpeg and see how it uses three simple commands to solve the problems of video compression, audio extraction, and video trimming.
First, let's look at the command for compressing videos. Have you ever encountered the problem of video files being too large and wanting to compress them but worrying about the loss of picture quality? This FFmpeg command can help you compress while maintaining picture quality:
```
ffmpeg -i input.mp4 -c:v libx264 -r 25 -crf 21 -c:a aac output.mp4
```
Here, `-c:v libx264` specifies the video encoder as H264, `-r 25` sets the frame rate to 25, and `-crf 21` sets the bitrate, the smaller the value, the higher the quality. `-c:a aac` specifies the audio encoding as AAC. Yes, compression means resetting the audio format, video format, frame rate and bit rate.
Next, if you hear a piece of background music you like and want to extract it as a ringtone or notification sound, FFmpeg can easily help you achieve this:
```
ffmpeg -i input.mp4 -c:v libx264 -crf 21 -an output-v.mp4 -c:a aac -vn output-a.mp4
```
Here, `-an` is used to remove the audio, and `-vn` is to remove the video, allowing you to extract only the audio file(output-a.mp4).
Finally, if you need to trim a part of a video, FFmpeg can also help you do this while avoiding the blurriness caused by re-encoding:
```
ffmpeg -i input.mp4 -ss 00:00:01 -t 00:00:09 -c:v libx264 -crf 21 -c:a aac output.mp4
```
`-ss 00:00:01` means to start trimming from the 1st second of the video, and `-t 00:00:09` is to trim a 9-second video.
When you need to check if the video plays correctly, you can use the `ffplay output.mp4` command, and if you want to get information about the video or audio, `ffprobe output.mp4` is your good helper.
FFmpeg is such a simple and easy-to-use tool that not only helps you bid farewell to blurry and choppy videos but also allows you to go further on the road of video processing. So, dear friends, don't worry about video processing problems anymore, try FFmpeg, and let it become your good partner in video editing!