ffmpeg视频切片
Isolating a specified portion of a video is a very common task for those who work within the media, probably using nice GUI tools to slice clips from the full video. I'm a developer, however, and know how amazing ffmpeg is so I prefer to do my basic video slicing from command line.
对于从事媒体工作的人来说,隔离视频的指定部分是一项非常常见的任务,可能使用不错的GUI工具从完整视频中切出片段。 但是,我是一名开发人员,并且知道ffmpeg有多么出色,所以我更喜欢从命令行进行基本视频切片。
Let's look at the following command and break it down:
让我们看一下下面的命令并将其分解:
# Creates 12 second video./ffmpeg -i input.mp4 -ss 00:00:05 -c copy -t 12 sliced-output.mp4
The -i
obviously represents the input file, the ss
represents the time to start the slicing at, and the -t
represents the number of seconds from the ss
to include within the slice. I'm seeing result quality vary when it comes to -c copy;
most times the quality is better with it, but on some rare occasions the quality is better without it.
-i
显然表示输入文件, ss
表示开始切片的时间, -t
表示从ss
开始包括在切片中的秒数。 我看到-c copy;
结果质量有所不同-c copy;
在大多数情况下,使用它可以改善质量,但是在极少数情况下,不使用它可以改善质量。
If you prefer to explicitly cite the hour:minute:second
mark which to cut to, use the -to
option:
如果您希望明确引用要切入的hour:minute:second
标记,请使用-to
选项:
# Creates 2 second video./ffmpeg -i input.mp4 -ss 00:00:05 -c copy -to 00:00:07 sliced-output.mp4
User interfaces and apps are awesome when doing work manually but aren't always great to automate. Since ffmpeg is a command line utility, automating almost anything with video is reasonably easy if you take the time to learn the tool!
手动工作时,用户界面和应用程序很棒,但是自动化并不总是那么好。 由于ffmpeg是一个命令行实用程序,因此如果您花时间学习该工具,则几乎可以轻松地自动执行视频操作!
翻译自:
ffmpeg视频切片