{"id":12811,"date":"2019-03-28T21:47:44","date_gmt":"2019-03-28T21:47:44","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12811"},"modified":"2019-03-28T21:47:44","modified_gmt":"2019-03-28T21:47:44","slug":"how-to-record-your-desktop-video-and-audio-using-avconv-tool-in-ubuntu","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-record-your-desktop-video-and-audio-using-avconv-tool-in-ubuntu\/","title":{"rendered":"How to Record Your Desktop Video and Audio Using \u201cAvconv\u201d Tool in Ubuntu"},"content":{"rendered":"<p><b>Libav<\/b>\u00a0is a set of cross-platform libraries and tools that are used to deal with multimedia files, streams and protocols, it was originally forked from the ffmpeg project. Libav includes many sub-tools like:<\/p>\n<ol>\n<li><b>Avplay<\/b>: a video &amp; audio player.<\/li>\n<li><b>Avconv<\/b>: a multimedia converter plus a video &amp; audio recorder from different sources.<\/li>\n<li><b>Avprobe<\/b>: a tool that connects to the multimedia file stream and returns many useful information and statistics about it.<\/li>\n<li><b>Libavfilter<\/b>: a filtering API for different Libav tools.<\/li>\n<\/ol>\n<p>In this article, we\u2019ll explain how to record the Linux desktop\u2019s video &amp; audio using the \u2018Avconv\u2019 program on\u00a0<strong>Debian<\/strong>\/<strong>Ubuntu<\/strong>\/<strong>Linux Mint<\/strong>\u00a0distributions.<\/p>\n<h3>Step 1: Installing Avconv Tool<\/h3>\n<p><strong>1.<\/strong>\u00a0<b>avconv<\/b>\u00a0is a part from the \u201c<b>libav-tools<\/b>\u201d package, which is available to install from the official repositories for all Debian-based distributions like Ubuntu and Mint, using following commands.<\/p>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get install libav-tools\r\n<\/pre>\n<div id=\"attachment_9642\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Install-avconv-tool.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9642\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Install-avconv-tool-620x395.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Install-avconv-tool-620x395.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Install-avconv-tool.jpeg 771w\" alt=\"Install Avconv in Ubuntu\" width=\"620\" height=\"395\" aria-describedby=\"caption-attachment-9642\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9642\" class=\"wp-caption-text\">Install Avconv Tool<\/p>\n<\/div>\n<p><strong>Note<\/strong>: Installing packages from default repositories, might give you a little older version of \u2018<strong>avconv<\/strong>\u2018 tool. Thus, we recommend you to get the latest version from the official git repository, as shown below.<\/p>\n<pre>$ sudo apt-get install yasm\r\n$ git clone git:\/\/git.libav.org\/libav.git\r\n$ cd libav\r\n$ .\/configure\r\n$ make\r\n$ sudo make install<\/pre>\n<p><strong>Note<\/strong>: You will have to run \u201c<b>.\/configure \u2013help<\/b>\u201d in order to list all the available options for the configuration file and install codecs and libraries that you want, you will also need to do a lot of work in order to install the dependencies.<\/p>\n<p>Also note, if you\u2019re used the compile-from-source way, you\u2019ll always have to use \u201c<b>sudo avconv<\/b>\u201d instead of \u201c<b>avconv<\/b>\u201d to run the tool.<\/p>\n<h3>Step 2: Start Video Recording of Desktop<\/h3>\n<p><strong>2.<\/strong>\u00a0You\u2019re ready now, all what you have to do is to record your desktop video by issuing following command.<\/p>\n<pre>$ avconv -f x11grab -r <strong>25<\/strong> -s <strong>1920x1080<\/strong> -i :0.0 -vcodec libx264 -threads 4 <strong>$HOME\/output.avi<\/strong>\r\n<\/pre>\n<p>Now let\u2019s explain the command in short:<\/p>\n<ol>\n<li><b>avconv -f x11grab<\/b>\u00a0is the default command to capture video from the X server.<\/li>\n<li><b>-r 25<\/b>\u00a0is the frame rate you want, you may change it if you like.<\/li>\n<li><b>-s 1920\u00d71080<\/b>\u00a0is your system\u2019s screen resolution, change it to your current system resolution, it\u2019s very important to do this.<\/li>\n<li><b>-i :0.0<\/b>\u00a0is where we want to set our recording start point, leave it like this.<\/li>\n<li><b>-vcodec libx264<\/b>\u00a0is the video codec that we\u2019re using to record the desktop.<\/li>\n<li><b>-threads 4<\/b>\u00a0is the number of threads, you may change it as well if you like.<\/li>\n<li><b>$HOME\/output<\/b>\u00a0is the destination path where you want to save the file.<\/li>\n<li><b>.avi<\/b>\u00a0is the video format, you may change it to \u201cflv\u201d, \u201cmp4\u201d, \u201cwmv\u201d, \u201cmov\u201d, \u201cmkv\u201d.<\/li>\n<\/ol>\n<p><strong>3.<\/strong>\u00a0After you enter the command, the recording will start automatically as a process running from the terminal, in order to stop it, hit \u201c<b>Ctrl + C<\/b>\u201d keys inside the terminal window.<\/p>\n<div id=\"attachment_9643\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Screen.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9643\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Screen-620x348.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Screen-620x348.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Screen-1024x575.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Screen.jpeg 1366w\" alt=\"Record Desktop Screen in Ubuntu\" width=\"620\" height=\"348\" aria-describedby=\"caption-attachment-9643\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9643\" class=\"wp-caption-text\">Record Desktop Screen<\/p>\n<\/div>\n<p><strong>4.<\/strong>\u00a0Now, you may run the file using VLC or any other multimedia player, or you may run it using \u201c<b>avplay<\/b>\u201d tool which is a multimedia player from the same Libav package.<\/p>\n<pre>$ avplay $HOME\/output.avi\r\n<\/pre>\n<p><strong>Note<\/strong>: Don\u2019t forget to replace the destination file path. The recording\u2019s quality is pretty good.<\/p>\n<div id=\"attachment_9646\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Play-Recorded-Video.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9646\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Play-Recorded-Video-620x348.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Play-Recorded-Video-620x348.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Play-Recorded-Video-1024x575.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Play-Recorded-Video.jpeg 1366w\" alt=\"Play Recorded Video\" width=\"620\" height=\"348\" aria-describedby=\"caption-attachment-9646\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9646\" class=\"wp-caption-text\">Play Recorded Video<\/p>\n<\/div>\n<p>Here\u2019s a video that I\u2019ve recorded using the \u201c<b>avconv<\/b>\u201d tool.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/g1FEh4wByGE\" width=\"640\" height=\"380\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h3>Step 3: Start Video &amp; Audio Recording of Desktop<\/h3>\n<p><strong>5.<\/strong>\u00a0If you want to record the audio as well, first run this command to list all the available input sources for the audio.<\/p>\n<pre>$ arecord -l\r\n<\/pre>\n<p>It will give you some output like this.<\/p>\n<div id=\"attachment_9644\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Check-Audio-Input.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9644\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Check-Audio-Input-620x87.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Check-Audio-Input-620x87.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Check-Audio-Input.png 634w\" alt=\"Check Audio Input in Ubuntu\" width=\"620\" height=\"87\" aria-describedby=\"caption-attachment-9644\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9644\" class=\"wp-caption-text\">Check Audio Input<\/p>\n<\/div>\n<p>In my case, I\u2019ve one input source for audio only, and its number is \u201c<b>1<\/b>\u201d, that\u2019s why I am going to use the following command to capture both video &amp; microphone audio.<\/p>\n<pre>$ avconv <strong>-f alsa -i hw:1<\/strong> -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 output-file2.avi\r\n<\/pre>\n<div class=\"google-auto-placed ap_container\">\n<p>You see that part which is colored in yellow? It\u2019s the only modification that I did for the command. Now let\u2019s explain the command in short:<\/p>\n<ol>\n<li><b>-f alsa<\/b>\u00a0is an option to capture the sound from the alsa device.<\/li>\n<li><b>-i hw:1<\/b>\u00a0is an option to take the audio input source from the \u201chw:1\u201d device which is the first \u2013 and the only \u2013 input sound device in my computer.<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: Don\u2019t forget to replace the \u201c<b>1<\/b>\u201d number with the number of the input device that you want when you list the available audio input sources using the\u00a0<b>arecord -l<\/b>\u00a0command.<\/p>\n<p>To stop the recording, you may hit the \u201c<b>Ctrl + C<\/b>\u201d keys again.<\/p>\n<h3>Step 4: Start Audio Recording of Desktop<\/h3>\n<p><strong>6.<\/strong>\u00a0If you want to record the audio only, you may use the following command.<\/p>\n<pre>$ avconv -f alsa -i hw:1 <strong>out.wav<\/strong>\r\n<\/pre>\n<p><strong>7.<\/strong>\u00a0You may replace\u00a0<b>.mp3<\/b>\u00a0with any supported audio format by Libav, you can now play the\u00a0<b>out.wav<\/b>\u00a0using any mutlimedia player like VLC.<\/p>\n<div id=\"attachment_9645\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Audio.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9645\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Record-Desktop-Audio.png\" alt=\"Record Desktop Audio in Ubuntu\" width=\"572\" height=\"197\" aria-describedby=\"caption-attachment-9645\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9645\" class=\"wp-caption-text\">Record Desktop Audio<\/p>\n<\/div>\n<h3>Conclusion<\/h3>\n<p>\u201c<b>avconv<\/b>\u201d tool can be used to do many other things, not just to record the desktop\u2019s video and audio. For further usage and details about the \u201cavconv\u201d tool, you may visit the official guide at.<\/p>\n<p><a href=\"https:\/\/libav.org\/avconv.html\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/libav.org\/avconv.html<\/a><\/p>\n<p><b>Read Also<\/b>:\u00a0<a href=\"https:\/\/www.tecmint.com\/avconv-command-examples\/\" target=\"_blank\" rel=\"noopener\">10 Avconv Commands to Record and Convert Multimedia Files<\/a><\/p>\n<p>Have you used the \u201c<b>avconv<\/b>\u201d tool before to record your desktop? What do you think about it? Is there any other tools that you use to record your desktop? Share them with us in the comments.<\/p>\n<h1 class=\"post-title\">11 \u2018Avconv\u2019 Commands to Record, Convert and Extract Videos &amp; Audios from Linux Terminal<\/h1>\n<p>In the previous article, we talked about\u00a0<b>How to Record Desktop Video &amp; Audio Using \u2018Avconv\u2019 Tool<\/b>. We mentioned that there are many other ways of usage for the \u201c<b>avconv<\/b>\u201d tool to deal with multimedia streams and files.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/record-ubuntu-desktop-screen-using-avconv\/\" target=\"_blank\" rel=\"noopener\">Record Your Desktop Video and Audio Using \u2018Avconv\u2019 Command<\/a><\/li>\n<\/ol>\n<div id=\"attachment_9968\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Avconv-Command-Examples.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9968\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Avconv-Command-Examples.jpg\" alt=\"Avconv Command Examples\" width=\"600\" height=\"400\" aria-describedby=\"caption-attachment-9968\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9968\" class=\"wp-caption-text\">Avconv Command Examples<\/p>\n<\/div>\n<p>In this article we\u2019re going to discover the most important 10 commands to use with the \u201c<strong>avconv<\/strong>\u201d program.<\/p>\n<p>Just to make sure, you need to have the \u201c<b>avconv<\/b>\u201d tool installed in order to use, to install it under Debian\/Ubuntu\/Mint, run the following commands:<\/p>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get install libav-tools\r\n<\/pre>\n<h3>1. Get Video and Audio File Information<\/h3>\n<p>If you want to get some information about any multimedia file, run the following command using option \u2018-<strong>i<\/strong>\u2018 (information) with avcon command and input your audio or video file.<\/p>\n<pre>$ avconv -i Michael-Jackson-You-Rock-My-World-HD.mp4 \r\n\r\navconv version 11-6:11-1, Copyright (c) 2000-2014 the Libav developers\r\n  built on Sep 26 2014 14:34:54 with gcc 4.9.1 (Ubuntu 4.9.1-15ubuntu1)\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Michael-Jackson-You-Rock-My-World-HD.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: isommp42\r\n    creation_time   : 2013-12-04 15:45:45\r\n  Duration: 00:09:43.05, start: 0.000000, bitrate: 1898 kb\/s\r\n    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 1703 kb\/s, 29.97 fps, 60k tbn, 59.94 tbc (default)\r\n    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 192 kb\/s (default)\r\n    Metadata:\r\n      creation_time   : 2013-12-04 15:46:06\r\nAt least one output file must be specified\r\n<\/pre>\n<div id=\"attachment_9957\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Get-Multimedia-File-Info.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9957\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Get-Multimedia-File-Info-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Get-Multimedia-File-Info-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Get-Multimedia-File-Info-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Get-Multimedia-File-Info.jpeg 1440w\" alt=\"Get Multimedia File Info\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9957\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9957\" class=\"wp-caption-text\">Get Multimedia File Info<\/p>\n<\/div>\n<h3>2. Extract Audio from Video File<\/h3>\n<p>To extract the audio only from any video file, and to output it to another file, you may run the following command.<\/p>\n<pre>$ avconv -i Michael-Jackson-You-Rock-My-World-HD.mp4 -vn -f wav sound.wav\r\n<\/pre>\n<p>Some points about the above command:<\/p>\n<ol>\n<li>Don\u2019t forget to replace the input file name with your video file name.<\/li>\n<li><b>-vn<\/b>\u00a0is an option that we use to remove the video from the multimedia file.<\/li>\n<li><b>-f<\/b>\u00a0wav is the format we want our output file to use it, you can switch to \u201cmp3\u201d or \u201cwebm\u201d if you want.<\/li>\n<li><b>sound.wav<\/b>\u00a0is the name of the output file.<\/li>\n<\/ol>\n<div id=\"attachment_9958\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Audio-from-Video.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9958\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Audio-from-Video-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Audio-from-Video-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Audio-from-Video-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Audio-from-Video.jpeg 1440w\" alt=\"Extract Audio from Video\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9958\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9958\" class=\"wp-caption-text\">Extract Audio from Video<\/p>\n<\/div>\n<h3>3. Extract Video from Audio File<\/h3>\n<p>You can also extract the video only from a multimedia file that contains both video &amp; audio using the following command.<\/p>\n<pre>$ avconv -i You-Rock-My-World.avi -vcodec libx264 -an -f mp4 video.mp4\r\n<\/pre>\n<p>Description about the above command:<\/p>\n<ol>\n<li><b>-an<\/b>\u00a0is an option to drop the audio from the file.<\/li>\n<li><b>mp4<\/b>\u00a0is the format we want to use for our new file, you can change to \u201cmkv\u201d, \u201cogg\u201d.. etc, remember, you will have to change the \u201cvideo.mp4\u201d to \u201cvideo.mkv\u201d as well.<\/li>\n<\/ol>\n<div id=\"attachment_9959\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Video-From-Audio.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9959\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Video-From-Audio-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Video-From-Audio-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Video-From-Audio-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Extract-Video-From-Audio.jpeg 1440w\" alt=\"Extract Video from Audio in Linux\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9959\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9959\" class=\"wp-caption-text\">Extract Video from Audio<\/p>\n<\/div>\n<h3>4. Convert .avi to .mkv Format<\/h3>\n<p>To convert an\u00a0<b>.avi<\/b>\u00a0file to\u00a0<b>.mkv<\/b>\u00a0format, use the following command.<\/p>\n<pre>$ avconv -i You-Rock-My-World.avi -vcodec libx264 You-Rock-My-World.mkv\r\n<\/pre>\n<ol>\n<li><b>-i source-file.avi<\/b>\u00a0is the file that we want to convert (-i = -input).<\/li>\n<li><b>-vcodec<\/b>\u00a0is an option that we use to choose a video codec to use while processing the conversion, in our case it is \u201clibx264\u201d, this option is important in order to keep the video quality as it is.<\/li>\n<li><b>newfile.mkv<\/b>\u00a0is the output file name.<\/li>\n<\/ol>\n<div id=\"attachment_9960\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Avi-to-Mkv-Format.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9960\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Avi-to-Mkv-Format-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Avi-to-Mkv-Format-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Avi-to-Mkv-Format-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Avi-to-Mkv-Format.jpeg 1440w\" alt=\"Convert Avi to Mkv Format in Linux\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9960\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9960\" class=\"wp-caption-text\">Convert Avi to Mkv Format<\/p>\n<\/div>\n<h3>5. Convert .mp4 to avi Format<\/h3>\n<p>To convert n\u00a0<b>.mp4<\/b>\u00a0file to\u00a0<b>.avi<\/b>\u00a0format, run the following command.<\/p>\n<pre>$ avconv -i Michael-Jackson-You-Rock-My-World-HD.mp4 -vcodec libx264 newfile.avi\r\n<\/pre>\n<div id=\"attachment_9961\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp4-to-Avi.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9961\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp4-to-Avi-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp4-to-Avi-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp4-to-Avi-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp4-to-Avi.jpeg 1440w\" alt=\"Convert mp4 to Avi Format in Linux\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9961\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9961\" class=\"wp-caption-text\">Convert mp4 to Avi Format<\/p>\n<\/div>\n<h3>6. Convert .mp3 to .wav Format<\/h3>\n<p>Nothing new here.. We inputed a file, we outputted another \ud83d\ude42 Note that here, we don\u2019t have to use the\u00a0<b>-vcodec libx264<\/b>\u00a0option, because we\u2019re converting an audio file to another audio file, there\u2019s no video here.<\/p>\n<pre>$ avconv -i michael-jackson-dangerous.mp3 newfile.wav\r\n<\/pre>\n<div id=\"attachment_9962\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp3-to-wav.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9962\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp3-to-wav-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp3-to-wav-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp3-to-wav-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-mp3-to-wav.jpeg 1440w\" alt=\"Convert mp3 to wav Format in Linux\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9962\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9962\" class=\"wp-caption-text\">Convert mp3 to wav Format<\/p>\n<\/div>\n<h3>7. Convert .yuv to .avi Format<\/h3>\n<p>You can change the format depending on your needs in the previous commands if you want, make sure that the format you choose is supported by Libav.<\/p>\n<pre>$ avconv -i oldfile.yuv newfile.avi\r\n<\/pre>\n<h3>8. Merge Video and Audio Together<\/h3>\n<p>To merge a video file with an audio file together, run the following command.<\/p>\n<pre>$ avconv -i the-sound-file.wav -i the-video-file.avi the-output-file.mkv<\/pre>\n<p>You can replace \u201c<b>the-output-file.mkv<\/b>\u201d with \u201c<b>the-output-file.avi<\/b>\u201d or any other supported format by Libav (Don\u2019t ask me about it, try them all by yourself!).<\/p>\n<h3>9. Convert Video into Images<\/h3>\n<p>To convert a video file into several different images, you may run the following command.<\/p>\n<pre>$ avconv -i Michael-Jackson-You-Rock-My-World-HD.mp4 -r 1 -s 1366x768 -f image2 image-%03d.png\r\n<\/pre>\n<ol>\n<li><b>-r 1<\/b>: is the number of frames you want per image, the more it is, the more images are created.<\/li>\n<li><b>1366\u00d7768<\/b>: is the width and height you want for the images, you may replace it with any other size you want.<\/li>\n<li><b>image-%03d.png<\/b>: is the image name format, if you tried the command, it\u2019ll create many images like \u201cimage-001.png\u201d , \u201cimage-002.png\u201d.. etc, you can replace \u201cpng\u201d with \u201cjpg\u201d or \u201cjpeg\u201d if you like.<\/li>\n<\/ol>\n<div id=\"attachment_9963\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Video-into-Images.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9963\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Video-into-Images-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Video-into-Images-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Video-into-Images-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Convert-Video-into-Images.jpeg 1440w\" alt=\"Convert Video into Images\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9963\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9963\" class=\"wp-caption-text\">Convert Video into Images<\/p>\n<\/div>\n<div id=\"attachment_9964\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Video-Images.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9964\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Video-Images-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Video-Images-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Video-Images-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Video-Images.jpeg 1440w\" alt=\"Capture Images from Video\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-9964\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9964\" class=\"wp-caption-text\">Capture Images from Video<\/p>\n<\/div>\n<h3>10. More Options to use with Libav<\/h3>\n<p>In\u00a0<b>Libav<\/b>, there are an amazing things called \u201c<b>filters<\/b>\u201d, using filters, you can do many great things to your multimedia files. For example, take the following command.<\/p>\n<pre>$ avconv -i input-video.avi -vcodec libx264 -vf \"drawbox=x=50:y=50:width=400:height=300:color=red@0.5\" output-video.avi\r\n<\/pre>\n<ol>\n<li><b>-vf<\/b>: is an option to apply a video filter (If you want to use an audio filter, replace it with -af).<\/li>\n<li><b>drawbox=x=50:y=50:width=400:height=300:color=red@0.5<\/b>: Here we applied a filter called \u201cdrawbox\u201d which draws a red box with 400 width and 300 height at x=50 and y = 50.<\/li>\n<\/ol>\n<p>And here\u2019s the result of the above command.<\/p>\n<div id=\"attachment_9965\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Use-Filters.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9965\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Use-Filters-620x351.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Use-Filters-620x351.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Use-Filters-1024x581.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Use-Filters.jpeg 1309w\" alt=\"Use Filters with Libav\" width=\"620\" height=\"351\" aria-describedby=\"caption-attachment-9965\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9965\" class=\"wp-caption-text\">Use Filters<\/p>\n<\/div>\n<p>And take the following command for example,<\/p>\n<pre>$ avconv -i input-file.avi -vcodec libx264 -vf \"transpose=cclock\" output-file.avi\r\n<\/pre>\n<ol>\n<li><b>transpose=cclock<\/b>\u00a0is a video filter that rotates the video by 90 degree clockwise.<\/li>\n<\/ol>\n<p>Here\u2019s an image for what you\u2019ll get.<\/p>\n<div id=\"attachment_9966\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Rotate-Videos.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9966\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Rotate-Videos-620x353.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Rotate-Videos-620x353.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Rotate-Videos-1024x583.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/11\/Rotate-Videos.jpeg 1307w\" alt=\"Rotate Videos from Terminal\" width=\"620\" height=\"353\" aria-describedby=\"caption-attachment-9966\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9966\" class=\"wp-caption-text\">Rotate Videos<\/p>\n<\/div>\n<h3>11. Record tty as a Video<\/h3>\n<p>This command must be used by the root user, it won\u2019t work without sudo, because it requires access to the framebuffer device (fbdev).\u00a0<strong>fbdev<\/strong>\u00a0is the Linux framebuffer input device, this device is the responsible device for showing the graphics in the console.<\/p>\n<pre>$ sudo avconv -f fbdev -r 30 -i \/dev\/fb0 out.avi\r\n<\/pre>\n<ol>\n<li><b>* -r 30<\/b>: is the number of frames per second.<\/li>\n<li><b>* -i \/dev\/fb0<\/b>: is the running file device node, by using this option, we\u2019ll be able to capture the video from the tty.<\/li>\n<\/ol>\n<p>Amazing isn\u2019t? There are many other good filters to use with your multimedia files beside many other ways of usage for\u00a0<b>avconv<\/b>, you can check them all from the official documentation at<\/p>\n<p><a href=\"https:\/\/libav.org\/avconv.html\" target=\"\">Avconv Command Usage<\/a><\/p>\n<p>Have you tried the advance usage for Libav before? What do you think about it? Do you have any other important commands for avconv? Share them with us in the comments!<\/p>\n<p><a style=\"font-size: 1rem;\" href=\"https:\/\/www.tecmint.com\/record-ubuntu-desktop-screen-using-avconv\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Libav\u00a0is a set of cross-platform libraries and tools that are used to deal with multimedia files, streams and protocols, it was originally forked from the ffmpeg project. Libav includes many sub-tools like: Avplay: a video &amp; audio player. Avconv: a multimedia converter plus a video &amp; audio recorder from different sources. Avprobe: a tool that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-record-your-desktop-video-and-audio-using-avconv-tool-in-ubuntu\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Record Your Desktop Video and Audio Using \u201cAvconv\u201d Tool in Ubuntu&#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-12811","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\/12811","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=12811"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12811\/revisions"}],"predecessor-version":[{"id":12812,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12811\/revisions\/12812"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}