quinta-feira, 30 de outubro de 2014

A Guide To Video And Audio Conversion Using FFmpeg

FFmpeg is a unequivocally absolute and good command line apparatus used for behaving several acclimatisation operations on audio and video files. The good thing about this apparatus is that it is positively giveaway to use. It is accessible for Windows, Linux and Mac handling systems.


Not everybody knows how to use it yet and for that purpose, I’ve come adult with this beam on how to use FFmpeg for Windows OS. From a unequivocally initial step of downloading a module to gathering an audio file, this educational aims to assistance we cover a basics, so that we can play around some-more after on.



Downloading FFmpeg for Windows


To download a tool, click here to go to a webpage. Once you’ve finished that locate a download option, as shown below. The download choice highlighted in green is for 32-bit Windows OS while a other choice in red is for 64-bit Windows OS.



To verify if your OS is 32-bit or 64-bit, click on a Start idol on a left side of your desktop afterwards form Run in hunt bar and in run write a authority of dxdiag and press a Enter key.


Under a streamer of ‘System Information’, we can simply find a name of a OS and a chronicle being used (32-bit or 64-bit).


Extracting a Files


Once we have downloaded FFmpeg, you’ll have to extract a files from a .zip folder. For this purpose, we should have a zip extractor installed. You can download a giveaway zip extractor called 7-zip from here.



After extracting a files, name all of a files, emanate a folder in C expostulate named FFmpegTool and pulp all a files in this folder as shown below. It is critical to note that we should keep a folder name and expostulate a same to equivocate any problems in executing commands to perform conversions.



Starting FFmpeg


Go to Run, form cmd and press a Enter key. A authority line window will seem as shown here.



Type cd and press a Enter key. It should seem as below.



Now form cd FFmpegTool, this authority will concede we to enter into a FFmpegTool folder that we have combined progressing (be clever with a spelling as any spelling mistake in authority will means an error).



Type cd bin and press a Enter pivotal to entrance a calm in a bin folder. You should see a following.



Finally, form ffmpeg.exe and press a Enter key. It will take 1 or 2 seconds to govern a authority and we should be means to see a outcome shown below.



If we see content lines combined on your shade (as per a above image) afterwards it means a apparatus is operative excellent and prepared to use.


Important Commands


Now, we’ll go by some of the critical commands for FFmpeg. Copy a video in a bin folder on that you’ll perform a operations. we have copied a video called samplevideo and will use this video around a residue of this post.


1. Extracting Audio usually From Video File


Once we have tested that FFmpeg is operative excellent afterwards form in a following command:


ffmpeg -i yourvideoname.mp4 -vn -ab 128 outputaudio.mp3



Here -vn is used to mislay audio and -ab is used to save audio as 128Kbps MP3 file. You can change a bit rate to 256Kbps or something else. Just change a value after -ab. All of a outlay files will be stored automatically in a bin folder.


2. Extracting Video While Muting Audio


In a authority combined below, -an is used to mislay a audio from a video file. The authority should demeanour like so:


ffmpeg -i yourvideoname.mp4 -an mutevideo.mp4



3. Resize a Video File


In a authority combined below, -s is used to resize a video file.The authority is:


ffmpeg -i yourvideoname.mp4 -s 640x480 -c:a duplicate resizedvideo.mp4



4. Adding Poster Image to an Audio File


You can add a print picture to your audio file simply and a outlay would be a video record with an picture being displayed in a front and audio in a background. This is unequivocally accessible when uploading MP3 files to video hosting and pity sites.


You contingency copy a picture in a bin folder. Then govern this command:


ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a –strict initial -b:a 192k -shortest outputfile.mp4



5. Cut Video File into a Smaller Clip


The -ss defines a starting time stamp (here starting time is a 45th second) and -t tells a sum time generation for a clip. So, -t 40 means 40 second duration. The authority should like this:


ffmpeg -i yourvideoname.mp4 -ss 00:00:45 -codec duplicate -t 40 outputclip.mp4



6. Split a Video File into Multiple Parts


Most of a hosting servers usually allows for a specific distance of record to be uploaded. To overcome this issue, we can use a separate authority to separate a vast video record into smaller parts, that is:


ffmpeg -i yourvideoname.mp4 -t 00:00:59 -c duplicate part1.mp4 -ss 00:00:59 -codec duplicate part2.mp4



Here -t 00:00:59 represents a partial that is combined from a start of a video to a 59th second of video. -ss 00:00:59 shows a starting time stamp for a video. It means that a 2nd partial will start from a 59th second and will continue adult to a finish of a strange video file.


7. Convert a Video File from One Format to Another Format


You can see all of a formats upheld by FFmpeg by regulating a following command:


ffmpeg -formats


To modify a video record from one format to another format, a following authority is used:


ffmpeg -i yourvideoname.mp4 -c:v libx264 outputfilename.wmv


The authority next is an instance of when converting a .mp4 record into a .wmv file.



8. Join (merge) Video Files


FFmpeg can also join mixed video or audio files with a same codecs. Create a .txt record including a list of all a submit video files that are ostensible to be merged. The keyword record is followed by name, trail and a format of a video files. Add all of a files in a same approach in a combined .txt record and save this .txt record in a bin folder.



Now form a following authority to join a video files:


ffmpeg -f concat -i file-list.txt -c duplicate outputfile.mp4



9. Cropping an Audio File


To stand partial of an audio file, a following authority can be utilized:


ffmpeg -ss 00:00:15 -t 45 -i sampleaudio.mp3 croppedaudio.mp3


Here, -ss 00:00:15 is a staring time and -t 45 is a generation of a cropped file.



Conclusion


We’ve lonesome downloading and installing FFmpeg as good as some of a useful commands that we can use. You can try a rest of a commands around a assistance option of FFmpeg. Just form in ffmpeg -h in authority line. This will list all a accessible options and commands for these options. So because don’t we try it out for yourself?




A Guide To Video And Audio Conversion Using FFmpeg

Nenhum comentário:

Postar um comentário