mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
12be429b14
@ -1,131 +0,0 @@
|
||||
ggaaooppeenngg translating
|
||||
How to Record Your Desktop Video and Audio Using “Avconv” Tool in Ubuntu
|
||||
================================================================================
|
||||
**Libav** is 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 & audio player.
|
||||
- **Avconv**: a multimedia converter plus a video & audio recorder from different sources.
|
||||
- **Avprobe**: a tool that connects to the multimedia file stream and returns many useful information and statistics about it.
|
||||
- **Libavfilter**: a filtering API for different Libav tools.
|
||||
|
||||
In this article, we’ll explain how to record the Linux desktop’s video & audio using the ‘Avconv’ program on **Debian/Ubuntu/Linux Mint** distributions.
|
||||
|
||||
### Step 1: Installing Avconv Tool ###
|
||||
|
||||
**1.** **avconv** is a part from the “**libav-tools**” package, which is available to install from the official repositories for all Debian-based distributions like Ubuntu and Mint, using following commands.
|
||||
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install libav-tools
|
||||
|
||||
![Install Avconv Tool](http://www.tecmint.com/wp-content/uploads/2014/11/Install-avconv-tool.jpeg)
|
||||
|
||||
Install Avconv Tool
|
||||
|
||||
**Note**: Installing packages from default repositories, might give you a little older version of ‘**avconv**‘ tool. Thus, we recommend you to get the latest version from the official git repository, as shown below.
|
||||
|
||||
$ sudo apt-get install yasm
|
||||
$ git clone git://git.libav.org/libav.git
|
||||
$ cd libav
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
**Note**: You will have to run “**./configure –help**” 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.
|
||||
|
||||
Also note, if you’re used the compile-from-source way, you’ll always have to use “**sudo avconv**” instead of “**avconv**” to run the tool.
|
||||
|
||||
### Step 2: Start Video Recording of Desktop ###
|
||||
|
||||
**2.** You’re ready now, all what you have to do is to record your desktop video by issuing following command.
|
||||
|
||||
$ avconv -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 $HOME/output.avi
|
||||
|
||||
Now let’s explain the command in short:
|
||||
|
||||
- **avconv -f x11grab** is the default command to capture video from the X server.
|
||||
- **-r 25** is the frame rate you want, you may change it if you like.
|
||||
- **-s 1920×1080** is your system’s screen resolution, change it to your current system resolution, it’s very important to do this.
|
||||
- **-i :0.0** is where we want to set our recording start point, leave it like this.
|
||||
- **-vcodec libx264** is the video codec that we’re using to record the desktop.
|
||||
- **-threads 4** is the number of threads, you may change it as well if you like.
|
||||
- **$HOME/output** is the destination path where you want to save the file.
|
||||
- **.avi** is the video format, you may change it to “flv”, “mp4″, “wmv”, “mov”, “mkv”.
|
||||
|
||||
**3.** After you enter the command, the recording will start automatically as a process running from the terminal, in order to stop it, hit “Ctrl + C” keys inside the terminal window.
|
||||
|
||||
![Record Desktop Screen](http://www.tecmint.com/wp-content/uploads/2014/11/Record-Desktop-Screen.jpeg)
|
||||
|
||||
Record Desktop Screen
|
||||
|
||||
**4.** Now, you may run the file using VLC or any other multimedia player, or you may run it using “avplay” tool which is a multimedia player from the same Libav package.
|
||||
|
||||
$ avplay $HOME/output.avi
|
||||
|
||||
**Note:** Don’t forget to replace the destination file path. The recording’s quality is pretty good.
|
||||
|
||||
![Play Recorded Video](http://www.tecmint.com/wp-content/uploads/2014/11/Play-Recorded-Video.jpeg)
|
||||
|
||||
Play Recorded Video
|
||||
|
||||
Here’s a video that I’ve recorded using the “**avconv**” tool.
|
||||
|
||||
注:youtube 地址,发布的时候不行做个链接
|
||||
<iframe width="640" height="380" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/g1FEh4wByGE"></iframe>
|
||||
|
||||
### Step 3: Start Video & Audio Recording of Desktop ###
|
||||
|
||||
**5.** If you want to record the audio as well, first run this command to list all the available input sources for the audio.
|
||||
|
||||
$ arecord -l
|
||||
|
||||
It will give you some output like this.
|
||||
|
||||
![Check Audio Input](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Audio-Input.png)
|
||||
|
||||
Check Audio Input
|
||||
|
||||
In my case, I’ve one input source for audio only, and its number is “**1**”, that’s why I am going to use the following command to capture both video & microphone audio.
|
||||
|
||||
$ avconv -f alsa -i hw:1 -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 output-file2.avi
|
||||
|
||||
You see that part which is colored in yellow? It’s the only modification that I did for the command. Now let’s explain the command in short:
|
||||
|
||||
- **-f** alsa is an option to capture the sound from the alsa device.
|
||||
- **-i** hw:1 is an option to take the audio input source from the “hw:1” device which is the first – and the only – input sound device in my computer.
|
||||
|
||||
**Note**: Don’t forget to replace the “**1**” number with the number of the input device that you want when you list the available audio input sources using the **arecord -l** command.
|
||||
|
||||
To stop the recording, you may hit the “**Ctrl + C**” keys again.
|
||||
|
||||
### Step 4: Start Audio Recording of Desktop ###
|
||||
|
||||
**6.** If you want to record the audio only, you may use the following command.
|
||||
|
||||
$ avconv -f alsa -i hw:1 out.wav
|
||||
|
||||
**7.** You may replace **.mp3** with any supported audio format by Libav, you can now play the **out.wav** using any mutlimedia player like VLC.
|
||||
|
||||
![Record Desktop Audio](http://www.tecmint.com/wp-content/uploads/2014/11/Record-Desktop-Audio.png)
|
||||
|
||||
Record Desktop Audio
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
“**avconv**” tool can be used to do many other things, not just to record the desktop’s video and audio. For further usage and details about the “avconv” tool, you may visit the official guide at.
|
||||
|
||||
- [https://libav.org/avconv.html][1]
|
||||
|
||||
Have you used the “avconv” 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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/record-ubuntu-desktop-screen-using-avconv/
|
||||
|
||||
作者:[Hanny Helal][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/hannyhelal/
|
||||
[1]:https://libav.org/avconv.html
|
@ -0,0 +1,129 @@
|
||||
用"Avconv"工具录制你的桌面视频和音频
|
||||
================================================================================
|
||||
**Libav**是一款跨平台的工具库,能够用来处理多媒体文件,流和协议,最初是fork自ffmpeg.Libav包含了子工具,比如:
|
||||
|
||||
- **Avplay**: 一款视频音频播放器.
|
||||
- **Avconv**: 能够记录多个设备输入源的一个多媒体转换器和视频音频录制器.
|
||||
- **Avprobe**: 一个连接多媒体文件流并且返回关于这个文件流的统计信息的工具.
|
||||
- **Libavfilter**:一个Libav工具的过滤器(filtering)API.
|
||||
|
||||
接下来,我们就要展示如何通过'Avconv'程序在**Debian/Ubuntu/Linux Mint**发行版上录制Linux桌面视频音频.
|
||||
### 步奏 1:下载 Avconv 工具 ###
|
||||
|
||||
**1.** **avconv**是 “**libav-tools**” 的一部分, 可以通过官方的基于debian的仓库下载,比如Mint,Ubuntu.输入下面命令即可:
|
||||
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install libav-tools
|
||||
|
||||
![Install Avconv Tool](http://www.tecmint.com/wp-content/uploads/2014/11/Install-avconv-tool.jpeg)
|
||||
|
||||
下载Avconv工具
|
||||
|
||||
**注意**: 如果从默认仓库下载的话 ‘**avconv**‘ 的版本可能比较老. 因此我们推荐你拉取最新的git官方版本.
|
||||
|
||||
$ sudo apt-get install yasm
|
||||
$ git clone git://git.libav.org/libav.git
|
||||
$ cd libav
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
**注意**: 你必须运行 “**./configure –help**” 去列出所有的可选配置选项并且安装相应的解码器和库,你还需要做很多去下载依赖.
|
||||
同样注意,如果你是从源代码编译的,就需要使用**sudo avconv**而不是**avconv**来运行这个工具.
|
||||
|
||||
### 步奏 2:开启桌面录制 ###
|
||||
|
||||
**2.**你已经准备好了,现在可以通过运行下面的命令录制你的视频了:
|
||||
|
||||
$ avconv -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 $HOME/output.avi
|
||||
|
||||
简单解释一下这个命令:
|
||||
|
||||
- **avconv -f x11grab** 默认从x服务捕捉画面.
|
||||
- **-r 25** 这是视频的帧率,可以自行设置.
|
||||
- **-s 1920×1080** 是你的画面分辨率,要设置成你当前画面的分辨率,这一点非常重要.
|
||||
- **-i :0.0** 记录的起点,设置成这样就可以了.
|
||||
- **-vcodec libx264** 我们用来录制视频的解码器.
|
||||
- **-threads 4**线程数, 可以根据情况更改.
|
||||
- **$HOME/output** 目标文件路径.
|
||||
- **.avi**视频格式,可以转换成 “flv”, “mp4″, “wmv”, “mov”, “mkv”.
|
||||
|
||||
**3.**在运行命令之后,录像机就会打开,并且在terminal上自动运行,按"Ctrl+C"建来终止.
|
||||
|
||||
![Record Desktop Screen](http://www.tecmint.com/wp-content/uploads/2014/11/Record-Desktop-Screen.jpeg)
|
||||
|
||||
录制桌面视频
|
||||
|
||||
**4.** 你可能需要使用VLC或者其他的播放器,或者你需要使用"avplay",这是一个Libav包里的播放器.
|
||||
|
||||
$ avplay $HOME/output.avi
|
||||
|
||||
**注意:** 别忘了替换输出文件的路径,录制效果还是很好的.
|
||||
|
||||
![Play Recorded Video](http://www.tecmint.com/wp-content/uploads/2014/11/Play-Recorded-Video.jpeg)
|
||||
|
||||
播放录制的文件
|
||||
|
||||
这有一段我用 “**avconv**” 录制的视频.
|
||||
|
||||
[视频地址](http://www.youtube.com/embed/g1FEh4wByGE)
|
||||
|
||||
<iframe width="640" height="380" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/g1FEh4wByGE"></iframe>
|
||||
|
||||
### 步奏 3: 开始桌面音频和视频录制 ###
|
||||
|
||||
**5.** 如果想录制音频,先运行这个命令,列出所有的音频输入源:
|
||||
|
||||
$ arecord -l
|
||||
|
||||
如果结果是这样的
|
||||
|
||||
![Check Audio Input](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Audio-Input.png)
|
||||
|
||||
检查音频输入源
|
||||
|
||||
在我的例子中,我只有一个音频输入源,所以数量是**1**,这就是为什么我使用下面的命令来捕捉我的视频以及麦克风的音频了.
|
||||
|
||||
$ avconv -f alsa -i hw:1 -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 output-file2.avi
|
||||
|
||||
看黄色的部分:那是我修改了的地方,下面做个简短的解释:
|
||||
- **-f** alsa 一个从alsa设备捕捉声音的选项.
|
||||
- **-i** hw:1 是一个从 “hw:1” 设备捕捉画面的选项,这个设备是我电脑上仅有的一个设备.
|
||||
|
||||
**注意**: 别忘了替换 “**1**”,如果你想用**arecord -l**显示的**1**之外的设备的话.
|
||||
|
||||
结束录制, 再来一次“**Ctrl + C**” 就可以.
|
||||
|
||||
### 步奏 4:开始桌面音频的录制 ###
|
||||
|
||||
**6.** 如果只想录制音频的话,使用下面的命令.
|
||||
|
||||
$ avconv -f alsa -i hw:1 out.wav
|
||||
|
||||
**7.** 替换成 **.mp3** Libav支持的格式都可以,播放 **out.wav**就能听到你自己的声音了
|
||||
|
||||
![Record Desktop Audio](http://www.tecmint.com/wp-content/uploads/2014/11/Record-Desktop-Audio.png)
|
||||
|
||||
录制桌面音频
|
||||
|
||||
###最后 ###
|
||||
|
||||
“**avconv**” 工具可以用来做很多其他事情,不仅仅是录制桌面视频,更多的教程和文档请移步到官网.
|
||||
|
||||
- [https://libav.org/avconv.html][1]
|
||||
|
||||
你对"avconv"的体验如何,你使用过其他工具录制桌面视频么?在评论里面和我们分享吧.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/record-ubuntu-desktop-screen-using-avconv/
|
||||
|
||||
作者:[Hanny Helal][a]
|
||||
译者:[ggaaooppeenngg](https://github.com/ggaaooppeenngg)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/hannyhelal/
|
||||
[1]:https://libav.org/avconv.html
|
Loading…
Reference in New Issue
Block a user