ffmpeg to the rescue

For software related questions and answers, notes, instructions
Post Reply
reggind
Knight
Posts: 2058
Joined: 23 Feb 2014 06:14
x 340

ffmpeg to the rescue

Post by reggind »

I have been working with sounds and images and was in need of a fast and easy and cross platform way to do various conversions. I had used ffmpeg to do video format conversions before and I thought what the heck, it may have the brains to deal with audio and images, and son of a gun it does. This is almost a must have program. I have it for Windows and Linux, I suspect there is a mac port. This works from the command line so for windows after you install it and make sure it is in your path you open up a command window, or for linux you open up a terminal or console window.

To use it for simple format conversions is ultra easy. ffmpeg can read almost any video, audio or image extension and it can write almost any. And it figures out what you want it to do by the file extensions themselves. See some examples below:

ffmpeg -i input_file.ext outputfile.ext

So we have a sound file, sound.wav and we want it in mp3 easy

ffmpeg -i sound.wav sound.mp3

It works with images too. We have image.png and we want image.jpg

ffmpeg -i image.png image.jpg


It can also do tricks, like if you want only the sound track from a video, video.mpg saved as audio.mp3

ffmpeg -i video.mpg audio.mp3
reggind
Knight
Posts: 2058
Joined: 23 Feb 2014 06:14
x 340

Re: ffmpeg to the rescue

Post by reggind »

I was asked where ffmpeg comes from and how to install.. This is for Windows and I suspect Win7 and up as it is the 64 bit flavor.
download this: https://www.gyan.dev/ffmpeg/builds/ffmp ... se-full.7z

Unzip it, if you need 7zip it is free and comes from here: https://www.7-zip.org/download.html

You should wind up with a directory called something like: ffmpeg-2022-02-21-git-b8e58f0858-full_build
You can rename that to just ffmpeg. If you want you can stick a text file in the folder with the full name so you will know what you have but it is not necessary.

Copy this folder to C:\Program Files

Now you should have a directory C:\Program Files\ffmpeg

Next we need to add it to our search path.

In the search box on the task bar search for control and open up control panel
In the upper right corner of that window make sure view by is set to small icons, if not use the drop down to change it.
Click on the system icon
In the system window about half way up the right side, click on advanced system settings
In the window that pops up, in the lower right click on "Environment Variables"
In the window that pops up, in the bottom half "System Variables" scroll down until you see path and highlight it and click on Edit
Click on New and paste C:\Program Files\ffmpeg\bin in the blank space and click OK,

Now in the search box on the task bar, search for cmd and run that. At the prompt enter ffmpeg and hit return. You should see some stuff like this:
C:\Users\foobar>ffmpeg
ffmpeg version 2022-02-21-git-b8e58f0858-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 57. 21.100 / 57. 21.100
libavcodec 59. 21.100 / 59. 21.100
libavformat 59. 17.102 / 59. 17.102
libavdevice 59. 5.100 / 59. 5.100
libavfilter 8. 27.100 / 8. 27.100
libswscale 6. 5.100 / 6. 5.100
libswresample 4. 4.100 / 4. 4.100
libpostproc 56. 4.100 / 56. 4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

C:\Users\foobar>

Congratulations you have it installed and ready to go! Close all the other windows you have opened.

Now that may have seemed like a lot of work, but you now have a great utility and you have a place to stick other goodies too. I keep yt-dlp the high speed youtube downloader in there as well as the old youtue-dl which pretty much sucks these days, and wget for grabbing stuff from web pages via the comamnd line, in that dir (C:\Program Files\ffmpeg\bin\) as well.
Post Reply