A tutorial on using Avconv for screen video under Linux

Source: Internet
Author: User

Libav is a Cross-platform tool library that can be used to process multimedia files, streams, and protocols. It was originally derived from FFmpeg. Libav with a few tools, such as:

Avplay: A video audio player.

Avconv: A multimedia converter and video audio recorder capable of recording multiple device input sources.

Avprobe: A tool that connects multimedia file streams and returns statistics about the flow of this file.

Libavfilter: A filter (filtering) API for a libav tool.

In this article, we'll show you how to record Linux desktop video audio through the ' Avconv ' program on the Debian/ubuntu/linux Mint release.

The first step: Download the Avconv tool

1. Avconv is part of the "Libav-tools", which can be downloaded through official Debian based warehouses, such as mint, Ubuntu. Enter the following command:

The code is as follows:

$ sudo apt-get update

$ sudo apt-get install Libav-tools

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

Also note that if you compile from source code, you need to run this tool using sudo avconv instead of avconv.

Step two: Start recording desktop video

2. All ready, you can now record your video by running the following command:

The code is as follows:

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

Briefly explain this command:

Avconv-f X11grab The default from the X service captures the screen.

-R 25 This is the video frame rate you need and you can set it yourself.

-S 1920x1080 is the desktop resolution of your system and it is important to set the resolution of your current desktop.

-i:0.0 we want to record the location (X service output port), set it to this.

-vcodec libx264 The encoder we use to record video.

The number of-threads 4 threads can be changed depending on the situation.

$HOME the destination file path for the/output output.

The video format used by Avi can be changed to "flv", "Mp4″", "wmv", "MOV", "MKV" and so on.

3. After the command is run, a process is automatically logged on the terminal and the "CTRL + C" key is pressed to terminate the record.

4. You can now use VLC or other players, or use the player "Avplay" from the LIBAV package to play the video you recorded.

The code is as follows:

$ avplay $HOME/output.avi

Note: Do not forget to replace the path of the output file for your own, the recording effect is very good.

Here's a video I recorded with "Avconv" (outside the wall).

Step three: Start recording audio and video from your desktop

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

The code is as follows:

$ arecord-l

The result looks something like this:

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

The code is as follows:

$ 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 the places below to make a short explanation:

-F alsa an option to capture sound from the ALSA device.

-I hw:1 is an option for capturing 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 the 1 displayed by Arecord-l, don't forget to replace "1".

End the recording, and then "Ctrl + C" is OK.

Fourth step: Start recording desktop audio

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

The code is as follows:

$ avconv-f alsa-i hw:1 out.wav

7. mp3 and other LIBAV support format can be, play out.wav can hear your own voice.

Note : For more wonderful tutorials, please pay attention to the triple graphics tutorial channel,

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.