IT/Software/Command Line Applications/ffmpeg: Difference between revisions

From msgwiki
Jump to navigation Jump to search
Access restrictions were established for this page. If you see this message, you have no access to this page.
No edit summary
Line 27: Line 27:


Try using this. It is the fastest and best ffmpeg-way I have figure it out:
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>
   <code>ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4</code>
'''This command trims your video in seconds!'''
'''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).
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.
'''-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.
'''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).
'''-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.
'''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>

Revision as of 04:47, 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)