下面命令从mp4文件中提取出MP3音频:
ffmpeg -i yourvideo.mp4 -vn -ab 128k outputaudio.mp3
-vn用来提取声音,-ab指定存储为128Kbps mp3格式,可以指定256K或其他码率。
Cutting small sections
To extract only a small segment in the middle of a movie, it can be used in combination with -t which specifies the duration, like -ss 60 -t 10 to capture from second 60 to 70. Or you can use the -to option to specify an out point, like -ss 60 -to 70 to capture from second 60 to 70. -t and -to are mutually exclusive. If you use both, -t will be used.
Note that if you specify -ss before -i only, the timestamps will be reset to zero, so -t and -to have not the same effect. If you want to keep the original timestamps, add the -copytsoption.
The first command will cut from 00:01:00 to 00:03:00 (in the original), using the faster seek.
The second command will cut from 00:01:00 to 00:02:00, as intended, using the slower seek.
The third command will cut from 00:01:00 to 00:02:00, as intended, using the faster seek.
ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy cut.mp4 ffmpeg -i video.mp4 -ss 00:01:00 -to 00:02:00 -c copy cut.mp4 ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy -copyts cut.mp4If you cut with stream copy (-c copy) you need to use the -avoid_negative_ts 1 option if you want to use that segment with the concat demuxer .
Example:
ffmpeg -ss 00:03:00 -i video.mp4 -t 60 -c copy -avoid_negative_ts 1 cut.mp4
没有评论:
发表评论