IT/Software/Command Line Applications/ffmpeg: Difference between revisions
Walttheboss (talk | contribs) No edit summary |
Walttheboss (talk | contribs) No edit summary |
||
Line 22: | Line 22: | ||
<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. == | |||
Try using this. It is the fastest and best ffmpeg-way I have figure it out: | |||
<code>ffmpeg -ss 00:01:00 -i input.mp4 -to 00:02:00 -c copy output.mp4</code> | |||
'''This command trims your video in seconds!''' | |||
Explanation of the command:<blockquote>'''-i:''' This specifies the input file. In that case, it is (input.mp4). | |||
'''-ss:''' Used with -i, this seeks in the input file (input.mp4) to position. | |||
'''00:01:00:''' This is the time your trimmed video will start with. | |||
'''-to:''' This specifies 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)</blockquote> |
Revision as of 04:28, 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 -ss 00:01:00 -i input.mp4 -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 in the input file (input.mp4) to position.
00:01:00: This is the time your trimmed video will start with.
-to: This specifies 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)