{"id":10501,"date":"2019-03-06T07:48:22","date_gmt":"2019-03-06T07:48:22","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=10501"},"modified":"2019-03-28T02:43:56","modified_gmt":"2019-03-28T02:43:56","slug":"how-to-install-ffmpeg-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/06\/how-to-install-ffmpeg-in-linux\/","title":{"rendered":"How to Install FFmpeg in Linux"},"content":{"rendered":"<p><strong>FFmpeg<\/strong>\u00a0is one of the best multimedia frameworks that contains\u00a0<a href=\"https:\/\/www.tecmint.com\/ffmpeg-commands-for-video-audio-and-image-conversion-in-linux\/\" target=\"_blank\" rel=\"noopener\">various tools for different tasks<\/a>. For example the\u00a0<strong>ffplay<\/strong>\u00a0is a portable media player that can be used to play audio\/video files,\u00a0<strong>ffmpeg<\/strong>\u00a0can convert between different file formats,\u00a0<strong>ffserver<\/strong>\u00a0can be used to stream live broadcasts and\u00a0<strong>ffprobe<\/strong>\u00a0is able to analyze multimedia stream.<\/p>\n<p>This framework is really powerful due to the diversity of available tools in it, that provide the best technical solution for the user. According to the description of\u00a0<strong>FFmpeg<\/strong>\u00a0in the official website, the reason for having such a great multimedia framework is the combination of the best free software options available.<\/p>\n<p>The\u00a0<strong>FFmpeg<\/strong>\u00a0framework offers high security and the reason for this is the seriosity of the developers when they review the code, it is always done with security in mind.<\/p>\n<p>I am very sure you will find this framework very useful when you would like to do some digital\u00a0<a href=\"https:\/\/www.tecmint.com\/mstream-music-streaming-server-for-linux\/\" target=\"_blank\" rel=\"noopener\">audio and video streaming<\/a>\u00a0or recording. There are many other practical thing that you can do with the help of the\u00a0<strong>FFmpeg<\/strong>framework such as converting your wav file to an mp3 one, encode and decode your videos or even scale them.<\/p>\n<p>According to the official website FFmpeg is able to do the followings.<\/p>\n<ol>\n<li>decode multimedia files<\/li>\n<li>encode multimedia files<\/li>\n<li>transcode multimedia files<\/li>\n<li>mux multimedia files<\/li>\n<li>demux multimedia files<\/li>\n<li>stream multimedia files<\/li>\n<li>filter multimedia files<\/li>\n<li>play multimedia files<\/li>\n<\/ol>\n<p>Let me take an example, a very simple one. The following command will convert your\u00a0<strong>mp4<\/strong>\u00a0file into an\u00a0<strong>avi<\/strong>\u00a0file, simple as that.<\/p>\n<pre># ffmpeg -i Lone_Ranger.mp4 Lone_Ranger.avi<\/pre>\n<p>The above command is only useful for explanation, it is not recommended to be used in practice because the codex, bitrate and other specifics are not declared.<\/p>\n<p>In the next part we will practice with some of the\u00a0<a href=\"https:\/\/www.tecmint.com\/ffmpeg-commands-for-video-audio-and-image-conversion-in-linux\/\" target=\"_blank\" rel=\"noopener\">FFmpeg multimedia framework tools<\/a>, but before doing that we have to install it in our Linux box.<\/p>\n<h3>How to Install FFmpeg Multimedia Framework in Linux<\/h3>\n<p>Since the\u00a0<strong>FFmpeg<\/strong>\u00a0packages are offered for the most used Linux distributions and the installation will be relatively easy. Lets start with the installation of the FFmpeg framework in Ubuntu based distributions.<\/p>\n<h4>Install FFmpeg on Ubuntu and Linux Mint<\/h4>\n<p>I will install\u00a0<strong>FFmpeg<\/strong>\u00a0via the\u00a0<strong>PPA<\/strong>\u00a0recommended in the official blog. Open a new terminal (<strong>CTRL+ALT+T<\/strong>) and then run the following commands.<\/p>\n<pre>$ sudo add-apt-repository ppa:mc3man\/trusty-media\r\n$ sudo apt-get update\r\n$ sudo apt-get install ffmpeg\r\n$ ffmpeg -version\r\n<\/pre>\n<h4>Install FFmpeg on Debian<\/h4>\n<p>To install\u00a0<strong>FFmpeg<\/strong>, first you need to add the following line to your\u00a0<code>\/etc\/apt\/sources.list<\/code>\u00a0file. As per your distribution, change \u2018<code>&lt;mydist&gt;<\/code>\u2018 with \u2018<strong>stretch<\/strong>\u2018, \u2018<strong>jessie<\/strong>\u2018, or \u2018<strong>wheezy<\/strong>\u2018.<\/p>\n<pre>deb http:\/\/www.deb-multimedia.org <code>&lt;mydist&gt;<\/code> main non-free deb-src http:\/\/www.deb-multimedia.org <code>&lt;mydist&gt;<\/code> main non-free<\/pre>\n<p>Then update system package sources and install\u00a0<strong>FFmpeg<\/strong>\u00a0with the following commands.<\/p>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get install deb-multimedia-keyring\r\n$ sudo apt-get update\r\n$ sudo apt-get install ffmpeg\r\n$ ffmpeg -version\r\n<\/pre>\n<h4>Install FFmpeg on CentOS and RHEL<\/h4>\n<p>To install\u00a0<strong>FFmpeg<\/strong>\u00a0on\u00a0<strong>CentOS<\/strong>\u00a0and\u00a0<strong>RHEL<\/strong>\u00a0distributions, you need to enable\u00a0<strong>EPEL<\/strong>\u00a0and\u00a0<strong>RPM Fusion<\/strong>\u00a0repository on the system using following commands.<\/p>\n<p>To install and enable\u00a0<strong>EPEL<\/strong>, use following command.<\/p>\n<pre># yum install epel-release\r\n<\/pre>\n<p>To install and enable\u00a0<strong>RPM Fusion<\/strong>, use following command on your distribution version.<\/p>\n<pre><strong>-------------- On CentOS &amp; RHEL 7.x --------------<\/strong> \r\n# yum localinstall --nogpgcheck https:\/\/download1.rpmfusion.org\/free\/el\/rpmfusion-free-release-7.noarch.rpm https:\/\/download1.rpmfusion.org\/nonfree\/el\/rpmfusion-nonfree-release-7.noarch.rpm\r\n\r\n<strong>-------------- On CentOS &amp; RHEL 6.x --------------<\/strong>\r\n# yum localinstall --nogpgcheck https:\/\/download1.rpmfusion.org\/free\/el\/rpmfusion-free-release-6.noarch.rpm https:\/\/download1.rpmfusion.org\/nonfree\/el\/rpmfusion-nonfree-release-6.noarch.rpm\r\n<\/pre>\n<p>After enabling repositories, run the following command to install\u00a0<strong>FFmpeg<\/strong>:<\/p>\n<pre># yum install ffmpeg ffmpeg-devel\r\n# ffmpeg -version\r\n<\/pre>\n<h4>Install FFmpeg on Fedora<\/h4>\n<p>On Fedora, you need to install and enable\u00a0<strong>RPM Fusion<\/strong>\u00a0to install\u00a0<strong>FFmpeg<\/strong>\u00a0as shown.<\/p>\n<pre>$ sudo dnf install https:\/\/download1.rpmfusion.org\/free\/fedora\/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https:\/\/download1.rpmfusion.org\/nonfree\/fedora\/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm\r\n$ sudo dnf install ffmpeg ffmpeg-devel\r\n$ ffmpeg -version\r\n<\/pre>\n<h4>FFmpeg Compiling from Source<\/h4>\n<p>Compiling software from source is not the easiest thing in the world, but with the right instructions we will be able to do it. First make sure your system meet all the dependencies. The installation of these dependencies can be done with the help of the following commands.<\/p>\n<p>First, tell the system to pull down the latest packages.<\/p>\n<pre>$ sudo apt-get update<\/pre>\n<p>Install the dependencies with the following command.<\/p>\n<pre><strong>-------------- On Debian &amp; Ubuntu --------------<\/strong>\r\n$ sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \\\r\nlibsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \\\r\nlibxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev\r\n<\/pre>\n<pre><strong>-------------- On CentOS and RHEL --------------<\/strong>\r\n# yum install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig SDL-devel \\\r\na52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel freetype-devel giflib gsm gsm-devel \\\r\nimlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel libXau-devel libXdmcp-devel \\\r\nlibXext-devel libXrandr-devel libXrender-devel libXt-devel libogg libvorbis vorbis-tools mesa-libGL-devel \\\r\nmesa-libGLU-devel xorg-x11-proto-devel zlib-devel libtheora theora-tools ncurses-devel libdc1394 libdc1394-devel \\\r\namrnb-devel amrwb-devel opencore-amr-devel\r\n<\/pre>\n<p>Then use the following command to create a new directory for the FFmpeg sources. This is the directory where the source files will be downloaded.<\/p>\n<pre>$ mkdir ~\/ffmpeg_sources<\/pre>\n<p>Now compile and install\u00a0<strong>yasm<\/strong>\u00a0assembler used by FFmpeg by running the following commands.<\/p>\n<pre>$ cd ~\/ffmpeg_sources\r\n$ wget http:\/\/www.tortall.net\/projects\/yasm\/releases\/yasm-1.3.0.tar.gz\r\n$ tar xzvf yasm-1.3.0.tar.gz\r\n$ cd yasm-1.3.0\r\n$ .\/configure --prefix=\"$HOME\/ffmpeg_build\" --bindir=\"$HOME\/bin\"\r\n$ make\r\n$ make install\r\n$ make distclean\r\n$ export \"PATH=$PATH:$HOME\/bin\"\r\n<\/pre>\n<div class=\"google-auto-placed ap_container\">\n<p>After you have successfully installed the\u00a0<strong>yasm<\/strong>\u00a0assembler it is time to install some various encoders that will be used with the specific FFmpeg tools. Use the following commands to install the\u00a0<strong>H.264<\/strong>\u00a0video encoder.<\/p>\n<pre>$ cd ~\/ffmpeg_sources\r\n$ wget http:\/\/download.videolan.org\/pub\/x264\/snapshots\/last_x264.tar.bz2\r\n$ tar xjvf last_x264.tar.bz2\r\n$ cd x264-snapshot*\r\n$ .\/configure --prefix=\"$HOME\/ffmpeg_build\" --bindir=\"$HOME\/bin\" --enable-static\r\n$ make\r\n$ make install\r\n$ make distclean\r\n<\/pre>\n<p>Another nice useful encoder is the\u00a0<strong>libfdk-aac AAC<\/strong>\u00a0audio encoder.<\/p>\n<pre>$ cd ~\/ffmpeg_sources\r\n$ wget -O fdk-aac.zip https:\/\/github.com\/mstorsjo\/fdk-aac\/zipball\/master\r\n$ unzip fdk-aac.zip\r\n$ cd mstorsjo-fdk-aac*\r\n$ autoreconf -fiv\r\n$.\/configure --prefix=\"$HOME\/ffmpeg_build\" --disable-shared\r\n$ make\r\n$ make install\r\n$ make distclean<\/pre>\n<p>Install\u00a0<strong>libopus<\/strong>\u00a0audio decoder and encoder.<\/p>\n<pre>$ cd ~\/ffmpeg_sources\r\n$ wget http:\/\/downloads.xiph.org\/releases\/opus\/opus-1.1.tar.gz\r\n$ tar xzvf opus-1.1.tar.gz\r\n$ cd opus-1.1\r\n$ .\/configure --prefix=\"$HOME\/ffmpeg_build\" --disable-shared\r\n$ make\r\n$ make install\r\n$ make distclean<\/pre>\n<p>Now, it\u2019s time to install\u00a0<strong>ffmpeg<\/strong>\u00a0from source.<\/p>\n<pre>$ cd ~\/ffmpeg_sources\r\n$ wget http:\/\/ffmpeg.org\/releases\/ffmpeg-snapshot.tar.bz2\r\n$ tar xjvf ffmpeg-snapshot.tar.bz2\r\n$ cd ffmpeg\r\n$ PKG_CONFIG_PATH=\"$HOME\/ffmpeg_build\/lib\/pkgconfig\"\r\n$ export PKG_CONFIG_PATH\r\n$ .\/configure --prefix=\"$HOME\/ffmpeg_build\" --extra-cflags=\"-I$HOME\/ffmpeg_build\/include\" \\\r\n   --extra-ldflags=\"-L$HOME\/ffmpeg_build\/lib\" --bindir=\"$HOME\/bin\" --extra-libs=\"-ldl\" --enable-gpl \\\r\n   --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus \\\r\n   --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab\r\n$ make\r\n$ make install\r\n$ make distclean\r\n$ hash -r<\/pre>\n<p><strong>Note<\/strong>: If you have not installed certain encoders, make sure to remove \u2018<strong>\u2013enable-encoder_name<\/strong>\u2018 from the above \u2018<strong>.\/configure<\/strong>\u2018 command so the installation is done without any problem.<\/p>\n<p>There are many encoders that you can install, but fur the purpose of this article I am not going to install all of them, but you can install them using the following official guides.<\/p>\n<ol>\n<li><a href=\"https:\/\/trac.ffmpeg.org\/wiki\/CompilationGuide\/Ubuntu\" target=\"_blank\" rel=\"nofollow noopener\">FFmpeg Compilation Guide for Ubuntu<\/a><\/li>\n<li><a href=\"https:\/\/trac.ffmpeg.org\/wiki\/CompilationGuide\/Centos\" target=\"_blank\" rel=\"nofollow noopener\">FFmpeg Compilation Guide for CentOS<\/a><\/li>\n<\/ol>\n<h3>Conclusion<\/h3>\n<p>In this first part we updated our readers with the latest news according to the FFmpeg multimedia framework and showed them how to install it in their Linux machines. The next part will be totally about learning how to use the amazing tools inside this leading multimedia framework.<\/p>\n<p><strong>Update<\/strong>: The\u00a0<strong>Part 2<\/strong>\u00a0of this FFmpeg series is published, which shows some useful ffmpeg command-line usage to perform various audio, video and image conversion procedures:\u00a0<a href=\"https:\/\/www.tecmint.com\/ffmpeg-commands-for-video-audio-and-image-conversion-in-linux\/\" target=\"_blank\" rel=\"noopener\">15 Useful \u2018FFmpeg\u2019 Commands for Video, Audio and Image Conversion in Linux<\/a>.<\/p>\n<h1 class=\"post-title\">15 Useful \u2018FFmpeg\u2019 Commands for Video, Audio and Image Conversion in Linux \u2013 Part 2<\/h1>\n<p>In this article we are going to look at some options and examples of how you can use\u00a0<strong>FFmpeg<\/strong>\u00a0multimedia framework to perform various conversion procedures on audio and video files.<\/p>\n<div id=\"attachment_16679\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/FFMPEG-Command-Examples.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16679\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/FFMPEG-Command-Examples.png\" alt=\"FFMPEG Command Examples in Linux\" width=\"720\" height=\"345\" aria-describedby=\"caption-attachment-16679\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16679\" class=\"wp-caption-text\">15 FFMPEG Command Examples in Linux<\/p>\n<\/div>\n<p>For more details about FFmpeg and steps to install it in different Linux distros, read the article from the link below:<\/p>\n<p><i class=\"fa fa-check\"><\/i>\u00a0<a href=\"https:\/\/www.tecmint.com\/install-ffmpeg-in-linux\/\" target=\"_blank\" rel=\"noopener\">FFmpeg Multimedia Framework Installation Guide on Linux \u2013 Part 1<\/a><\/p>\n<h3>Useful FFmpeg Commands<\/h3>\n<p>FFmpeg utility supports almost all major audio and video formats, if you want to check the ffmpeg supported available formats you can use\u00a0<strong>.\/ffmpeg -formats<\/strong>\u00a0command to list all supported formats. If you are new to this tool, here are some handy commands that will give you a better idea about the capabilities of this powerful tool.<\/p>\n<h4>1. Get Video File Information<\/h4>\n<p>To get information about a file (say\u00a0<strong>video.mp4<\/strong>), run the following command. Remember you have to specify an\u00a0<strong>ouput<\/strong>\u00a0file, but in this case we only want to get some information about the input file.<\/p>\n<pre><strong>$ ffmpeg -i video.flv -hide_banner<\/strong>\r\n<\/pre>\n<div id=\"attachment_16260\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Get-Video-Information.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16260\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Get-Video-Information.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Get-Video-Information.png 819w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Get-Video-Information-620x232.png 620w\" alt=\"Get Video Information\" width=\"620\" height=\"232\" aria-describedby=\"caption-attachment-16260\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16260\" class=\"wp-caption-text\">Get Video Information<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p><strong>Note<\/strong>: The\u00a0<code>-hide_banner<\/code>\u00a0option is used to hide a copyright notice shown my ffmpeg, such as build options and library versions. This option can be used to suppress printing this information.<\/p>\n<p>For example, if you run the above command without adding\u00a0<code>-hide_banner<\/code>\u00a0option it will print the all FFmpeg tools copyright information as shown.<\/p>\n<pre><strong>$ ffmpeg -i video.flv<\/strong>\r\n<\/pre>\n<div id=\"attachment_16261\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Hide-FFmpeg-Version-Information.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16261\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Hide-FFmpeg-Version-Information.png\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Hide-FFmpeg-Version-Information.png 797w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Hide-FFmpeg-Version-Information-588x450.png 588w\" alt=\"Hide FFmpeg Version Information\" width=\"588\" height=\"450\" aria-describedby=\"caption-attachment-16261\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16261\" class=\"wp-caption-text\">Hide FFmpeg Version Information<\/p>\n<\/div>\n<h4>2. Split a video into images<\/h4>\n<p>To turn a video to number of images, run the command below. The command generates the files named\u00a0<strong>image1.jpg<\/strong>,\u00a0<strong>image2.jpg<\/strong>\u00a0and so on\u2026<\/p>\n<pre><strong>$ ffmpeg -i video.flv image%d.jpg<\/strong>\r\n<\/pre>\n<div id=\"attachment_16657\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Split-Video-into-Images.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16657\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Split-Video-into-Images.png\" alt=\"Split Video into Images\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16657\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16657\" class=\"wp-caption-text\">Split Video into Images<\/p>\n<\/div>\n<p>After successful execution of above command you can verify that the video turn into multiple images using following\u00a0<a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>.<\/p>\n<pre><strong>$ ls -l<\/strong>\r\n\r\ntotal 11648\r\n-rw-r--r-- 1 tecmint tecmint   14592 Oct 19 13:19 image100.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14603 Oct 19 13:19 image101.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14584 Oct 19 13:19 image102.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14598 Oct 19 13:19 image103.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14634 Oct 19 13:19 image104.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14693 Oct 19 13:19 image105.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14641 Oct 19 13:19 image106.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14581 Oct 19 13:19 image107.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14508 Oct 19 13:19 image108.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14540 Oct 19 13:19 image109.jpg\r\n-rw-r--r-- 1 tecmint tecmint   12219 Oct 19 13:18 image10.jpg\r\n-rw-r--r-- 1 tecmint tecmint   14469 Oct 19 13:19 image110.jpg\r\n<\/pre>\n<h4>3. Convert images into a video<\/h4>\n<p>Turn number of images to a video sequence, use the following command. This command will transform all the images from the current directory (named\u00a0<strong>image1.jpg<\/strong>,\u00a0<strong>image2.jpg<\/strong>, etc\u2026) to a video file named\u00a0<strong>imagestovideo.mpg<\/strong>.<\/p>\n<p>There are many other image formats (such as jpeg, png, jpg, etc) you can use.<\/p>\n<pre><strong>$ ffmpeg -f image2 -i image%d.jpg imagestovideo.mpg<\/strong>\r\n<\/pre>\n<div id=\"attachment_16659\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Create-Video-from-Images.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16659\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Create-Video-from-Images.png\" alt=\"Convert Images to Video\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16659\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16659\" class=\"wp-caption-text\">Convert Images to Video<\/p>\n<\/div>\n<h4>4. Convert a video into mp3 format<\/h4>\n<p>To convert an\u00a0<strong>.flv<\/strong>\u00a0format video file to\u00a0<strong>Mp3<\/strong>\u00a0format, run the following command.<\/p>\n<pre><strong>$ ffmpeg -i video.flv -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3<\/strong>\r\n<\/pre>\n<div id=\"attachment_16660\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Video-to-Audio.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16660\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Video-to-Audio.png\" alt=\"Convert Video to Audio\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16660\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16660\" class=\"wp-caption-text\">Convert Video to Audio<\/p>\n<\/div>\n<p>Description about the options used in above command:<\/p>\n<ol>\n<li><strong>vn<\/strong>: helps to disable video recording during the conversion.<\/li>\n<li><strong>ar<\/strong>: helps you set audio sampling rate in Hz.<\/li>\n<li><strong>ab<\/strong>: set the audio bitrate.<\/li>\n<li><strong>ac<\/strong>: to set the number of audio channels.<\/li>\n<li><strong>-f<\/strong>: format.<\/li>\n<\/ol>\n<h4>5. Covert flv video file to mpg format<\/h4>\n<p>To convert a\u00a0<strong>.flv<\/strong>\u00a0video file to\u00a0<strong>.mpg<\/strong>, use the following command.<\/p>\n<pre><strong>$ ffmpeg -i video.flv video.mpg<\/strong>\r\n<\/pre>\n<div id=\"attachment_16661\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Avi-to-MPG-Format.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16661\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Avi-to-MPG-Format.png\" alt=\"Convert Avi to MPG Video Format\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16661\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16661\" class=\"wp-caption-text\">Convert Avi to MPG Video Format<\/p>\n<\/div>\n<h4>6. Convert video into animated gif<\/h4>\n<p>To convert a\u00a0<strong>.flv<\/strong>\u00a0video file to animated, uncompressed gif file, use the command below.<\/p>\n<pre><strong>$ ffmpeg -i video.flv animated.gif.mp4<\/strong>\r\n<\/pre>\n<div id=\"attachment_16662\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Covert-Video-to-Anigmated-Gif.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16662\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Covert-Video-to-Anigmated-Gif.png\" alt=\"Covert Video to Animated Gif\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16662\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16662\" class=\"wp-caption-text\">Covert Video to Animated Gif<\/p>\n<\/div>\n<h4>7. Convert mpg video file to flv<\/h4>\n<p>To convert a\u00a0<strong>.mpg<\/strong>\u00a0file to\u00a0<strong>.flv<\/strong>\u00a0format, use the following command.<\/p>\n<pre><strong>$ ffmpeg -i video.mpg -ab 26k -f flv video1.flv<\/strong>\r\n<\/pre>\n<div id=\"attachment_16663\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Mpg-to-flv.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16663\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Mpg-to-flv.png\" alt=\"Convert Mpg to Flv Video Format\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16663\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16663\" class=\"wp-caption-text\">Convert Mpg to Flv Video Format<\/p>\n<\/div>\n<h4>8. Convert avi video file to mpeg<\/h4>\n<p>To convert a\u00a0<strong>.avi<\/strong>\u00a0file to\u00a0<strong>mpeg<\/strong>\u00a0for dvd players, run the command below:<\/p>\n<pre><strong>$ ffmpeg -i video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 video.mpeg<\/strong><\/pre>\n<p>Explanation about the options used in above command.<\/p>\n<ol>\n<li><strong>target pal-dvd<\/strong>\u00a0: Output format<\/li>\n<li><strong>ps 2000000000<\/strong>\u00a0maximum size for the output file, in bits (here, 2 Gb).<\/li>\n<li><strong>aspect 16:9<\/strong>\u00a0: Widescreen.<\/li>\n<\/ol>\n<div id=\"attachment_16664\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Avi-to-Mpeg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16664\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Avi-to-Mpeg.png\" alt=\"Convert Avi to Mpeg Video Format\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16664\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16664\" class=\"wp-caption-text\">Convert Avi to Mpeg Video Format<\/p>\n<\/div>\n<h4>9. Convert a video to CD or DVD format<\/h4>\n<p>To create a video\u00a0<strong>CD<\/strong>\u00a0or\u00a0<strong>DVD<\/strong>, FFmpeg makes it simple by letting you specify a target type and the format options required automatically.<\/p>\n<p>You can set a target type as follows:\u00a0<strong>add -target type<\/strong>; type can of the following be vcd, svcd, dvd, dv, pal-vcd or ntsc-svcd on the command line.<\/p>\n<p>To create a VCD, you can run the following command:<\/p>\n<pre><strong>$ ffmpeg -i video.mpg -target vcd vcd_video.mpg<\/strong>\r\n<\/pre>\n<div id=\"attachment_16665\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Video-to-DVD-Format.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16665\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Convert-Video-to-DVD-Format.png\" alt=\"Convert Video to DVD Format\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16665\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16665\" class=\"wp-caption-text\">Convert Video to DVD Format<\/p>\n<\/div>\n<h4>10. Extract audio from video file<\/h4>\n<p>To extract sound from a video file, and save it as Mp3 file, use the following command:<\/p>\n<pre><strong>$ ffmpeg -i video1.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio3.mp3<\/strong>\r\n<\/pre>\n<p>Explanation about the options used in above command.<\/p>\n<ol>\n<li><strong>Source video<\/strong>\u00a0: video.avi<\/li>\n<li><strong>Audio bitrate<\/strong>\u00a0: 192kb\/s<\/li>\n<li><strong>output format<\/strong>\u00a0: mp3<\/li>\n<li><strong>Generated sound<\/strong>\u00a0: audio3.mp3<\/li>\n<\/ol>\n<div id=\"attachment_16666\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Extract-Audio-from-Video.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16666\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Extract-Audio-from-Video.png\" alt=\"Extract Audio from Video\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16666\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16666\" class=\"wp-caption-text\">Extract Audio from Video<\/p>\n<\/div>\n<h4>11. Mix a video and audio together<\/h4>\n<p>You can also mix a video with a sound file as follows:<\/p>\n<pre><strong>$ ffmpeg -i audio.mp3 -i video.avi video_audio_mix.mpg<\/strong>\r\n<\/pre>\n<div id=\"attachment_16667\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Mix-Video-and-Audio.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16667\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Mix-Video-and-Audio.png\" alt=\"Mix Video and Audio\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16667\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16667\" class=\"wp-caption-text\">Mix Video and Audio<\/p>\n<\/div>\n<h4>12. Increase\/Reduce Video Playback Speed<\/h4>\n<p>To increase video play back speed, run this command. The\u00a0<strong>-vf<\/strong>\u00a0option sets the video filters that helps to adjust the speed.<\/p>\n<pre>$ ffmpeg -i video.mpg -vf \"setpts=0.5*PTS\" highspeed.mpg\r\n<\/pre>\n<div id=\"attachment_16669\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Increase-Video-Playback-Speed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16669\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Increase-Video-Playback-Speed.png\" alt=\"Increase Video Playback Speed\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16669\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16669\" class=\"wp-caption-text\">Increase Video Playback Speed<\/p>\n<\/div>\n<p>You can also reduce video speed as follows:<\/p>\n<pre>$ ffmpeg -i video.mpg -vf \"setpts=4.0*PTS\" lowerspeed.mpg -hide_banner\r\n<\/pre>\n<div id=\"attachment_16670\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Reduce-Video-Playback-Speed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16670\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Reduce-Video-Playback-Speed.png\" alt=\"Reduce Video Playback Speed\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16670\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16670\" class=\"wp-caption-text\">Reduce Video Playback Speed<\/p>\n<\/div>\n<h4>13. Compare\/Test Video and Audio Quality<\/h4>\n<p>To compare videos and audios after converting you can use the commands below. This helps you to test videos and audio quality.<\/p>\n<pre>$ ffplay video1.mp4\r\n<\/pre>\n<div id=\"attachment_16671\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Test-Video-Quality.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16671\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Test-Video-Quality.png\" alt=\"Test Video Quality\" width=\"956\" height=\"670\" aria-describedby=\"caption-attachment-16671\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16671\" class=\"wp-caption-text\">Test Video Quality<\/p>\n<\/div>\n<p>To test audio quality simply use the name of the audio file as follows:<\/p>\n<pre>$ ffplay audio_filename1.mp3\r\n<\/pre>\n<div id=\"attachment_16672\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Test-Audio-Quality.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16672\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Test-Audio-Quality.png\" alt=\"Test Audio Quality\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16672\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16672\" class=\"wp-caption-text\">Test Audio Quality<\/p>\n<\/div>\n<p>You can listen to them while they play and compare the qualities from the sound.<\/p>\n<h4>14. Add Photo or Banner to Audio<\/h4>\n<p>You can add a cover poster or image to an audio file using the following command, this comes very useful for uploading MP3s to YouTube.<\/p>\n<pre>$ ffmpeg -loop 1 -i image.jpg -i Bryan\\ Adams\\ -\\ Heaven.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4\r\n<\/pre>\n<div id=\"attachment_16676\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Add-Image-to-Audio.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16676\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/10\/Add-Image-to-Audio.png\" alt=\"Add Image to Audio\" width=\"940\" height=\"629\" aria-describedby=\"caption-attachment-16676\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-16676\" class=\"wp-caption-text\">Add Image to Audio<\/p>\n<\/div>\n<h4>15. Add subtitles to a Movie<\/h4>\n<p>If you have a separate subtitle file called\u00a0<strong>subtitle.srt<\/strong>, you can use following command to add subtitle to a movie file:<\/p>\n<pre>$ ffmpeg -i video.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast video-output.mkv\r\n<\/pre>\n<h3>Summary<\/h3>\n<p>That is all for now but these are just few examples of using FFmpeg, you can find more options for what you wish to accomplish. Remember to post a comment to provide information about how to use FFmpeg or if you have encountered errors while using it.<\/p>\n<p><strong>Reference<\/strong>:\u00a0<a href=\"https:\/\/ffmpeg.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/ffmpeg.org\/<\/a><\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-ffmpeg-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>FFmpeg\u00a0is one of the best multimedia frameworks that contains\u00a0various tools for different tasks. For example the\u00a0ffplay\u00a0is a portable media player that can be used to play audio\/video files,\u00a0ffmpeg\u00a0can convert between different file formats,\u00a0ffserver\u00a0can be used to stream live broadcasts and\u00a0ffprobe\u00a0is able to analyze multimedia stream. This framework is really powerful due to the diversity of &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/06\/how-to-install-ffmpeg-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install FFmpeg in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10501","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/10501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=10501"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/10501\/revisions"}],"predecessor-version":[{"id":12591,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/10501\/revisions\/12591"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=10501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=10501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=10501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}