Skip to content

Commit f487937

Browse files
committed
Improve ffmpeg watermark and logo
Improve ffmpeg watermark and logo Signed-off-by: Bensuperpc <[email protected]>
1 parent 83fafbe commit f487937

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

Commands.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ For encoding, creating, recording or downloading videos
147147
- [`h265-nvenc`](#h265-nvenc)
148148
- [`youtube-dl-playlist-full`](#youtube-dl-playlist-full)
149149
- [`youtube-dl-playlist-audio`](#youtube-dl-playlist-audio)
150-
- [`add-watermark`](#add-watermark)
150+
- [`add-video-watermark`](#add-video-watermark)
151+
- [`add-video-logo`](#add-video-logo)
151152
- (WIP)
152153
### clean-arch
153154

@@ -732,12 +733,20 @@ Mount directory in RAM
732733
$ mount-ram <path to mount> <size (in MB/Mo)>
733734
```
734735

735-
### add-watermark
736+
### add-video-watermark
736737

737738
Add watermark in video
738739

739740
```bash
740-
$ add-watermark <input video> <logo> <overlay X (from from the top-left)> <overlay Y (from from the top-left)> <output>
741+
$ add-video-watermark <input video> <text> <output>
742+
```
743+
744+
### add-video-logo
745+
746+
Add logo (ex: .png) in video
747+
748+
```bash
749+
$ add-video-logo <input video> <logo> <overlay X (from from the top-left)> <overlay Y (from from the top-left)> <output>
741750
```
742751

743752
### screen-capture

video/add-watermark.sh renamed to video/add-video-logo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -euo pipefail
1111
#// //
1212
#// Script, 2021 //
1313
#// Created: 02, August, 2021 //
14-
#// Modified: 02, August, 2021 //
14+
#// Modified: 03, August, 2021 //
1515
#// file: - //
1616
#// - //
1717
#// Source: https://arccoder.medium.com/ffmpeg-add-a-logo-on-video-bf1f4652792a //
@@ -24,7 +24,7 @@ set -euo pipefail
2424
type ffmpeg >/dev/null 2>&1 || { echo "ffmpeg could not be found" >&2; exit 1; }
2525

2626
if (( $# == 5 )); then
27-
ffmpeg -i "$1" -i "$2" -filter_complex "overlay='$3':'$4'" "$5"
27+
ffmpeg -i "$1" -i "$2" -filter_complex "overlay='$3':'$4'" "$5" -c:v libx264 -crf 18 -bf 2 -profile:v high -c:a copy
2828
else
2929
echo "Usage: ${0##*/} <input video> <logo> <overlay X (from from the top-left)> <overlay Y (from from the top-left)> <output>"
3030
exit 1

video/add-video-watermark.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
#//////////////////////////////////////////////////////////////
4+
#// ____ //
5+
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
6+
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
7+
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
8+
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
9+
#// |_| |_| //
10+
#//////////////////////////////////////////////////////////////
11+
#// //
12+
#// Script, 2021 //
13+
#// Created: 02, August, 2021 //
14+
#// Modified: 03, August, 2021 //
15+
#// file: - //
16+
#// - //
17+
#// Source: https://arccoder.medium.com/ffmpeg-add-a-logo-on-video-bf1f4652792a //
18+
#// OS: ALL //
19+
#// CPU: ALL //
20+
#// //
21+
#//////////////////////////////////////////////////////////////
22+
23+
24+
type ffmpeg >/dev/null 2>&1 || { echo "ffmpeg could not be found" >&2; exit 1; }
25+
26+
if (( $# == 3 )); then
27+
ffmpeg -i "$1" -vf "drawtext=text='$2':[email protected]:fontsize=26:box=1:[email protected]:boxborderw=5:x=(w-text_w)/1.0625:y=(h-text_h)/1.0625" -c:v libx264 -crf 18 -preset slow -pix_fmt yuv420p -bf 2 -profile:v high -c:a copy "$3"
28+
else
29+
echo "Usage: ${0##*/} <input video> <text> <output>"
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)