From a18ee76013b8fd56eb46a372b3b99a80c225825a Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Sat, 21 Sep 2024 18:00:32 +0700 Subject: [PATCH] feat: add ffmpeg --- docs/2023-07-01-pastebin.html | 58 +++++++++++++++++++++++++---------- posts/2023-07-01-pastebin.md | 41 ++++++++++++++++--------- 2 files changed, 69 insertions(+), 30 deletions(-) diff --git a/docs/2023-07-01-pastebin.html b/docs/2023-07-01-pastebin.html index 839f161..bd236d2 100644 --- a/docs/2023-07-01-pastebin.html +++ b/docs/2023-07-01-pastebin.html @@ -412,30 +412,30 @@ rsync -avzP src/ dst

- F2 + ffmpeg

-

Rename:

-
# If dry run, remove --exec
-f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec
-
-# Include ImageSize (require exiftool)
-f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec
-
-# Not include time
-f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec
-
-# Remove space in directory
-f2 --find " " --replace "_" --string-mode --only-dir --exec
+
# -crf: quality, 0 is lossless, more is lower quality
+# -an: no audio 
+# -c:a aac -b:a 128k: audio codec and bitrate
+ffmpeg -i input -c:v libx265 -crf 26 -preset fast -an output.mp4
+

Links:

+

libvips @@ -480,6 +480,32 @@ vips rot filename.jxl new_filename.jxl d90
yt-dlp -f - "https://www.youtube.com/watch?v=video_id"
+
+

+ F2 +

+ +
+

Rename:

+
+
# If dry run, remove --exec
+f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec
+
+# Include ImageSize (require exiftool)
+f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec
+
+# Not include time
+f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec
+
+# Remove space in directory
+f2 --find " " --replace "_" --string-mode --only-dir --exec
+
Feel free to ask me via diff --git a/posts/2023-07-01-pastebin.md b/posts/2023-07-01-pastebin.md index 7eb59fb..09ed540 100644 --- a/posts/2023-07-01-pastebin.md +++ b/posts/2023-07-01-pastebin.md @@ -296,24 +296,19 @@ Be careful flags (need dry run if not sure): - `--delete`: delete files in **dst** if not exist in **src**, useful to sync dst with src -## [F2](https://github.com/ayoisaiah/f2) - -Rename: +## [ffmpeg](https://github.com/FFmpeg/FFmpeg) ```sh -# If dry run, remove --exec -f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec - -# Include ImageSize (require exiftool) -f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec - -# Not include time -f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec - -# Remove space in directory -f2 --find " " --replace "_" --string-mode --only-dir --exec +# -crf: quality, 0 is lossless, more is lower quality +# -an: no audio +# -c:a aac -b:a 128k: audio codec and bitrate +ffmpeg -i input -c:v libx265 -crf 26 -preset fast -an output.mp4 ``` +Links: + +- [H.265/HEVC Video Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/H.265) + ## [libvips](https://github.com/libvips/libvips) Convert: @@ -341,3 +336,21 @@ Download: ```sh yt-dlp -f - "https://www.youtube.com/watch?v=video_id" ``` + +## [F2](https://github.com/ayoisaiah/f2) + +Rename: + +```sh +# If dry run, remove --exec +f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec + +# Include ImageSize (require exiftool) +f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec + +# Not include time +f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec + +# Remove space in directory +f2 --find " " --replace "_" --string-mode --only-dir --exec +```