IT/Software/Command Line Applications/ffmpeg: Difference between revisions
Walttheboss (talk | contribs) |
Walttheboss (talk | contribs) |
||
Line 23: | Line 23: | ||
<code>ffmpeg -i '20150125 Word Blesses Us'.mp4 '20150125 Word Blesses Us'.mp3</code> | <code>ffmpeg -i '20150125 Word Blesses Us'.mp4 '20150125 Word Blesses Us'.mp3</code> | ||
== Trim based on start and end time. == | ==Trim based on start and end time.== | ||
Line 40: | Line 40: | ||
'''00:02:00:''' This is the time your trimmed video will end with. | '''00:02:00:''' This is the time your trimmed video will end with. | ||
'''-c copy:''' This is an option to trim via stream copy. (NB: Very fast)</blockquote> | '''-c copy:''' This is an option to trim via stream copy. (NB: Very fast)</blockquote>I highly recommend Lossless Cut from github. It is very nice and easy to use and cross platform. |
Revision as of 05:17, 2 June 2021
_
_
This tool is amazingly broad.
We will only attempt to show a few of its key features.
Reduce Video size and maintain some quality.
ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
crf should vary between 18 and 24. The higher the number the higher the compression and lower the quality
Convert a whole directory.
for i in *.avi; do ffmpeg -i "$i" "${i%.*}.mp4"; done
You can add your parameters there like crf and -vcodec
Extract audio from video
- Change extension and names as needed.
- Path is relative unless noted.
- Single quotes are needed if you have spaces or any special character
ffmpeg -i '20150125 Word Blesses Us'.mp4 '20150125 Word Blesses Us'.mp3
Trim based on start and end time.
Try using this. It is the fastest and best ffmpeg-way I have figure it out:
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4
This command trims your video in seconds!
Explanation of the command:
-i: This specifies the input file. In that case, it is (input.mp4).
-ss: Used with -i, this seeks(seek start) in the input file (input.mp4) to position.
00:01:00: This is the time your trimmed video will start with.
-to: This specifies(time out) duration from start (00:01:40) to end (00:02:12).
00:02:00: This is the time your trimmed video will end with.
-c copy: This is an option to trim via stream copy. (NB: Very fast)
I highly recommend Lossless Cut from github. It is very nice and easy to use and cross platform.