Terminal | Splitting Video Files, Extracting Audio and Converting Files


in this post we will learn how to split, convert video/audio files and also extract audio from video files and finally we will learn how to convert video/audio files all this we will do from terminal

1- Splitting video/audio files

- split a video file

ffmpeg -i input.mp4 -ss 00:05:10 -to 00:10:00 -c copy output.mp4

- split a audio file

ffmpeg -i input.mp3 -ss 00:05:10 -to 00:10:00 -c copy output.mp3

2- Convert video/audio file types

- converting video file type

ffmpeg -i input.mp4 -c:v copy -c:a copy output.m4v

ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v gif output.gif

- converting audio file type

ffmpeg -i input.mp3 -c:a aac -b:a 256k output.aac

ffmpeg -i input.aac -c:a libmp3lame -q:a 2 output.mp3

3- Extract audio from video file

ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3