summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/articles/ffmpeg-tips.md95
1 files changed, 84 insertions, 11 deletions
diff --git a/content/articles/ffmpeg-tips.md b/content/articles/ffmpeg-tips.md
index be647b6..2a692bd 100644
--- a/content/articles/ffmpeg-tips.md
+++ b/content/articles/ffmpeg-tips.md
@@ -5,25 +5,98 @@ draft: false
tags: ['Tech', 'Linux', 'Guide']
---
-FFmpeg is one of my favorite programs, though it can be quite difficult to learn.
-This page is dedicated to sharing the commands and knowledge I've accumulated over my time of using FFmpeg.
+FFmpeg is one of my favorite tools, though it can be quite challenging to master. This page is dedicated to sharing the commands and knowledge I've accumulated from using FFmpeg.
-**More will come to this page soon!**
+**Check back soon for more updates!**
-## To record screen.
+## Encoding Videos
-`ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 test.mkv`
+Here's a simple reference for re-encoding videos.
+
+### WEBM
+
+For WEBM files, there are three common codecs: VP8, VP9, and AV1[^1].
+
+#### VP8
+
+```bash
+ffmpeg -i video.mkv -c:v libvpx -c:a libvorbis video.webm
+```
+
+#### VP9
+
+```bash
+ffmpeg -i video.mkv -c:v libvpx-vp9 -c:a libopus video.webm
+```
+
+#### AV1
+
+```bash
+ffmpeg -i video.mkv -c:v libsvtav1 -c:a libopus video.webm
+```
+
+### MP4
+
+For MP4 files, you can use the following codecs:
+
+#### H.264 (x264)
+
+```bash
+ffmpeg -i video.mkv -c:v libx264 -c:a aac video.mp4
+```
+
+#### H.265 (x265)
+
+```bash
+ffmpeg -i video.mkv -c:v libx265 -c:a aac video.mp4
+```
+
+#### NVIDIA NVENC H.264
+
+If you have an NVIDIA GPU, you can use the NVENC encoder for H.264:
+
+```bash
+ffmpeg -i video.mkv -c:v h264_nvenc -c:a aac video.mp4
+```
+
+#### NVIDIA NVENC H.265
+
+For H.265 using NVIDIA NVENC:
+
+```bash
+ffmpeg -i video.mkv -c:v hevc_nvenc -c:a aac video.mp4
+```
+
+## Recording Screen
+
+To record your screen, use the following command:
+
+```bash
+ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 test.mkv
+```
You can also add `-framerate 30` to set a custom frame rate.
-## To record mic.
+### Recording Microphone
+
+To record audio from your microphone:
+
+```bash
+ffmpeg -f alsa -i default -c:a flac test.flac
+```
+
+### Recording Screen and Microphone
-`ffmpeg -f alsa -i default -c:a flac test.flac`
+To record both your screen and microphone:
-## To record screen and mic.
+```bash
+ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default test.mkv
+```
-`ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default test.mkv`
+With specific codecs:
-The command with codecs:
+```bash
+ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default -c:a flac -c:v libx264 test.mkv
+```
-`ffmpeg -y -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default -c:a flac -c:v libx264 test.mkv`
+[^1]: The FFmpeg codecs are: VP8 = `libvpx`, VP9 = `libvpx-vp9`, AV1 = `libsvtav1`.