Back to project managment
ffmpeg
FFmpeg is a free and open-source software project consisting of a large suite of libraries and programs for handling video, audio, and other multimedia files and streams. it is cross-platform solution to record, convert and stream audio and video designed for command-line -based processing of video and audio files.
Download FFmpeg
what makes ffmpeg the best choice is
- free and open source
- working in cross platform
- work in command line
you can download ffmpeg from [here]{https://ffmpeg.org/download.html)
There is a lot of choice , I will use the one with gpl licence The one with capital are the build that are taken straight off the github source and build from there, the one with n and followed by 4.3 or something like that are the official releases that have been built and packaged up,
After you click it and download the zip folder
unzip and add to path
after downloading ffmpeg unzip the folder and save it in a reachable location such as c:/user/
now lets add it to our system path to make it recognize where its located to make it reachable from command line
unzip and add to path
to add ffmpeg to windows path follow these steps
- open control panel then navigate to system
- then click advance system setting
- then from the top bar click advance and open environment variable
- from the system variable open path, and add new then the location of ffmpeg folder that you saved on
ffmpeg in command line
to awake ffmpeg from the comand line just type ffmpeg
ffmpeg -i
Using ffmpeg requires that you open a command prompt window, then type ffmpeg specific commands. Here is a typical ffmpeg command: And for video we can use ffmpeg to call ffmpeg in the command line to use it with videos The first command functuin here is
Ffmpeg –i
ffmpeg - This command tells cmd that we want to run ffmpeg commands. cmd will first look for ffmpeg.exe in one of the folders from step 6 in the Installation section. If it is found, it will attempt to run the command.
-i video.mp4 - This is an input file. We are going to be doing work on this file.
Example
ffmpeg -i video.mp4 -vn -ar 44100 -ac 1 -b:a 32k -f mp3 audio.mp3
This command has four parts:
ffmpeg -
This command tells cmd that we want to run ffmpeg commands. cmd will first look for ffmpeg.exe in one of the folders from step 6 in the Installation section. If it is found, it will attempt to run the command.
-i video.mp4 -
This is an input file. We are going to be doing work on this file.
-vn -ar 44100 -ac 1 -b:a 32k -f mp3 - These are the “arguments”.
These characters are like mini commands that specify exactly what we want to do. In this case, it is saying create an mp3 file from the input source.
- -vn - Leave out the video stream
- -ar 44100 - Specifies audio resolution in hertz.
- -ac 1 - Audio channels, only 1. This is effectively “make mono”.
- -b:a 32k - Audio bitrate, set to 32 kbps.
- -f mp3 - Force to MP3 conversion. Without this command, ffmpeg attempts to interpret what you want based on the extension you use in the output file name.
audio.mp3- This is the output file.
Metadata:
Meta data give information about the creation of the file
duration, stream ,
And also you can know the duration of it and bitrate Video h264 is the video codec The size is 1900*1004 The frame rate is 10 fps The size 4327 kb/s,
resize video
ffmpeg -i “media.mp4” -vf scale=1280x720 vedio-resized01.mp4
-vf means adding video filter then when need to specify what is the filter and here we used the scale filter to resize the video And then we name the output file “vedio-resized01.mp4”
The video resized from 4.95Mb to 167 KB
Now I try to skip 5second from the video file and the compress using -ss
The Right Dimensions
YouTube allows you to upload videos of various sizes, ranging from 240p to 2160p (4K). Let’s try to understand the dimensions for each of these sizes.
- 240p: 426x240 pixels
- 360p: 640x360 pixels
- 480p: 854x480 pixels
- 720p: 1280x720 pixels
- 1080p: 1920x1080 pixels
- 1440p: 2560x1440 pixels
- 2160p: 3840x2160 pixels
References
How To: Download+Install FFMPEG on Windows 10 byTroubleChute
Fab Web Basics / Day 05 / Image and Video Optimization