Use the avconv tool in Linux to record desktop videos and audios.

Source: Internet
Author: User
Tags linux mint

Use the avconv tool in Linux to record desktop videos and audios.

Libav is a cross-platform tool library that can be used to process multimedia files, streams, and protocols. It was originally originated from ffmpeg. Libav has some tools, such:

  • Avplay: A video/audio player.
  • Avconv: a multimedia converter and video/audio recorder that records multiple device input sources.
  • Avprobe: a tool that connects to a multimedia file stream and returns statistics about the file stream.
  • Libavfilter: A Libav tool's filtering API.

In this article, we will show you how to use the 'avconv' program to record Linux Desktop Video audio on the Debian/Ubuntu/Linux Mint release.

Install and configure the Ubuntu 10.04 screen recording software Xvidcap

Linux Tutorial: Xvidcap, a video recording software in Linux

Step 1: Download The Avconv Tool

1. avconv is part of "libav-tools" and can be downloaded from the official debian-based repository, such as Mint and Ubuntu. Enter the following command:

  1. $ Sudo apt-get update
  2. $ Sudo apt-get install libav-tools

Download Avconv Tool

Note: The 'avconv' version may be old if downloaded from the default repository. Therefore, we recommend that you pull the latest official git version.

  1. $ Sudo apt-get install yasm
  2. $ Git clone git: // git.libav.org/libav.git
  3. $ Cd libav
  4. $./Configure
  5. $ Make
  6. $ Sudo make install

Note: You should run './configure-help' to list all the optional configuration options and install the corresponding decoder and library. You still need to do a lot of work to solve the dependency problem.

Note that if you compile the tool from the source code, you must use sudo avconv instead of avconv to run the tool.

Step 2: Start recording desktop videos

2. Everything is ready. Now you can record your video by running the following command:

$ avconv -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 $HOME/output.avi

To briefly explain this command:

  • Avconv-f x11grab captures images from X service by default.
  • -R 25: This is the video frame rate you need. You can set it by yourself.
  • -S 1920 × 1080 is the desktop resolution of your system. It is very important to set it to the resolution of your current desktop.
  • -I: 0.0. Set the location to be recorded (X service output port.
  • -Vcodec libx264: the encoder used for video recording.
  • -Threads: 4 threads, which can be changed as needed.
  • The path of the target file output by $ HOME/output.
  • . Avi video formats can be changed to "flv", "mp4", "wmv", "mov", and "mkv.

3. After running the command, a process will be automatically run on terminal to record and press "Ctrl + C" to terminate the record.

Recording desktop videos

4. Now, you can use VLC or other players, or use the player "avplay" from the Libav package to play your recorded video.

  1. $ Avplay $ HOME/output. avi

Note: Do not forget to replace the output file path with your own. The recording effect is still very good.

Play recorded files

This is a video I recorded using "avconv". See the following.

Step 3: Start recording desktop audio and video

5. If you want to record audio at the same time, run this command to list all audio input sources:

  1. $ Arecord-l

The result is similar to the following:

Check the audio input source

Here, I only have one audio input source, so the number is 1, which is why I use the following command to capture the audio of my video and microphone.

  1. $ Avconv-f alsa-I hw: 1-f x11grab-r 25-s 1920x1080-i: 0.0-vcodec libx264-threads 4 output-file2.avi

I have modified some of them. Here is a brief explanation:

  • -F alsa: an option to capture sound from the alsa device.
  • -I hw: 1 is an option to capture audio from the hw: 1 device, which is the only audio input device on my computer.

Note: If you want to use a device other than 1 displayed by arecord-l, do not forget to replace "1 ".

End the recording and press Ctrl + C again.

Step 4: Start recording desktop audio

6. If you only want to record audio, use the following command.

  1. $ Avconv-f alsa-I hw: 1out.wav

7. Replace it with. mp3 and other formats supported by Libav. You can play out.wav to hear your own voice.

Recording desktop audio

Last

The "avconv" tool can be used to do many other things, not just to record desktop videos. For more tutorials and documents, go to the official website.

  • Https://libav.org/avconv.html

How have you experienced "avconv"? Have you used other tools to record desktop videos? Share it with us in the comments.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.