mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
d7e5984260
@ -1,27 +1,29 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10921-1.html)
|
||||
[#]: subject: (Be your own certificate authority)
|
||||
[#]: via: (https://opensource.com/article/19/4/certificate-authority)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez/users/elenajon123)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez/users/elenajon123)
|
||||
|
||||
|
||||
自己成为证书颁发机构
|
||||
自己成为一个证书颁发机构(CA)
|
||||
======
|
||||
为你的微服务架构或者集成测试创建一个简单的内部 CA
|
||||
![][1]
|
||||
|
||||
传输层安全([TLS][2])模型,有时也称它的旧名称 SSL,是基于[证书颁发机构][3] (CA) 的概念。这些机构受到浏览器和操作系统的信任,然后_签名_服务器的的证书则用于验证其所有权。
|
||||
> 为你的微服务架构或者集成测试创建一个简单的内部 CA。
|
||||
|
||||
但是,对于内部网络,微服务架构或集成测试,有时候_本地 CA_ 更有用:一个只在内部受信任的CA,然后签名本地服务器的证书。
|
||||
![](https://img.linux.net.cn/data/attachment/album/201905/31/091023sg9s0ss11rsoseqg.jpg)
|
||||
|
||||
这对集成测试特别有意义。获取证书可能会带来负担,因为这会占用服务器几分钟。但是在代码中使用“忽略证书”可能会引入生产环境,从而导致安全灾难。
|
||||
传输层安全([TLS][2])模型(有时也称它的旧名称 SSL)基于<ruby>[证书颁发机构][3]<rt>certificate authoritie</rt></ruby>(CA)的概念。这些机构受到浏览器和操作系统的信任,从而*签名*服务器的的证书以用于验证其所有权。
|
||||
|
||||
CA 证书与常规服务器证书没有太大区别。重要的是它被本地代码信任。例如,在 **requests** 库中,可以通过将 **REQUESTS_CA_BUNDLE** 变量设置为包含此证书的目录来完成。
|
||||
但是,对于内部网络,微服务架构或集成测试,有时候*本地 CA*更有用:一个只在内部受信任的 CA,然后签名本地服务器的证书。
|
||||
|
||||
在为集成测试创建证书的例子中,不需要_长期的_证书:如果你的集成测试需要超过一天,那么你会失败。
|
||||
这对集成测试特别有意义。获取证书可能会带来负担,因为这会占用服务器几分钟。但是在代码中使用“忽略证书”可能会被引入到生产环境,从而导致安全灾难。
|
||||
|
||||
CA 证书与常规服务器证书没有太大区别。重要的是它被本地代码信任。例如,在 Python `requests` 库中,可以通过将 `REQUESTS_CA_BUNDLE` 变量设置为包含此证书的目录来完成。
|
||||
|
||||
在为集成测试创建证书的例子中,不需要*长期的*证书:如果你的集成测试需要超过一天,那么你应该已经测试失败了。
|
||||
|
||||
因此,计算**昨天**和**明天**作为有效期间隔:
|
||||
|
||||
@ -33,7 +35,7 @@ CA 证书与常规服务器证书没有太大区别。重要的是它被本地
|
||||
>>> tomorrow = today - one_day
|
||||
```
|
||||
|
||||
现在你已准备好创建一个简单的 CA 证书。你需要生成私钥,创建公钥,设置 CA 的“参数”,然后自签名证书:CA 证书_总是_自签名的。最后,导出证书文件以及私钥文件。
|
||||
现在你已准备好创建一个简单的 CA 证书。你需要生成私钥,创建公钥,设置 CA 的“参数”,然后自签名证书:CA 证书*总是*自签名的。最后,导出证书文件以及私钥文件。
|
||||
|
||||
```
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
@ -78,9 +80,9 @@ with open("ca.crt", "wb") as fout:
|
||||
fout.write(public_bytes)
|
||||
```
|
||||
|
||||
通常,真正的 CA 会有[证书签名请求][4] (CSR) 来签名证书。但是,当你是自己的 CA 时,你可以制定自己的规则!请继续并签名你想要的内容。
|
||||
通常,真正的 CA 会需要[证书签名请求][4](CSR)来签名证书。但是,当你是自己的 CA 时,你可以制定自己的规则!可以径直签名你想要的内容。
|
||||
|
||||
继续集成测试的例子,你可以创建私钥并立即签名相应的公钥。注意 **COMMON_NAME** 需要是 **https** URL 中的“服务器名称”。如果你已配置名称查询,则相应的服务器会响应 **service.test.local**。
|
||||
继续集成测试的例子,你可以创建私钥并立即签名相应的公钥。注意 `COMMON_NAME` 需要是 `https` URL 中的“服务器名称”。如果你已配置名称查询,你需要服务器能响应对 `service.test.local` 的请求。
|
||||
|
||||
```
|
||||
service_private_key = rsa.generate_private_key(
|
||||
@ -110,7 +112,7 @@ with open("service.pem", "wb") as fout:
|
||||
fout.write(private_bytes + public_bytes)
|
||||
```
|
||||
|
||||
现在 **service.pem** 文件有一个私钥和一个“有效”的证书:它已由本地的 CA 签名。该文件的格式可以给 Nginx、HAProxy 或大多数其他 HTTPS 服务器使用。
|
||||
现在 `service.pem` 文件有一个私钥和一个“有效”的证书:它已由本地的 CA 签名。该文件的格式可以给 Nginx、HAProxy 或大多数其他 HTTPS 服务器使用。
|
||||
|
||||
通过将此逻辑用在测试脚本中,只要客户端配置信任该 CA,那么就可以轻松创建看起来真实的 HTTPS 服务器。
|
||||
|
||||
@ -118,10 +120,10 @@ with open("service.pem", "wb") as fout:
|
||||
|
||||
via: https://opensource.com/article/19/4/certificate-authority
|
||||
|
||||
作者:[Moshe Zadka (Community Moderator)][a]
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,34 +1,34 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10919-1.html)
|
||||
[#]: subject: (Installing Budgie Desktop on Ubuntu [Quick Guide])
|
||||
[#]: via: (https://itsfoss.com/install-budgie-ubuntu/)
|
||||
[#]: author: (Atharva Lele https://itsfoss.com/author/atharva/)
|
||||
|
||||
在 Ubuntu 上安装 Budgie 桌面 [快速指南]
|
||||
在 Ubuntu 上安装 Budgie 桌面
|
||||
======
|
||||
|
||||
_ **简介:在这一步步的教程中学习如何在 Ubuntu 上安装 Budgie 桌面。** _
|
||||
> 在这个逐步的教程中学习如何在 Ubuntu 上安装 Budgie 桌面。
|
||||
|
||||
在所有[各种 Ubuntu 版本][1]中,[Ubuntu Budgie][2] 是最被低估的版本。它看起来很优雅,而且需要的资源也不多。
|
||||
在所有[各种 Ubuntu 版本][1]中,[Ubuntu Budgie][2] 是最被低估的版本。它外观优雅,而且需要的资源也不多。
|
||||
|
||||
阅读这篇 [Ubuntu Budgie 的评论][3]或观看此视频,了解 Ubuntu Budgie 18.04 的外观。
|
||||
阅读这篇 《[Ubuntu Budgie 点评][3]》或观看下面的视频,了解 Ubuntu Budgie 18.04 的外观如何。
|
||||
|
||||
[Subscribe to our YouTube channel for more Linux Videos][4]
|
||||
- [Ubuntu 18.04 Budgie Desktop Tour [It's Elegant]](https://youtu.be/KXgreWOK33k)
|
||||
|
||||
如果你喜欢 [Budgie 桌面][5]但你正在使用其他版本的 Ubuntu,例如默认的 GNOME 桌面的 Ubuntu,我有个好消息。你可以在当前的 Ubuntu 系统上安装 Budgie 并切换桌面环境。
|
||||
如果你喜欢 [Budgie 桌面][5]但你正在使用其他版本的 Ubuntu,例如默认 Ubuntu 带有 GNOME 桌面,我有个好消息。你可以在当前的 Ubuntu 系统上安装 Budgie 并切换桌面环境。
|
||||
|
||||
在这篇文章中,我将告诉你到底该怎么做。但首先,对那些不了解 Budgie 的人进行一点介绍。
|
||||
|
||||
Budgie 桌面环境主要由 [Solus Linux 团队开发][6]。它的设计注重优雅和现代使用。Budgie 适用于所有主流 Linux 发行版,供用户尝试体验这种新的桌面环境。Budgie 现在非常成熟,并提供了出色的桌面体验。
|
||||
Budgie 桌面环境主要由 [Solus Linux 团队开发][6]。它的设计注重优雅和现代使用。Budgie 适用于所有主流 Linux 发行版,可以让用户在其上尝试体验这种新的桌面环境。Budgie 现在非常成熟,并提供了出色的桌面体验。
|
||||
|
||||
警告
|
||||
|
||||
在同一系统上安装多个桌面可能会导致冲突,你可能会遇到一些问题,如面板中缺少图标或同一程序的多个图标。
|
||||
|
||||
你也许不会遇到任何问题。是否要尝试不同桌面由你决定。
|
||||
> 警告
|
||||
>
|
||||
> 在同一系统上安装多个桌面可能会导致冲突,你可能会遇到一些问题,如面板中缺少图标或同一程序的多个图标。
|
||||
>
|
||||
> 你也许不会遇到任何问题。是否要尝试不同桌面由你决定。
|
||||
|
||||
### 在 Ubuntu 上安装 Budgie
|
||||
|
||||
@ -55,23 +55,19 @@ sudo apt install ubuntu-budgie-desktop
|
||||
|
||||
![Budgie login screen][9]
|
||||
|
||||
你可以单击登录名旁边的 Budgie 图标获取登录选项。在那里,你可以在已安装的桌面环境 (DE) 之间进行选择。就我而言,我看到了 Budgie 和默认的 Ubuntu(GNOME)桌面。
|
||||
你可以单击登录名旁边的 Budgie 图标获取登录选项。在那里,你可以在已安装的桌面环境(DE)之间进行选择。就我而言,我看到了 Budgie 和默认的 Ubuntu(GNOME)桌面。
|
||||
|
||||
![Select your DE][10]
|
||||
|
||||
因此,无论何时你想登录 GNOME,都可以使用此菜单执行此操作。
|
||||
|
||||
[][11]
|
||||
|
||||
建议阅读:在 Ubuntu中 摆脱 “snapd returned status code 400: Bad Request” 错误。
|
||||
|
||||
### 如何删除 Budgie
|
||||
|
||||
如果你不喜欢 Budgie 或只是想回到常规的以前的 Ubuntu,你可以如上节所述切换回常规桌面。
|
||||
|
||||
但是,如果你真的想要删除 Budgie 及其组件,你可以按照以下命令回到之前的状态。
|
||||
|
||||
_ **在使用这些命令之前先切换到其他桌面环境:** _
|
||||
**在使用这些命令之前先切换到其他桌面环境:**
|
||||
|
||||
```
|
||||
sudo apt remove ubuntu-budgie-desktop ubuntu-budgie* lightdm
|
||||
@ -83,7 +79,7 @@ sudo apt install --reinstall gdm3
|
||||
|
||||
现在,你将回到 GNOME 或其他你有的桌面。
|
||||
|
||||
**你对Budgie有什么看法?**
|
||||
### 你对 Budgie 有什么看法?
|
||||
|
||||
Budgie 是[最佳 Linux 桌面环境][12]之一。希望这个简短的指南帮助你在 Ubuntu 上安装了很棒的 Budgie 桌面。
|
||||
|
||||
@ -96,7 +92,7 @@ via: https://itsfoss.com/install-budgie-ubuntu/
|
||||
作者:[Atharva Lele][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,146 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 projects for Raspberry Pi at home)
|
||||
[#]: via: (https://opensource.com/article/17/4/5-projects-raspberry-pi-home)
|
||||
[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall)
|
||||
|
||||
5 projects for Raspberry Pi at home
|
||||
======
|
||||
|
||||
![5 projects for Raspberry Pi at home][1]
|
||||
|
||||
The [Raspberry Pi][2] computer can be used in all kinds of settings and for a variety of purposes. It obviously has a place in education for helping students with learning programming and maker skills in the classroom and the hackspace, and it has plenty of industrial applications in the workplace and in factories. I'm going to introduce five projects you might want to build in your own home.
|
||||
|
||||
### Media center
|
||||
|
||||
One of the most common uses for Raspberry Pi in people's homes is behind the TV running media center software serving multimedia files. It's easy to set this up, and the Raspberry Pi provides plenty of GPU (Graphics Processing Unit) power to render HD TV shows and movies to your big screen TV. [Kodi][3] (formerly XBMC) on a Raspberry Pi is a great way to playback any media you have on a hard drive or network-attached storage. You can also install a plugin to play YouTube videos.
|
||||
|
||||
There are a few different options available, most prominently [OSMC][4] (Open Source Media Center) and [LibreELEC][5], both based on Kodi. They both perform well at playing media content, but OSMC has a more visually appearing user interface, while LibreElec is much more lightweight. All you have to do is choose a distribution, download the image and install on an SD card (or just use [NOOBS][6]), boot it up, and you're ready to go.
|
||||
|
||||
![LibreElec ][7]
|
||||
|
||||
LibreElec; Raspberry Pi Foundation, CC BY-SA
|
||||
|
||||
![OSMC][8]
|
||||
|
||||
OSMC.tv, Copyright, Used with permission
|
||||
|
||||
Before proceeding you'll need to decide [w][9][hich Raspberry Pi model to use][9]. These distributions will work on any Pi (1, 2, 3, or Zero), and video playback will essentially be matched on each of these. Apart from the Pi 3 (and Zero W) having built-in Wi-Fi, the only noticeable difference is the reaction speed of the user interface, which will be much faster on a Pi 3. A Pi 2 will not be much slower, so that's fine if you don't need Wi-Fi, but the Pi 3 will noticeably outperform the Pi 1 and Zero when it comes to flicking through the menus.
|
||||
|
||||
### SSH gateway
|
||||
|
||||
If you want to be able to access computers and devices on your home network from outside over the internet, you have to open up ports on those devices to allow outside traffic. Opening ports to the internet is a security risk, meaning you're always at risk of attack, misuse, or any kind of unauthorized access. However, if you install a Raspberry Pi on your network and set up port forwarding to allow only SSH access to that Pi, you can use that as a secure gateway to hop onto other Pis and PCs on the network.
|
||||
|
||||
Most routers allow you to configure port-forwarding rules. You'll need to give your Pi a fixed internal IP address and set up port 22 on your router to map to port 22 on your Raspberry Pi. If your ISP provides you with a static IP address, you'll be able to SSH into it with this as the host address (for example, **ssh pi@123.45.56.78** ). If you have a domain name, you can configure a subdomain to point to this IP address, so you don't have to remember it (for example, **ssh[pi@home.mydomain.com][10]** ).
|
||||
|
||||
![][11]
|
||||
|
||||
However, if you're going to expose a Raspberry Pi to the internet, you should be very careful not to put your network at risk. There are a few simple procedures you can follow to make it sufficiently secure:
|
||||
|
||||
1\. Most people suggest you change your login password (which makes sense, seeing as the default password “raspberry” is well known), but this does not protect against brute-force attacks. You could change your password and add a two-factor authentication (so you need your password _and_ a time-dependent passcode generated by your phone), which is more secure. However, I believe the best way to secure your Raspberry Pi from intruders is to [disable][12] [“password authentication”][12] in your SSH configuration, so you allow only SSH key access. This means that anyone trying to SSH in by guessing your password will never succeed. Only with your private SSH key can anyone gain access. Similarly, most people suggest changing the SSH port from the default 22 to something unexpected, but a simple [Nmap][13] of your IP address will reveal your true SSH port.
|
||||
|
||||
2\. Ideally, you would not run much in the way of other software on this Pi, so you don't end up accidentally exposing anything else. If you want to run other software, you might be better running it on another Pi on the network that is not exposed to the internet. Ensure that you keep your packages up to date by upgrading regularly, particularly the **openssh-server** package, so that any security vulnerabilities are patched.
|
||||
|
||||
3\. Install [sshblack][14] or [fail2ban][15] to blacklist any users who seem to be acting maliciously, such as attempting to brute force your SSH password.
|
||||
|
||||
Once you've secured your Raspberry Pi and put it online, you'll be able to log in to your network from anywhere in the world. Once you're on your Raspberry Pi, you can SSH into other devices on the network using their local IP address (for example, 192.168.1.31). If you have passwords on these devices, just use the password. If they're also SSH-key-only, you'll need to ensure your key is forwarded over SSH by using the **-A** flag: **ssh -A pi@123.45.67.89**.
|
||||
|
||||
### CCTV / pet camera
|
||||
|
||||
Another great home project is to set up a camera module to take photos or stream video, capture and save files, or streamed internally or to the internet. There are many reasons you might want to do this, but two common use cases are for a homemade security camera or to monitor a pet.
|
||||
|
||||
The [Raspberry Pi camera module][16] is a brilliant accessory. It provides full HD photo and video, lots of advanced configuration, and is [easy to][17] [program][17]. The [infrared camera][18] is ideal for this kind of use, and with an infrared LED (which the Pi can control) you can see in the dark!
|
||||
|
||||
If you want to take still images on a regular basis to keep an eye on things, you can just write a short [Python][19] script or use the command line tool [raspistill][20], and schedule it to recur in [Cron][21]. You might want to have it save them to [Dropbox][22] or another web service, upload them to a web server, or you can even create a [web app][23] to display them.
|
||||
|
||||
If you want to stream video, internally or externally, that's really easy, too. A simple MJPEG (Motion JPEG) example is provided in the [picamera documentation][24] (under “web streaming”). Just download or copy that code into a file, run it and visit the Pi's IP address at port 8000, and you'll see your camera's output live.
|
||||
|
||||
A more advanced streaming project, [pistreaming][25], is available, which uses [JSMpeg][26] (a JavaScript video player) with the web server and a websocket for the camera stream running separately. This method is more performant and is just as easy to get running as the previous example, but there is more code involved and if set up to stream on the internet, requires you to open two ports.
|
||||
|
||||
Once you have web streaming set up, you can position the camera where you want it. I have one set up to keep an eye on my pet tortoise:
|
||||
|
||||
![Tortoise ][27]
|
||||
|
||||
Ben Nuttall, CC BY-SA
|
||||
|
||||
If you want to be able to control where the camera actually points, you can do so using servos. A neat solution is to use Pimoroni's [Pan-Tilt HAT][28], which allows you to move the camera easily in two dimensions. To integrate this with pistreaming, see the project's [pantilthat branch][29].
|
||||
|
||||
![Pan-tilt][30]
|
||||
|
||||
Pimoroni.com, Copyright, Used with permission
|
||||
|
||||
If you want to position your Pi outside, you'll need a waterproof enclosure and some way of getting power to the Pi. PoE (Power-over-Ethernet) cables can be a good way of achieving this.
|
||||
|
||||
### Home automation and IoT
|
||||
|
||||
It's 2017 and there are internet-connected devices everywhere, especially in the home. Our lightbulbs have Wi-Fi, our toasters are smarter than they used to be, and our tea kettles are at risk of attack from Russia. As long as you keep your devices secure, or don't connect them to the internet if they don't need to be, then you can make great use of IoT devices to automate tasks around the home.
|
||||
|
||||
There are plenty of services you can buy or subscribe to, like Nest Thermostat or Philips Hue lightbulbs, which allow you to control your heating or your lighting from your phone, respectively—whether you're inside or away from home. You can use a Raspberry Pi to boost the power of these kinds of devices by automating interactions with them according to a set of rules involving timing or even sensors. One thing you can't do with Philips Hue is have the lights come on when you enter the room, but with a Raspberry Pi and a motion sensor, you can use a Python API to turn on the lights. Similarly, you can configure your Nest to turn on the heating when you're at home, but what if you only want it to turn on if there's at least two people home? Write some Python code to check which phones are on the network and if there are at least two, tell the Nest to turn on the heat.
|
||||
|
||||
You can do a great deal more without integrating with existing IoT devices and with only using simple components. A homemade burglar alarm, an automated chicken coop door opener, a night light, a music box, a timed heat lamp, an automated backup server, a print server, or whatever you can imagine.
|
||||
|
||||
### Tor proxy and blocking ads
|
||||
|
||||
Adafruit's [Onion Pi][31] is a [Tor][32] proxy that makes your web traffic anonymous, allowing you to use the internet free of snoopers and any kind of surveillance. Follow Adafruit's tutorial on setting up Onion Pi and you're on your way to a peaceful anonymous browsing experience.
|
||||
|
||||
![Onion-Pi][33]
|
||||
|
||||
Onion-pi from Adafruit, Copyright, Used with permission
|
||||
|
||||
![Pi-hole][34]You can install a Raspberry Pi on your network that intercepts all web traffic and filters out any advertising. Simply download the [Pi-hole][35] software onto the Pi, and all devices on your network will be ad-free (it even blocks in-app ads on your mobile devices).
|
||||
|
||||
There are plenty more uses for the Raspberry Pi at home. What do you use Raspberry Pi for at home? What do you want to use it for?
|
||||
|
||||
Let us know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/4/5-projects-raspberry-pi-home
|
||||
|
||||
作者:[Ben Nuttall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/bennuttall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry_pi_home_automation.png?itok=2TnmJpD8 (5 projects for Raspberry Pi at home)
|
||||
[2]: https://www.raspberrypi.org/
|
||||
[3]: https://kodi.tv/
|
||||
[4]: https://osmc.tv/
|
||||
[5]: https://libreelec.tv/
|
||||
[6]: https://www.raspberrypi.org/downloads/noobs/
|
||||
[7]: https://opensource.com/sites/default/files/libreelec_0.png (LibreElec )
|
||||
[8]: https://opensource.com/sites/default/files/osmc.png (OSMC)
|
||||
[9]: https://opensource.com/life/16/10/which-raspberry-pi-should-you-choose-your-project
|
||||
[10]: mailto:pi@home.mydomain.com
|
||||
[11]: https://opensource.com/sites/default/files/resize/screenshot_from_2017-04-07_15-13-01-700x380.png
|
||||
[12]: http://stackoverflow.com/questions/20898384/ssh-disable-password-authentication
|
||||
[13]: https://nmap.org/
|
||||
[14]: http://www.pettingers.org/code/sshblack.html
|
||||
[15]: https://www.fail2ban.org/wiki/index.php/Main_Page
|
||||
[16]: https://www.raspberrypi.org/products/camera-module-v2/
|
||||
[17]: https://opensource.com/life/15/6/raspberry-pi-camera-projects
|
||||
[18]: https://www.raspberrypi.org/products/pi-noir-camera-v2/
|
||||
[19]: http://picamera.readthedocs.io/
|
||||
[20]: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md
|
||||
[21]: https://www.raspberrypi.org/documentation/linux/usage/cron.md
|
||||
[22]: https://github.com/RZRZR/plant-cam
|
||||
[23]: https://github.com/bennuttall/bett-bot
|
||||
[24]: http://picamera.readthedocs.io/en/release-1.13/recipes2.html#web-streaming
|
||||
[25]: https://github.com/waveform80/pistreaming
|
||||
[26]: http://jsmpeg.com/
|
||||
[27]: https://opensource.com/sites/default/files/tortoise.jpg (Tortoise)
|
||||
[28]: https://shop.pimoroni.com/products/pan-tilt-hat
|
||||
[29]: https://github.com/waveform80/pistreaming/tree/pantilthat
|
||||
[30]: https://opensource.com/sites/default/files/pan-tilt.gif (Pan-tilt)
|
||||
[31]: https://learn.adafruit.com/onion-pi/overview
|
||||
[32]: https://www.torproject.org/
|
||||
[33]: https://opensource.com/sites/default/files/onion-pi.jpg (Onion-Pi)
|
||||
[34]: https://opensource.com/sites/default/files/resize/pi-hole-250x250.png (Pi-hole)
|
||||
[35]: https://pi-hole.net/
|
@ -1,3 +1,5 @@
|
||||
warmfrog translating
|
||||
|
||||
100 Best Ubuntu Apps
|
||||
======
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
Translating by robsean
|
||||
Learning BASIC Like It's 1983
|
||||
======
|
||||
I was not yet alive in 1983. This is something that I occasionally regret. I am especially sorry that I did not experience the 8-bit computer era as it was happening, because I think the people that first encountered computers when they were relatively simple and constrained have a huge advantage over the rest of us.
|
||||
|
@ -1,120 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Zettlr – Markdown Editor for Writers and Researchers)
|
||||
[#]: via: (https://itsfoss.com/zettlr-markdown-editor/)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
|
||||
Zettlr – Markdown Editor for Writers and Researchers
|
||||
======
|
||||
|
||||
There are quite a few [Markdown editors available for Linux][1], with more popping up all of the time. The problem is that like [Boostnote][2], most are designed for coders and may not be as welcoming to non-techie people. Let’s take a look at a Markdown editor that wants to replace Word and expensive word processors for the non-techies. Let’s take a look at Zettlr.
|
||||
|
||||
### Zettlr Markdown Editor
|
||||
|
||||
![Zettlr Light Mode][3]
|
||||
|
||||
I may have mentioned it a time or two on this site, but I prefer to write all of my documents in [Markdown][4]. It is simple to learn and does not leave you tied to a proprietary document format. I have also mentioned Markdown editor among my [list of open source tools for writers][5].
|
||||
|
||||
I have used a number of Markdown editors and am always interested to try out someone’s new take on the idea. Recently, I came across Zettlr, an open source markdown editor.
|
||||
|
||||
[Zettlr][6] is the creation of a German sociologist/political theorist named [Hendrik Erz][7]. Hendrik created Zettlr because he was frustrated by the current line up of word processors. He wanted something that would allow him to “focus on writing and reading only”.
|
||||
|
||||
After discovering Markdown, he tried several Markdown editors on different operating systems. But none of them had what he was looking for. [According to Hendrik][8], “But I had to realize that there are simply none written for the needs of organizing a huge amount of text efficiently. Most editors have been written by coders, therefore tailored to the needs of engineers and mathematicians. No luck for a student of social sciences, history or political science like me.”
|
||||
|
||||
So he decided to create his own. In November of 2017, he started to work on Zettlr.
|
||||
|
||||
![Zettlr About][9]
|
||||
|
||||
#### Zettlr Features
|
||||
|
||||
Zettlr has a number of neat features, including:
|
||||
|
||||
* Import sources from your [Zotero database][10] and cite them in your document
|
||||
* Focus on your writing with the distraction free mode with optional line muting
|
||||
* Support for code highlighting
|
||||
* Use tags to sort information
|
||||
* Ability to set writing goals for the session
|
||||
* View writing stats over time
|
||||
* Pomodoro Timer
|
||||
* Light/Dark theme
|
||||
* Create presentation using [reveal.js][11]
|
||||
* Quick preview of a document
|
||||
* Search all Markdown documents in a project folder with heatmap showing the density of word searched
|
||||
* Export files to HTML, PDF, ODT, DOC, reStructuredText, LaTex, TXT, Emacs ORG, [TextBundle][12], and Textpack
|
||||
* Add custom CSS to your document
|
||||
|
||||
|
||||
|
||||
[][13]
|
||||
|
||||
Suggested read Manage Your PDF Files In Style With Great Little Book Shelf
|
||||
|
||||
As I am writing this article, a dialog box popped up telling me about the recently released [1.3.0 beta][14]. This beta will include several new themes, as well as, a boatload of fixes, new features and under the hood improvements.
|
||||
|
||||
![Zettlr Night Mode][15]
|
||||
|
||||
#### Installing Zettlr
|
||||
|
||||
Currently, the only Linux repository that has Zettlr for you to install is the [AUR][16]. If your Linux distro is not Arch-based, you can [download an installer][17] from the website for macOS, Windows, Debian, and Fedora.
|
||||
|
||||
#### Final Thoughts on Zettlr
|
||||
|
||||
Note: In order to test Zettlr, I used it to write this article.
|
||||
|
||||
Zettlr has a number of neat features that I wish my Markdown editor of choice (ghostwriter) had, such as the ability to set a word count goal for the document. I also like the option to preview a document without having to open it.
|
||||
|
||||
![Zettlr Settings][18]
|
||||
|
||||
I did run into a couple issues, but they had more to do with the fact that Zettlr works a little bit different than ghostwriter. For example, when I tried to copy a quote or name from a web site, it pasted the in-line styling into Zettlr. Fortunately, there is an option to “Paste without Style”. A couple times I ran into a slight delay when I was trying to type. But that could because it is an Electron app.
|
||||
|
||||
Overall, I think that Zettlr is a good option for a first time Markdown user. It has features that many Markdown editors already have and adds a few more for those who only ever used word processors
|
||||
|
||||
As Hendrik says on the [Zettlr site][8], “Free yourselves from the fetters of word processors and see how your writing process can be improved by using technology that’s right at hand!”
|
||||
|
||||
If you do find Zettlr useful, please consider supporting [Hendrik][19]. As he says on the site, “And this free of any charge, because I do not believe in the fast-living, early-dying startup culture. I simply want to help.”
|
||||
|
||||
[][20]
|
||||
|
||||
Suggested read Calligra Office App Brings ODT Support To Android
|
||||
|
||||
Have you ever used Zettlr? What is your favorite Markdown editor? Please let us know in the comments below.
|
||||
|
||||
If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][21].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/zettlr-markdown-editor/
|
||||
|
||||
作者:[John Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/john/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-markdown-editors-linux/
|
||||
[2]: https://itsfoss.com/boostnote-linux-review/
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/Zettlr-light-mode.png?fit=800%2C462&ssl=1
|
||||
[4]: https://daringfireball.net/projects/markdown/
|
||||
[5]: https://itsfoss.com/open-source-tools-writers/
|
||||
[6]: https://www.zettlr.com/
|
||||
[7]: https://github.com/nathanlesage
|
||||
[8]: https://www.zettlr.com/about
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/zettlr-about.png?fit=800%2C528&ssl=1
|
||||
[10]: https://www.zotero.org/
|
||||
[11]: https://revealjs.com/#/
|
||||
[12]: http://textbundle.org/
|
||||
[13]: https://itsfoss.com/great-little-book-shelf-review/
|
||||
[14]: https://github.com/Zettlr/Zettlr/releases/tag/v1.3.0-beta
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/Zettlr-night-mode.png?fit=800%2C469&ssl=1
|
||||
[16]: https://aur.archlinux.org/packages/zettlr-bin/
|
||||
[17]: https://www.zettlr.com/download
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/zettlr-settings.png?fit=800%2C353&ssl=1
|
||||
[19]: https://www.zettlr.com/supporters
|
||||
[20]: https://itsfoss.com/calligra-android-app-coffice/
|
||||
[21]: http://reddit.com/r/linuxusersgroup
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,497 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (20+ FFmpeg Commands For Beginners)
|
||||
[#]: via: (https://www.ostechnix.com/20-ffmpeg-commands-beginners/)
|
||||
[#]: author: (sk https://www.ostechnix.com/author/sk/)
|
||||
|
||||
20+ FFmpeg Commands For Beginners
|
||||
======
|
||||
|
||||
![FFmpeg Commands][1]
|
||||
|
||||
In this guide, I will be explaining how to use FFmpeg multimedia framework to do various audio, video transcoding and conversion operations with examples. I have compiled most commonly and frequently used 20+ FFmpeg commands for beginners. I will keep updating this guide by adding more examples from time to time. Please bookmark this guide and come back in a while to check for the updates. Let us get started, shall we? If you haven’t installed FFmpeg in your Linux system yet, refer the following guide.
|
||||
|
||||
* [**Install FFmpeg in Linux**][2]
|
||||
|
||||
|
||||
|
||||
### 20+ FFmpeg Commands For Beginners
|
||||
|
||||
The typical syntax of the FFmpeg command is:
|
||||
|
||||
```
|
||||
ffmpeg [global_options] {[input_file_options] -i input_url} ...
|
||||
{[output_file_options] output_url} ...
|
||||
```
|
||||
|
||||
We are now going to see some important and useful FFmpeg commands.
|
||||
|
||||
##### **1\. Getting audio/video file information**
|
||||
|
||||
To display your media file details, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
ffmpeg version n4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
|
||||
built with gcc 8.2.1 (GCC) 20181127
|
||||
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
|
||||
libavutil 56. 22.100 / 56. 22.100
|
||||
libavcodec 58. 35.100 / 58. 35.100
|
||||
libavformat 58. 20.100 / 58. 20.100
|
||||
libavdevice 58. 5.100 / 58. 5.100
|
||||
libavfilter 7. 40.101 / 7. 40.101
|
||||
libswscale 5. 3.100 / 5. 3.100
|
||||
libswresample 3. 3.100 / 3. 3.100
|
||||
libpostproc 55. 3.100 / 55. 3.100
|
||||
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
|
||||
Metadata:
|
||||
major_brand : isom
|
||||
minor_version : 512
|
||||
compatible_brands: isomiso2avc1mp41
|
||||
encoder : Lavf58.20.100
|
||||
Duration: 00:00:28.79, start: 0.000000, bitrate: 454 kb/s
|
||||
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 1920x1080 [SAR 1:1 DAR 16:9], 318 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
|
||||
Metadata:
|
||||
handler_name : ISO Media file produced by Google Inc. Created on: 04/08/2019.
|
||||
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
|
||||
Metadata:
|
||||
handler_name : ISO Media file produced by Google Inc. Created on: 04/08/2019.
|
||||
At least one output file must be specified
|
||||
```
|
||||
|
||||
As you see in the above output, FFmpeg displays the media file information along with FFmpeg details such as version, configuration details, copyright notice, build and library options etc.
|
||||
|
||||
If you don’t want to see the FFmpeg banner and other details, but only the media file information, use **-hide_banner** flag like below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4 -hide_banner
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
![][3]
|
||||
|
||||
View audio, video file information using FFMpeg
|
||||
|
||||
See? Now, it displays only the media file details.
|
||||
|
||||
** **Recommended Download** – [**Free Guide: “Spotify Music Streaming: The Unofficial Guide”**][4]
|
||||
|
||||
##### **2\. Converting video files to different formats**
|
||||
|
||||
FFmpeg is powerful audio and video converter, so It’s possible to convert media files between different formats. Say for example, to convert **mp4 file to avi file** , run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4 video.avi
|
||||
```
|
||||
|
||||
Similarly, you can convert media files to any format of your choice.
|
||||
|
||||
For example, to convert youtube **flv** format videos to **mpeg** format, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.flv video.mpeg
|
||||
```
|
||||
|
||||
If you want to preserve the quality of your source video file, use ‘-qscale 0’ parameter:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.webm -qscale 0 output.mp4
|
||||
```
|
||||
|
||||
To check list of supported formats by FFmpeg, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -formats
|
||||
```
|
||||
|
||||
##### **3\. Converting video files to audio files**
|
||||
|
||||
To convert a video file to audio file, just specify the output format as .mp3, or .ogg, or any other audio formats.
|
||||
|
||||
The above command will convert **input.mp4** video file to **output.mp3** audio file.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn output.mp3
|
||||
```
|
||||
|
||||
Also, you can use various audio transcoding options to the output file as shown below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -ab 320 -f mp3 output.mp3
|
||||
```
|
||||
|
||||
Here,
|
||||
|
||||
* **-vn** – Indicates that we have disabled video recording in the output file.
|
||||
* **-ar** – Set the audio frequency of the output file. The common values used are 22050, 44100, 48000 Hz.
|
||||
* **-ac** – Set the number of audio channels.
|
||||
* **-ab** – Indicates the audio bitrate.
|
||||
* **-f** – Output file format. In our case, it’s mp3 format.
|
||||
|
||||
|
||||
|
||||
##### **4\. Change resolution of video files**
|
||||
|
||||
If you want to set a particular resolution to a video file, you can use following command:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
The above command will set the resolution of the given video file to 1280×720.
|
||||
|
||||
Similarly, to convert the above file to 640×480 size, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v scale=640:480 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -s 640x480 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
This trick will help you to scale your video files to smaller display devices such as tablets and mobiles.
|
||||
|
||||
##### **5\. Compressing video files**
|
||||
|
||||
It is always an good idea to reduce the media files size to lower size to save the harddrive’s space.
|
||||
|
||||
The following command will compress and reduce the output file’s size.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
|
||||
```
|
||||
|
||||
Please note that you will lose the quality if you try to reduce the video file size. You can lower that **crf** value to **23** or lower if **24** is too aggressive.
|
||||
|
||||
You could also transcode the audio down a bit and make it stereo to reduce the size by including the following options.
|
||||
|
||||
```
|
||||
-ac 2 -c:a aac -strict -2 -b:a 128k
|
||||
```
|
||||
|
||||
** **Recommended Download** – [**Free Guide: “PLEX, a Manual: Your Media, With Style”**][5]
|
||||
|
||||
##### **6\. Compressing Audio files**
|
||||
|
||||
Just like compressing video files, you can also compress audio files using **-ab** flag in order to save some disk space.
|
||||
|
||||
Let us say you have an audio file of 320 kbps bitrate. You want to compress it by changing the bitrate to any lower value like below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp3 -ab 128 output.mp3
|
||||
```
|
||||
|
||||
The list of various available audio bitrates are:
|
||||
|
||||
1. 96kbps
|
||||
2. 112kbps
|
||||
3. 128kbps
|
||||
4. 160kbps
|
||||
5. 192kbps
|
||||
6. 256kbps
|
||||
7. 320kbps
|
||||
|
||||
|
||||
|
||||
##### **7. Removing audio stream from a video file
|
||||
|
||||
**
|
||||
|
||||
If you don’t want to a audio from a video file, use **-an** flag.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -an output.mp4
|
||||
```
|
||||
|
||||
Here, ‘an’ indicates no audio recording.
|
||||
|
||||
The above command will undo all audio related flags, because we don’t audio from the input.mp4.
|
||||
|
||||
##### **8\. Removing video stream from a media file**
|
||||
|
||||
Similarly, if you don’t want video stream, you could easily remove it from the media file using ‘vn’ flag. vn stands for no video recording. In other words, this command converts the given media file into audio file.
|
||||
|
||||
The following command will remove the video from the given media file.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn output.mp3
|
||||
```
|
||||
|
||||
You can also mention the output file’s bitrate using ‘-ab’ flag as shown in the following example.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn -ab 320 output.mp3
|
||||
```
|
||||
|
||||
##### **9. Extracting images from the video **
|
||||
|
||||
Another useful feature of FFmpeg is we can easily extract images from a video file. This could be very useful, if you want to create a photo album from a video file.
|
||||
|
||||
To extract images from a video file, use the following command:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png
|
||||
```
|
||||
|
||||
Here,
|
||||
|
||||
* **-r** – Set the frame rate. I.e the number of frames to be extracted into images per second. The default value is **25**.
|
||||
* **-f** – Indicates the output format i.e image format in our case.
|
||||
* **image-%2d.png** – Indicates how we want to name the extracted images. In this case, the names should start like image-01.png, image-02.png, image-03.png and so on. If you use %3d, then the name of images will start like image-001.png, image-002.png and so on.
|
||||
|
||||
|
||||
|
||||
##### **10\. Cropping videos**
|
||||
|
||||
FFMpeg allows to crop a given media file in any dimension of our choice.
|
||||
|
||||
The syntax to crop a vide ofile is given below:
|
||||
|
||||
```
|
||||
ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4
|
||||
```
|
||||
|
||||
Here,
|
||||
|
||||
* **input.mp4** – source video file.
|
||||
* **-filter:v** – Indicates the video filter.
|
||||
* **crop** – Indicates crop filter.
|
||||
* **w** – **Width** of the rectangle that we want to crop from the source video.
|
||||
* **h** – Height of the rectangle.
|
||||
* **x** – **x coordinate** of the rectangle that we want to crop from the source video.
|
||||
* **y** – y coordinate of the rectangle.
|
||||
|
||||
|
||||
|
||||
Let us say you want to a video with a **width of 640 pixels** and a **height of 480 pixels** , from the **position (200,150)** , the command would be:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v "crop=640:480:200:150" output.mp4
|
||||
```
|
||||
|
||||
Please note that cropping videos will affect the quality. Do not do this unless it is necessary.
|
||||
|
||||
##### **11\. Convert a specific portion of a video**
|
||||
|
||||
Sometimes, you might want to convert only a specific portion of the video file to different format. Say for example, the following command will convert the **first 50 seconds** of given video.mp4 file to video.avi format.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -t 10 output.avi
|
||||
```
|
||||
|
||||
Here, we specify the the time in seconds. Also, it is possible to specify the time in **hh.mm.ss** format.
|
||||
|
||||
##### **12\. Set the aspect ratio to video**
|
||||
|
||||
You can set the aspect ration to a video file using **-aspect** flag like below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
```
|
||||
|
||||
The commonly used aspect ratios are:
|
||||
|
||||
* 16:9
|
||||
* 4:3
|
||||
* 16:10
|
||||
* 5:4
|
||||
* 2:21:1
|
||||
* 2:35:1
|
||||
* 2:39:1
|
||||
|
||||
|
||||
|
||||
##### **13\. Adding poster image to audio files**
|
||||
|
||||
You can add the poster images to your files, so that the images will be displayed while playing the audio files. This could be useful to host audio files in Video hosting or sharing websites.
|
||||
|
||||
```
|
||||
$ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
|
||||
```
|
||||
|
||||
##### **14. Trim a media file using start and stop times
|
||||
|
||||
**
|
||||
|
||||
To trim down a video to smaller clip using start and stop times, we can use the following command.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4
|
||||
```
|
||||
|
||||
Here,
|
||||
|
||||
* –s – Indicates the starting time of the video clip. In our example, starting time is the 50th second.
|
||||
* -t – Indicates the total time duration.
|
||||
|
||||
|
||||
|
||||
This is very helpful when you want to cut a part from an audio or video file using starting and ending time.
|
||||
|
||||
Similarly, we can trim down the audio file like below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i audio.mp3 -ss 00:01:54 -to 00:06:53 -c copy output.mp3
|
||||
```
|
||||
|
||||
##### **15\. Split video files into multiple parts**
|
||||
|
||||
Some websites will allow you to upload only a specific size of video. In such cases, you can split the large video files into multiple smaller parts like below.
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4
|
||||
```
|
||||
|
||||
Here, **-t 00:00:30** indicates a part that is created from the start of the video to the 30th second of video. **-ss 00:00:30** shows the starting time stamp for the next part of video. It means that the 2nd part will start from the 30th second and will continue up to the end of the original video file.
|
||||
|
||||
** **Recommended Download** – [**Free Guide: “How to Start Your Own Successful Podcast”**][6]
|
||||
|
||||
##### **16\. Joining or merging multiple video parts into one**
|
||||
|
||||
FFmpeg will also join the multiple video parts and create a single video file.
|
||||
|
||||
Create **join.txt** file that contains the exact paths of the files that you want to join. All files should be same format (same codec). The path name of all files should be mentioned one by one like below.
|
||||
|
||||
```
|
||||
file /home/sk/myvideos/part1.mp4
|
||||
file /home/sk/myvideos/part2.mp4
|
||||
file /home/sk/myvideos/part3.mp4
|
||||
file /home/sk/myvideos/part4.mp4
|
||||
```
|
||||
|
||||
Now, join all files using command:
|
||||
|
||||
```
|
||||
$ ffmpeg -f concat -i join.txt -c copy output.mp4
|
||||
```
|
||||
|
||||
If you get an error something like below;
|
||||
|
||||
```
|
||||
[concat @ 0x555fed174cc0] Unsafe file name '/path/to/mp4'
|
||||
join.txt: Operation not permitted
|
||||
```
|
||||
|
||||
Add **“-safe 0”** :
|
||||
|
||||
```
|
||||
$ ffmpeg -f concat -safe 0 -i join.txt -c copy output.mp4
|
||||
```
|
||||
|
||||
The above command will join part1.mp4, part2.mp4, part3.mp4, and part4.mp4 files into a single file called “output.mp4”.
|
||||
|
||||
##### **17\. Add subtitles to a video file**
|
||||
|
||||
We can also add subtitles to a video file using FFmpeg. Download the correct subtitle for your video and add it your video as shown below.
|
||||
|
||||
```
|
||||
$ fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
|
||||
```
|
||||
|
||||
##### **18\. Preview or test video or audio files**
|
||||
|
||||
You might want to preview to verify or test whether the output file has been properly transcoded or not. To do so, you can play it from your Terminal with command:
|
||||
|
||||
```
|
||||
$ ffplay video.mp4
|
||||
```
|
||||
|
||||
[![][1]][7]
|
||||
|
||||
Similarly, you can test the audio files as shown below.
|
||||
|
||||
```
|
||||
$ ffplay audio.mp3
|
||||
```
|
||||
|
||||
[![][1]][8]
|
||||
|
||||
##### **19\. Increase/decrease video playback speed**
|
||||
|
||||
FFmpeg allows you to adjust the video playback speed.
|
||||
|
||||
To increase the video playback speed, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" output.mp4
|
||||
```
|
||||
|
||||
The command will double the speed of the video.
|
||||
|
||||
To slow down your video, you need to use a multiplier **greater than 1**. To decrease playback speed, run:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf "setpts=4.0*PTS" output.mp4
|
||||
```
|
||||
|
||||
##### **20. Create Animated GIF
|
||||
|
||||
**
|
||||
|
||||
We use GIF images on almost all social and professional networks for various purposes. Using FFmpeg, we can easily and quickly create animated video files. The following guide explains how to create an animated GIF file using FFmpeg and ImageMagick in Unix-like systems.
|
||||
|
||||
* [**How To Create Animated GIF In Linux**][9]
|
||||
|
||||
|
||||
|
||||
##### **21.** Create videos from PDF files
|
||||
|
||||
I collected many PDF files, mostly Linux tutorials, over the years and saved in my Tablet PC. Sometimes I feel too lazy to read them from the tablet. So, I decided to create a video from PDF files and watch it in a big screen devices like a TV or a Computer. If you ever wondered how to make a movie file from a collection of PDF files, the following guide will help.
|
||||
|
||||
* [**How To Create A Video From PDF Files In Linux**][10]
|
||||
|
||||
|
||||
|
||||
##### **22\. Getting help**
|
||||
|
||||
In this guide, I have covered the most commonly used FFmpeg commands. It has a lot more different options to do various advanced functions. To learn more about it, refer the man page.
|
||||
|
||||
```
|
||||
$ man ffmpeg
|
||||
```
|
||||
|
||||
And, that’s all. I hope this guide will help you to getting started with FFmpeg. If you find this guide useful, please share it on your social, and professional networks. More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/20-ffmpeg-commands-beginners/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.ostechnix.com/wp-content/uploads/2017/05/FFmpeg-Commands-720x340.png
|
||||
[2]: https://www.ostechnix.com/install-ffmpeg-linux/
|
||||
[3]: http://www.ostechnix.com/wp-content/uploads/2017/05/sk@sk_001.png
|
||||
[4]: https://ostechnix.tradepub.com/free/w_make141/prgm.cgi
|
||||
[5]: https://ostechnix.tradepub.com/free/w_make75/prgm.cgi
|
||||
[6]: https://ostechnix.tradepub.com/free/w_make235/prgm.cgi
|
||||
[7]: http://www.ostechnix.com/wp-content/uploads/2017/05/Menu_004.png
|
||||
[8]: http://www.ostechnix.com/wp-content/uploads/2017/05/Menu_005-3.png
|
||||
[9]: https://www.ostechnix.com/create-animated-gif-ubuntu-16-04/
|
||||
[10]: https://www.ostechnix.com/create-video-pdf-files-linux/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: ( jdh8383 )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
149
translated/tech/20170414 5 projects for Raspberry Pi at home.md
Normal file
149
translated/tech/20170414 5 projects for Raspberry Pi at home.md
Normal file
@ -0,0 +1,149 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (warmfrog)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 projects for Raspberry Pi at home)
|
||||
[#]: via: (https://opensource.com/article/17/4/5-projects-raspberry-pi-home)
|
||||
[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall)
|
||||
|
||||
5 个可在家中使用的与 Raspberry Pi 相关的项目
|
||||
======================================
|
||||
|
||||
![5 projects for Raspberry Pi at home][1]
|
||||
|
||||
[Raspberry Pi][2] 电脑可被用来进行多种设置用于不同的目的。明显它在教育市场帮助学生在教室中学习编程与创客技巧和创客空间方面占有一席之地,它在工作场所和工厂中有大量应用。我打算介绍五个你可能想要在你的家中构建的项目。
|
||||
|
||||
### 媒体中心
|
||||
|
||||
在人们家中人们常用 Raspberry Pi 作为媒体中心来服务多媒体文件。它很容易建立,Raspberry Pi 提供了大量的 GPU(图形处理单元)运算能力来渲染你的大屏电视上的高清电视节目和电影。将 [Kodi][3](从前的 XBMC)运行在 Raspberry Pi 上是一个很棒的方式来播放你的硬盘或网络存储上的任何媒体。你同样可以安装一个包来播放 YouTube 视频。
|
||||
|
||||
也有一些少量不同的选项,显然是 [OSMC][4](开源媒体中心)和 [LibreELEC][5],都是基于 Kodi 的。它们在放映媒体内容方面表现的都非常好,但是 OSMC 有一个更酷炫的用户界面,而 LibreElec 更轻量级。你要做的只是选择一个发行版,下载镜像并安装到一个 SD 卡中(或者仅仅使用 [NOOBS][6]),启动,然后你就准备好了。
|
||||
|
||||
![LibreElec ][7]
|
||||
|
||||
LibreElec; Raspberry Pi 基金会, CC BY-SA
|
||||
|
||||
![OSMC][8]
|
||||
|
||||
OSMC.tv, Copyright, 凭权限使用
|
||||
|
||||
在往下走之前,你需要决定[使用哪种 Raspberry Pi 开发板][9]。这些发行版在任何 Pi(1, 2, 3, or Zero)上都能运行,视频播放在这些开发板中的任何一个上都能胜任。除了 Pi 3(和 Zero W)有内置 Wi-Fi,可察觉的不同是用户界面的反应速度,在 Pi 3 上更快。一个 Pi 2 不会慢太多,所以如果你不需要 Wi-Fi 是可以的,但是当切换菜单时,你会注意到 Pi 3 比 Pi 1 和 Zero 表现的更好。
|
||||
|
||||
### SSH 网关
|
||||
|
||||
如果你想从广域网访问你的家庭局域网的电脑和设备,你必须打开这些设备的端口来允许外部访问。在互联网中开放这些端口有安全风险,意味着你总是你总是处于被攻击、滥用或者其他各种未授权访问的风险中。然而,如果你在你的网络中安装一个 Raspberry Pi,并且设置端口映射到仅通过 SSH 访问 Pi 的端口,你可以这么用来作为一个安全的网关来跳到网络中的其他 Pi 和 PC。
|
||||
|
||||
大多数路由允许你配置端口映射规则。你需要给你的 Pi 一个固定的内网 IP 地址来设置你的路由器端口 22 映射到你的 Raspberry Pi 端口 22。如果你的网络服务提供商给你提供了一个静态 IP 地址,你能够通过 SSH 和主机的 IP 地址访问(例如,**ssh pi@123.45.56.78** )。如果你有一个域名,你可以配置一个子域名指向这个 IP 地址,所以你没必要记住它(例如,**ssh[pi@home.mydomain.com][10]**)。
|
||||
|
||||
![][11]
|
||||
|
||||
然而,如果你不想将 Raspberry Pi 暴露在互联网上,你应该非常小心,不要让你的网络处于危险之中。如果你遵循一些简单的步骤来使它更安全:
|
||||
|
||||
1\. 大多数人建议你更换你的登录密码(有道理,默认密码 “raspberry” 是众所周知的),但是这不能阻挡暴力攻击。你可以改变你的密码并添加一个双重验证(所以你需要你的密码_和_一个手机生成的与时间无关的密码),这么做更安全。但是,我相信最好的方法阻止入侵者访问你的 Raspberry Pi 是在你的 SSH 配置中[禁止][12][密码认证][12],这样只能通过 SSH 密匙进入。这意味着任何试图猜测你的密码尝试登录的人都不会成功。只有你的私有密匙可以访问。简单来说,很多人建议将 SSH 端口从默认的 22 换成其他的,但是通过简单的 [Nmap][13] 扫描你的 IP 地址,你信任的 SSH 端口就会暴露。
|
||||
|
||||
2\. 最好,不要在这个 Pi 上运行其他的软件,这样你不会意外暴露其他东西。如果你想要运行其他软件,你最好在网络中的其他 Pi 上运行,它们没有暴露在互联网上。确保你经常升级来保证你的包是最新的,尤其是 **openssh-server** 包,这样你的安全缺陷就被打补丁了。
|
||||
|
||||
3\. 安装 [sshblack][14] 或 [fail2ban][15] 来将任何表露出恶意的用户加入黑名单,例如试图暴力破解你的 SSH 密码。
|
||||
|
||||
一旦你是 Raspberry Pi 安全后,让它在线,你将在世界的任何地方登录你的网络。一旦你登录到你的树莓派,你可以用 SSH 访问本地网络上的局域网地址(例如,192.168.1.31)访问其他设备。如果你在这些设备上有密码,用密码就好了。如果它们同样只允许 SSH 密匙,你需要确保你的密匙通过 SSH 传播,使用 **-A** 参数:**ssh -A pi@123.45.67.89**。
|
||||
|
||||
### CCTV / 宠物相机
|
||||
|
||||
另一个很棒的家庭项目是建立一个相机模块来拍照和录视频,录制并保存文件,在内网或者外网中进行流式传输。你想这么做有很多原因,但两个常见的情况是一个家庭安防相机或监控你的宠物。
|
||||
|
||||
[Raspberry Pi 相机模块][16] 是一个优秀的配件。它提供全高清的相片和视频,包括很多高级配置,很[容易][17][编程][17]。[红外线相机][18]用于这种目的是非常理想的,通过一个红外线 LED(Pi 可以控制的),你就能够在黑暗中看见东西。
|
||||
|
||||
如果你想通过一定频率拍摄静态图片来留意某件事,你可以仅仅写一个短的 [Python][19] 脚本或者使用命令行工具 [raspistill][20], 在 [Cron][21] 中规划它多次运行。你可能想将它们保存到 [Dropbox][22] 或另一个网络服务,上传到一个网络服务器,你甚至可以创建一个[网络应用][23]来显示他们。
|
||||
|
||||
如果你想要在内网或外网中流式传输视频,那也相当简单。在 [picamera 文档][24]中(在 “web streaming” 章节)有一个简单的 MJPEG(运动的 JPEG)例子。简单下载或者拷贝代码到文件中,运行并访问 Pi 的 IP 地址的 8000 端口,你会看见你的相机的直播输出。
|
||||
|
||||
有一个更高级的流式传输项目 [pistreaming][25] 可获得,它通过在网络服务器中用 [JSMpeg][26] (一个 JavaScript 视频播放器)和一个用于相机流的单独运行的 websocket。这种方法性能更好,并且和之前的例子一样简单,但是如果要在互联网中流式传输,则需要包含更多代码,并且需要你开放两个端口。
|
||||
|
||||
一旦你的网络流建立起来,你可以将你的相机放在你想要的地方。我用一个来观察我的宠物龟:
|
||||
|
||||
![Tortoise ][27]
|
||||
|
||||
Ben Nuttall, CC BY-SA
|
||||
|
||||
如果你想控制相机位置,你可以用一个舵机。一个优雅的方案是用 Pimoroni 的 [Pan-Tilt HAT][28],它可以让你简单的在二维方向上移动相机。为了与 pistreaming 集成,看项目的 [pantilthat 分支][29].
|
||||
|
||||
![Pan-tilt][30]
|
||||
|
||||
Pimoroni.com, Copyright, Used with permission
|
||||
|
||||
如果你想将你的 Pi 放到户外,你将需要一个防水的外围附件,并且需要一种给 Pi 供电的方式。POE(通过以太网提供电力)电缆是一个不错的实现方式。
|
||||
|
||||
### 家庭自动化或物联网
|
||||
|
||||
现在是 2017 年,到处都有很多物联网设备,尤其是家中。我们的电灯有 Wi-Fi,我们的面包烤箱比过去更智能,我们的茶壶处于俄国攻击的风险中,除非你确保你的设备安全,不然别将没有必要的设备连接到互联网,之后你可以在家中充分的利用物联网设备来完成自动化任务。
|
||||
|
||||
市场上有大量你可以购买或订阅的服务,像 Nest Thermostat 或 Philips Hue 电灯泡,允许你通过你的手机控制你的温度或者你的亮度,无论你是否在家。你可以用一个树莓派来催动这些设备的电源,通过一系列规则包括时间甚至是传感器来完成自动交互。用 Philips Hue ,有一件事你不能做的是当你进房间是打开灯光,但是有一个树莓派和一个运动传感器,你可以用 Python API 来打开灯光。类似,当你在家的时候你可以通过配置你的 Nest 打开加热系统,但是如果你想在房间里至少有两个人时才打开呢?写一些 Python 代码来检查网络中有哪些手机,如果至少有两个,告诉 Nest 来打开加热器。
|
||||
|
||||
不选择集成已存在的物联网设备,你可以用简单的组件来做的更多。一个自制的窃贼警报器,一个自动化的鸡笼门开关,一个夜灯,一个音乐盒,一个定时的加热灯,一个自动化的备份服务器,一个打印服务器,或者任何你能想到的。
|
||||
|
||||
### Tor 协议和屏蔽广告
|
||||
|
||||
Adafruit 的 [Onion Pi][31] 是一个 [Tor][32] 协议来使你的网络交通匿名,允许你使用互联网,而不用担心窥探者和各种形式的监视。跟随 Adafruit 的指南来设置 Onion Pi,你会找到一个舒服的匿名的浏览体验。
|
||||
|
||||
![Onion-Pi][33]
|
||||
|
||||
Onion-pi from Adafruit, Copyright, Used with permission
|
||||
|
||||
![Pi-hole][34] 你可以在你的网络中安装一个树莓派来拦截所有的网络交通并过滤所有广告。简单下载 [Pi-hole][35] 软件到 Pi 中,你的网络中的所有设备都将没有广告(甚至屏蔽你的移动设备应用内的广告)。
|
||||
|
||||
Raspberry Pi 在家中有很多用法。你在家里用树莓派来干什么?你想用它干什么?
|
||||
|
||||
在下方评论让我们知道。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/4/5-projects-raspberry-pi-home
|
||||
|
||||
作者:[Ben Nuttall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[warmfrog](https://github.com/warmfrog)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/bennuttall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry_pi_home_automation.png?itok=2TnmJpD8 (5 projects for Raspberry Pi at home)
|
||||
[2]: https://www.raspberrypi.org/
|
||||
[3]: https://kodi.tv/
|
||||
[4]: https://osmc.tv/
|
||||
[5]: https://libreelec.tv/
|
||||
[6]: https://www.raspberrypi.org/downloads/noobs/
|
||||
[7]: https://opensource.com/sites/default/files/libreelec_0.png (LibreElec )
|
||||
[8]: https://opensource.com/sites/default/files/osmc.png (OSMC)
|
||||
[9]: https://opensource.com/life/16/10/which-raspberry-pi-should-you-choose-your-project
|
||||
[10]: mailto:pi@home.mydomain.com
|
||||
[11]: https://opensource.com/sites/default/files/resize/screenshot_from_2017-04-07_15-13-01-700x380.png
|
||||
[12]: http://stackoverflow.com/questions/20898384/ssh-disable-password-authentication
|
||||
[13]: https://nmap.org/
|
||||
[14]: http://www.pettingers.org/code/sshblack.html
|
||||
[15]: https://www.fail2ban.org/wiki/index.php/Main_Page
|
||||
[16]: https://www.raspberrypi.org/products/camera-module-v2/
|
||||
[17]: https://opensource.com/life/15/6/raspberry-pi-camera-projects
|
||||
[18]: https://www.raspberrypi.org/products/pi-noir-camera-v2/
|
||||
[19]: http://picamera.readthedocs.io/
|
||||
[20]: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md
|
||||
[21]: https://www.raspberrypi.org/documentation/linux/usage/cron.md
|
||||
[22]: https://github.com/RZRZR/plant-cam
|
||||
[23]: https://github.com/bennuttall/bett-bot
|
||||
[24]: http://picamera.readthedocs.io/en/release-1.13/recipes2.html#web-streaming
|
||||
[25]: https://github.com/waveform80/pistreaming
|
||||
[26]: http://jsmpeg.com/
|
||||
[27]: https://opensource.com/sites/default/files/tortoise.jpg (Tortoise)
|
||||
[28]: https://shop.pimoroni.com/products/pan-tilt-hat
|
||||
[29]: https://github.com/waveform80/pistreaming/tree/pantilthat
|
||||
[30]: https://opensource.com/sites/default/files/pan-tilt.gif (Pan-tilt)
|
||||
[31]: https://learn.adafruit.com/onion-pi/overview
|
||||
[32]: https://www.torproject.org/
|
||||
[33]: https://opensource.com/sites/default/files/onion-pi.jpg (Onion-Pi)
|
||||
[34]: https://opensource.com/sites/default/files/resize/pi-hole-250x250.png (Pi-hole)
|
||||
[35]: https://pi-hole.net/
|
||||
|
||||
|
||||
|
@ -0,0 +1,110 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Zettlr – Markdown Editor for Writers and Researchers)
|
||||
[#]: via: (https://itsfoss.com/zettlr-markdown-editor/)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
|
||||
Zettlr - 适合作者和研究人员的 Markdown 编辑器
|
||||
======
|
||||
|
||||
有很多[适用于 Linux 的 Markdown 编辑器][1],并且还在继续增加。问题是,像 [Boostnote][2] 一样,大多数是为编码人员设计的,可能不会受到非技术人员的欢迎。让我们看一个想要替代 Word 和昂贵的文字处理器,适用于非技术人员的 Markdown 编辑器。我们来看看 Zettlr 吧。
|
||||
|
||||
### Zettlr Markdown 编辑器
|
||||
|
||||
![Zettlr Light Mode][3]
|
||||
|
||||
我可能在网站上提到过一两次,但我更喜欢用 [Markdown][4] 写下我的所有文档。它易于学习,不会让你与专有文档格式相关联。我还在我的[适合作者的开源工具列表][5]中提到了 Markdown 编辑器。
|
||||
|
||||
我用过许多 Markdown 编辑器,但是我一直有兴趣尝试新的。最近,我遇到了 Zettlr,一个开源 markdown 编辑器。
|
||||
|
||||
[Zettlr][6] 是一位名叫 [Hendrik Erz][7] 的德国社会学家/政治理论家创建的。Hendrik 创建了 Zettlr,因为他对目前的文字处理器感到沮丧。他想要可以让他“专注于写作和阅读”的编辑器。
|
||||
|
||||
在发现 Markdown 之后,他在不同的操作系统上尝试了几个 Markdown 编辑器。但他们都没有他想要的东西。[根据 Hendrik 的说法][8],“但我不得不意识到没有为高效组织大量文本而写的编辑器。大多数编辑都是由编码人员编写的,因此可以满足工程师和数学家的需求。没有为我这样的社会科学,历史或政治学的学生的编辑器。“
|
||||
|
||||
So he decided to create his own. In November of 2017, he started to work on Zettlr.
|
||||
所以他决定创造自己的。2017 年 11 月,他开始编写 Zettlr。
|
||||
|
||||
![Zettlr About][9]
|
||||
|
||||
#### Zettlr 功能
|
||||
|
||||
Zettlr有许多简洁的功能,包括:
|
||||
|
||||
* 从 [Zotero 数据库][10]导入源并在文档中引用它们
|
||||
* 使用可选的行屏蔽,让你无打扰地专注于写作
|
||||
* 支持代码高亮
|
||||
* 使用标签对信息进行排序
|
||||
* 能够为会话设定写作目标
|
||||
* 查看一段时间的写作统计
|
||||
* 番茄钟计时器
|
||||
* 浅色/深色主题
|
||||
* 使用 [reveal.js][11] 创建演示文稿
|
||||
* 快速预览文档
|
||||
* 在一个项目文档中搜索 Markdown 文档,并用热图展示文字搜索密度。
|
||||
* 将文件导出为 HTML、PDF、ODT、DOC、reStructuredText、LaTex、TXT、Emacs ORG、[TextBundle][12] 和 Textpack
|
||||
* 将自定义 CSS 添加到你的文档
|
||||
|
||||
当我写这篇文章时,一个对话框弹出来告诉我最近发布了 [1.3.0 beta][14]。此测试版将包括几个新的主题,以及一大堆修复,新功能和改进。
|
||||
|
||||
![Zettlr Night Mode][15]
|
||||
|
||||
#### 安装 Zettlr
|
||||
|
||||
目前,唯一可安装 Zettlr 的 Linux 存储库是 [AUR][16]。如果你的 Linux 发行版不是基于 Arch 的,你可以从网站上下载 macOS、Windows、Debian 和 Fedora 的[安装程序][17]。
|
||||
|
||||
#### 对 Zettlr 的最后一点想法
|
||||
|
||||
注意:为了测试 Zettlr,我用它来写这篇文章。
|
||||
|
||||
Zettlr 有许多我希望我之前选择的编辑器 (ghostwriter) 有的简洁的功能,例如为文档设置字数目标。我也喜欢在不打开文档的情况下预览文档的功能。
|
||||
|
||||
![Zettlr Settings][18]
|
||||
|
||||
我也遇到了几个问题,但这些更多的是因为 Zettlr 与 ghostwriter 的工作方式略有不同。例如,当我尝试从网站复制引用或名称时,它会将内嵌样式粘贴到 Zettlr 中。幸运的是,它有一个“不带样式粘贴”的选项。有几次我在打字时有轻微的延迟。但那可能是因为它是一个 Electron 程序。
|
||||
|
||||
总的来说,我认为 Zettlr 是第一次使用 Markdown 用户的好选择。它有许多 Markdown 编辑器已有的功能,并为那些只使用过文字处理器的用户增加了一些功能。
|
||||
|
||||
正如 Hendrik 在 [Zettlr 网站][8]中所说的那样,“让自己摆脱文字处理器的束缚,看看你的写作过程如何通过身边的技术得到改善!”
|
||||
|
||||
如果你觉得 Zettlr 有用,请考虑支持 [Hendrik][19]。正如他在网站上所说,“它是免费的,因为我不相信激烈竞争,早逝的创业文化。我只是想帮忙。“
|
||||
|
||||
你有没有用过 Zettlr?你最喜欢的 Markdown 编辑器是什么?请在下面的评论中告诉我们。
|
||||
|
||||
如果你觉得这篇文章有趣,请在社交媒体,Hacker News 或 [Reddit][21] 上分享它。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/zettlr-markdown-editor/
|
||||
|
||||
作者:[John Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/john/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-markdown-editors-linux/
|
||||
[2]: https://itsfoss.com/boostnote-linux-review/
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/Zettlr-light-mode.png?fit=800%2C462&ssl=1
|
||||
[4]: https://daringfireball.net/projects/markdown/
|
||||
[5]: https://itsfoss.com/open-source-tools-writers/
|
||||
[6]: https://www.zettlr.com/
|
||||
[7]: https://github.com/nathanlesage
|
||||
[8]: https://www.zettlr.com/about
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/zettlr-about.png?fit=800%2C528&ssl=1
|
||||
[10]: https://www.zotero.org/
|
||||
[11]: https://revealjs.com/#/
|
||||
[12]: http://textbundle.org/
|
||||
[13]: https://itsfoss.com/great-little-book-shelf-review/
|
||||
[14]: https://github.com/Zettlr/Zettlr/releases/tag/v1.3.0-beta
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/Zettlr-night-mode.png?fit=800%2C469&ssl=1
|
||||
[16]: https://aur.archlinux.org/packages/zettlr-bin/
|
||||
[17]: https://www.zettlr.com/download
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/zettlr-settings.png?fit=800%2C353&ssl=1
|
||||
[19]: https://www.zettlr.com/supporters
|
||||
[21]: http://reddit.com/r/linuxusersgroup
|
496
translated/tech/20190527 20- FFmpeg Commands For Beginners.md
Normal file
496
translated/tech/20190527 20- FFmpeg Commands For Beginners.md
Normal file
@ -0,0 +1,496 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (20+ FFmpeg Commands For Beginners)
|
||||
[#]: via: (https://www.ostechnix.com/20-ffmpeg-commands-beginners/)
|
||||
[#]: author: (sk https://www.ostechnix.com/author/sk/)
|
||||
|
||||
针对初学者的20多个 FFmpeg 命令
|
||||
======
|
||||
|
||||
![FFmpeg Commands][1]
|
||||
|
||||
在这个指南中,我将阐明如何使用 FFmpeg 多多媒体框架来做各种各样的音频,视频转换编码和转换操作示例。我已经为初学者编写最通常频繁使用的20多个 FFmpeg 命令,我将通过不是地添加更多的示例来保持更新这个指南。请给这个指南加书签,以后回来检查更新。让我们开始吧?如果你还没有在你的 Linux 系统中安装 FFmpeg ,参考下面的指南。
|
||||
|
||||
* [**在 Linux 中安装 FFmpeg**][2]
|
||||
|
||||
|
||||
|
||||
### 针对初学者的20多个 FFmpeg 命令
|
||||
|
||||
FFmpeg 命令的典型语法是:
|
||||
|
||||
```
|
||||
ffmpeg [全局选项] {[输入文件选项] -i 输入url地址} ...
|
||||
{[输出文件选项] 输出url地址} ...
|
||||
```
|
||||
|
||||
现在我们将查看一些重要的和有用的 FFmpeg 命令。
|
||||
|
||||
##### **1\. 获取音频/视频文件信息**
|
||||
|
||||
为显示你的多媒体文件细节,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4
|
||||
```
|
||||
|
||||
**样本输出:**
|
||||
|
||||
```
|
||||
ffmpeg version n4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
|
||||
built with gcc 8.2.1 (GCC) 20181127
|
||||
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
|
||||
libavutil 56. 22.100 / 56. 22.100
|
||||
libavcodec 58. 35.100 / 58. 35.100
|
||||
libavformat 58. 20.100 / 58. 20.100
|
||||
libavdevice 58. 5.100 / 58. 5.100
|
||||
libavfilter 7. 40.101 / 7. 40.101
|
||||
libswscale 5. 3.100 / 5. 3.100
|
||||
libswresample 3. 3.100 / 3. 3.100
|
||||
libpostproc 55. 3.100 / 55. 3.100
|
||||
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
|
||||
Metadata:
|
||||
major_brand : isom
|
||||
minor_version : 512
|
||||
compatible_brands: isomiso2avc1mp41
|
||||
encoder : Lavf58.20.100
|
||||
Duration: 00:00:28.79, start: 0.000000, bitrate: 454 kb/s
|
||||
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 1920x1080 [SAR 1:1 DAR 16:9], 318 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
|
||||
Metadata:
|
||||
handler_name : ISO Media file produced by Google Inc. Created on: 04/08/2019.
|
||||
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
|
||||
Metadata:
|
||||
handler_name : ISO Media file produced by Google Inc. Created on: 04/08/2019.
|
||||
At least one output file must be specified
|
||||
```
|
||||
|
||||
如你在上面的输出中看到的,FFmpeg 显示多媒体文件信息,以及 FFmpeg 细节,例如版本,配置细节,版权标记,构建和库选项等等。
|
||||
|
||||
如果你不想看 FFmpeg 标语和其它细节,而仅仅想看多媒体文件信息,使用 **-hide_banner** 标示,像下面。
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4 -hide_banner
|
||||
```
|
||||
|
||||
**样本输出:**
|
||||
|
||||
![][3]
|
||||
|
||||
使用 FFMpeg 查看音频,视频文件信息。
|
||||
|
||||
看见了吗?现在,它仅显示多媒体文件细节。
|
||||
|
||||
** **推荐下载** – [**免费指南:“Spotify 音乐流:非官方指南”**][4]
|
||||
|
||||
##### **2\. 转换视频文件到不同的格式**
|
||||
|
||||
FFmpeg 是强有力的音频和视频转换器,因此,在不同格式之间转换多媒体文件是可能的。以示例说明,转换 **mp4 文件到 avi 文件**,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.mp4 video.avi
|
||||
```
|
||||
|
||||
类似地,你可以转换多媒体文件到你选择的任何格式。
|
||||
|
||||
例如,为转换 youtube **flv** 格式视频为 **mpeg** 格式,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i video.flv video.mpeg
|
||||
```
|
||||
|
||||
如果你想维持你的源视频文件的质量,使用 “-qscale 0” 参数:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.webm -qscale 0 output.mp4
|
||||
```
|
||||
|
||||
为检查 FFmpeg 的支持列表,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -formats
|
||||
```
|
||||
|
||||
##### **3\. 转换视频文件到音频文件**
|
||||
|
||||
我转换一个视频文件到音频文件,只需具体指明输出格式,像 .mp3,或 .ogg,或其它任意音频格式。
|
||||
|
||||
上面的命令将转换 **input.mp4** 视频文件到 **output.mp3** 音频文件。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn output.mp3
|
||||
```
|
||||
|
||||
此外,你也可以使用各种各样的音频转换编码选项到输出文件,像下面演示。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -ab 320 -f mp3 output.mp3
|
||||
```
|
||||
|
||||
在这里,
|
||||
|
||||
* **-vn** – 表明我们已经在输出文件中禁用视频录制。
|
||||
* **-ar** – 设置输出文件的音频频率。通常使用的值是22050,44100,48000 Hz。
|
||||
* **-ac** – 设置音频通道的数目。
|
||||
* **-ab** – 表明音频比特率。
|
||||
* **-f** – 输出文件格式。在我们的实例中,它是 mp3 格式。
|
||||
|
||||
|
||||
|
||||
##### **4\. 更改视频文件的分辨率**
|
||||
|
||||
如果你想设置一个具体的分辨率到一个视频文件中,你可以使用下面的命令:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
或,
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
上面的命令将设置所给定视频文件的分辨率到1280×720。
|
||||
|
||||
类似地,为转换上面的文件到640×480大小,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v scale=640:480 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
或者,
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -s 640x480 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
这个技巧将帮助你缩放你的视频文件到较小的显示设备,例如平板电脑和手机。
|
||||
|
||||
##### **5\. 压缩视频文件**
|
||||
|
||||
减小多媒体文件的大小到较低大小来节省硬件的空间总是一个好主意.
|
||||
|
||||
下面的命令将压缩和减少输出文件的大小。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
|
||||
```
|
||||
|
||||
请注意,如果你尝试减小视频文件的大小,你将丢失视频质量。如果 **24** 太有侵略性,你可以降低 **crf** 值到或更低值。
|
||||
|
||||
你也可以转换编码音频向下一点结果是使其有立体声感,通过包含下面的选项来减小大小。
|
||||
|
||||
```
|
||||
-ac 2 -c:a aac -strict -2 -b:a 128k
|
||||
```
|
||||
|
||||
** **推荐下载** – [**免费指南: “PLEX, 一本手册:你的多媒体,具有样式”**][5]
|
||||
|
||||
##### **6\. 压缩音频文件**
|
||||
|
||||
正像压缩视频文件一样,为节省一些磁盘空间,你也可以使用 **-ab** 标示压缩音频文件。
|
||||
|
||||
例如,你有一个320 kbps 比特率的音频文件。你想通过更改比特率到任意较低的值来压缩它,像下面。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp3 -ab 128 output.mp3
|
||||
```
|
||||
|
||||
各种各样可用的音频比特率列表是:
|
||||
|
||||
1. 96kbps
|
||||
2. 112kbps
|
||||
3. 128kbps
|
||||
4. 160kbps
|
||||
5. 192kbps
|
||||
6. 256kbps
|
||||
7. 320kbps
|
||||
|
||||
|
||||
|
||||
##### **7. 从一个视频文件移除音频流**
|
||||
|
||||
如果你不想从一个视频文件中要一个音频,使用 **-an** 标示。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -an output.mp4
|
||||
```
|
||||
|
||||
在这里,‘an’ 表示没有音频录制。
|
||||
|
||||
上面的命令会撤销所有音频相关的标示,因为我们没有从 input.mp4 中音频操作。
|
||||
|
||||
##### **8\. 从一个多媒体文件移除视频流**
|
||||
|
||||
类似地,如果你不想要视频流,你可以使用 ‘vn’ 标示从多媒体文件中简单地移除它。vn 代表没有视频录制。换句话说,这个里面转换所给定多媒体文件到音频文件中。
|
||||
|
||||
下面的命令将从所给定多媒体文件中移除视频。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn output.mp3
|
||||
```
|
||||
|
||||
你也可以使用 ‘-ab’ 标示来提出输出文件的比特率,如下面的示例所示。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vn -ab 320 output.mp3
|
||||
```
|
||||
|
||||
##### **9. 从视频中提取图像 **
|
||||
|
||||
FFmpeg 的另一个有用的特色是我们可以从一个视频文件中简单地提取图像。这可能是非常有用的,如果你想从一个视频文件中创建一个相册。
|
||||
|
||||
为从一个视频文件中提取图像,使用下面的命令:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png
|
||||
```
|
||||
|
||||
在这里,
|
||||
|
||||
* **-r** – 设置帧速度。即,每秒提取帧到图像的数字。默认值是 **25**。
|
||||
* **-f** – 表示输出格式,即,在我们的实例中是图像。
|
||||
* **image-%2d.png** – 表明我们如何想命名提取的图像。在这个实例中,命名应该开端,像这样image-01.png,image-02.png,image-03.png 等等。如果你使用 %3d ,那么图像的命名将开始,像 image-001.png,image-002.png 等等。
|
||||
|
||||
|
||||
|
||||
##### **10\. 裁剪视频**
|
||||
|
||||
FFMpeg 允许裁剪一个给定的多媒体文件到我们选择的任何范围。
|
||||
|
||||
裁剪一个视频文件的语法如下给定:
|
||||
|
||||
```
|
||||
ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4
|
||||
```
|
||||
|
||||
在这里,
|
||||
|
||||
* **input.mp4** – 源视频文件。
|
||||
* **-filter:v** – 表示视频过滤器。
|
||||
* **crop** – 表示裁剪过滤器。
|
||||
* **w** – 我们想自源视频中来裁剪的矩形的 **宽度** 。
|
||||
* **h** – 矩形的高度。
|
||||
* **x** – 我们想自源视频中来裁剪的矩形的 **x 坐标** 。
|
||||
* **y** – 矩形的 y 坐标。
|
||||
|
||||
|
||||
让我们表达,你想要一个来自视频的**位置(200,150)**,且具有**640像素的宽度**和**480像素的高度**视频, 命令应该是:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -filter:v "crop=640:480:200:150" output.mp4
|
||||
```
|
||||
|
||||
请注意,剪切视频将影响质量。除非必要,请勿剪切。
|
||||
|
||||
##### **11\. 转换一个视频的具体的部分**
|
||||
|
||||
有时,你可能想仅转换视频文件的一个具体的部分到不同的格式。以示例说明,下面的命令将转换所给定视频input.mp4 文件的**第一个50秒**到视频 .avi 格式。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -t 10 output.avi
|
||||
```
|
||||
|
||||
在这里,我们以秒具体说明时间。此外,以**hh.mm.ss** 格式具体说明时间也是可接受的。
|
||||
|
||||
##### **12\. 设置视频的屏幕高宽比**
|
||||
|
||||
你可以使用 **-aspect** 标示设置一个视频文件的屏幕高宽比,像下面。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
```
|
||||
|
||||
通常使用的 aspect 比例是:
|
||||
|
||||
* 16:9
|
||||
* 4:3
|
||||
* 16:10
|
||||
* 5:4
|
||||
* 2:21:1
|
||||
* 2:35:1
|
||||
* 2:39:1
|
||||
|
||||
|
||||
|
||||
##### **13\. 添加海报图像到音频文件**
|
||||
|
||||
你可以添加海报图像到你的文件,以便图像将在播放音频文件时显示。这对托管在视频托管主机或共享网站中的音频文件是有用的。
|
||||
|
||||
```
|
||||
$ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
|
||||
```
|
||||
|
||||
##### **14. 使用开始和停止时间剪下一段多媒体文件
|
||||
|
||||
**
|
||||
|
||||
为剪下一段视频到小块的剪辑,使用开始和停止时间,我们可以使用下面的命令。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4
|
||||
```
|
||||
|
||||
在这里,
|
||||
|
||||
* –s – 表示视频剪辑的开始时间。在我们的示例中,开始时间是第50秒。
|
||||
* -t – 表示总的持续时间。
|
||||
|
||||
|
||||
|
||||
当你想从一个音频或视频文件剪切一部分,使用开始和结束时间是非常有帮助的
|
||||
|
||||
类似地,我们可以像下面剪下音频。
|
||||
|
||||
```
|
||||
$ ffmpeg -i audio.mp3 -ss 00:01:54 -to 00:06:53 -c copy output.mp3
|
||||
```
|
||||
|
||||
##### **15\. 分裂视频文件到多个部分**
|
||||
|
||||
一些网站将仅允许你上传一个具体指定大小的视频。在这样的情况下,你可以分裂大的视频文件到多个较小的部分,像下面。
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4
|
||||
```
|
||||
|
||||
在这里,
|
||||
**-t 00:00:30** 表示从视频的开始到视频的第30秒创建一部分视频。
|
||||
**-ss 00:00:30** 为视频的下一部分显示开始时间戳。它意味着第2部分将从第30秒开始,并将持续到原始视频文件的结尾。
|
||||
|
||||
** **推荐下载** – [**免费指南:“如何开始你自己的成功的博客”**][6]
|
||||
|
||||
##### **16\. 接合或合并多个视频部分到一个**
|
||||
|
||||
FFmpeg 也将接合多个视频部分,并创建一个单个视频文件。
|
||||
|
||||
创建包含你想接合文件的准确的路径的 **join.txt** 。所有的玩家应该是相同的格式(相同格式)。所有文件的路径应该依次地提到,像下面。
|
||||
|
||||
```
|
||||
file /home/sk/myvideos/part1.mp4
|
||||
file /home/sk/myvideos/part2.mp4
|
||||
file /home/sk/myvideos/part3.mp4
|
||||
file /home/sk/myvideos/part4.mp4
|
||||
```
|
||||
|
||||
现在,接合所有文件,使用命令:
|
||||
|
||||
```
|
||||
$ ffmpeg -f concat -i join.txt -c copy output.mp4
|
||||
```
|
||||
|
||||
如果你得到一些像下面的错误;
|
||||
|
||||
```
|
||||
[concat @ 0x555fed174cc0] Unsafe file name '/path/to/mp4'
|
||||
join.txt: Operation not permitted
|
||||
```
|
||||
|
||||
添加 **“-safe 0”** :
|
||||
|
||||
```
|
||||
$ ffmpeg -f concat -safe 0 -i join.txt -c copy output.mp4
|
||||
```
|
||||
|
||||
上面的命令将接合 part1.mp4,part2.mp4,part3.mp4,和 part4.mp4 文件到一个称为“output.mp4”的单个文件中。
|
||||
|
||||
##### **17\. 添加字幕到一个视频文件**
|
||||
|
||||
我们可以使用 FFmpeg 来添加字幕到一个视频文件。为你的视频下载正确的字母,并如下所示添加它到你的视频。
|
||||
|
||||
```
|
||||
$ fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
|
||||
```
|
||||
|
||||
##### **18\. 预览或测试视频或音频文件**
|
||||
|
||||
你可能希望通过预览来验证或测试输出的文件是否已经被恰当地转码编码。为完成预览,你可以从你的终端播放它,用命令:
|
||||
|
||||
```
|
||||
$ ffplay video.mp4
|
||||
```
|
||||
|
||||
[![][1]][7]
|
||||
|
||||
类似地,你可以测试音频文件,像下面所示。
|
||||
|
||||
```
|
||||
$ ffplay audio.mp3
|
||||
```
|
||||
|
||||
[![][1]][8]
|
||||
|
||||
##### **19\. 增加/减少视频播放速度**
|
||||
|
||||
FFmpeg 允许你调整视频播放速度。
|
||||
|
||||
为增加视频播放速度,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" output.mp4
|
||||
```
|
||||
|
||||
该命令将双倍视频的速度。
|
||||
|
||||
为降低你的视频速度,你需要使用一个倍数 **大于 1** 。为减少播放速度,运行:
|
||||
|
||||
```
|
||||
$ ffmpeg -i input.mp4 -vf "setpts=4.0*PTS" output.mp4
|
||||
```
|
||||
|
||||
##### **20. 创建动画的 GIF
|
||||
|
||||
**
|
||||
|
||||
我们在几乎所有的社交和专业网络上为各种各样的目的使用 GIF 图像。使用 FFmpeg,我们可以简单地和快速地创建动画的视频文件。下面的指南阐释,如何在类 Unix 系统中使用 FFmpeg 和 ImageMagick T创建一个动画的 GIF 文件。
|
||||
|
||||
* [**在 Linux 中如何创建动画的 GIF**][9]
|
||||
|
||||
|
||||
|
||||
##### **21.** 从 PDF 文件中创建视频
|
||||
|
||||
我长年累月的收集很多 PDF 文件,大多数是 Linux 教程,保存在我的平板电脑中。有时我懒得从平板电脑中月度它们。因此,我决定从 PDF 文件中创建一个视频,在一个大屏幕设备(像一台电视机或一台电脑)中观看它们。如果你曾经想知道如何从一批 PDF 文件中制作一个电影,下面的指南将帮助你。.
|
||||
|
||||
* [**在 Linux 中如何从 PDF 文件中创建一个视频**][10]
|
||||
|
||||
|
||||
|
||||
##### **22\. 获取帮助**
|
||||
|
||||
在这个指南中,我已经覆盖大多数常常使用的 FFmpeg 命令。 它有很多不同的选项来做各种各样的高级功能。为学习更多,参考手册页。
|
||||
|
||||
```
|
||||
$ man ffmpeg
|
||||
```
|
||||
|
||||
然后,这就是全部。我希望这个指南将帮助你 FFmpeg 入门。如果你发现这个指南有用,请在你的社交和专业网络上分享它。更多好东西将要来。敬请期待!
|
||||
|
||||
谢谢!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/20-ffmpeg-commands-beginners/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.ostechnix.com/wp-content/uploads/2017/05/FFmpeg-Commands-720x340.png
|
||||
[2]: https://www.ostechnix.com/install-ffmpeg-linux/
|
||||
[3]: http://www.ostechnix.com/wp-content/uploads/2017/05/sk@sk_001.png
|
||||
[4]: https://ostechnix.tradepub.com/free/w_make141/prgm.cgi
|
||||
[5]: https://ostechnix.tradepub.com/free/w_make75/prgm.cgi
|
||||
[6]: https://ostechnix.tradepub.com/free/w_make235/prgm.cgi
|
||||
[7]: http://www.ostechnix.com/wp-content/uploads/2017/05/Menu_004.png
|
||||
[8]: http://www.ostechnix.com/wp-content/uploads/2017/05/Menu_005-3.png
|
||||
[9]: https://www.ostechnix.com/create-animated-gif-ubuntu-16-04/
|
||||
[10]: https://www.ostechnix.com/create-video-pdf-files-linux/
|
Loading…
Reference in New Issue
Block a user