Skip to content

Instantly share code, notes, and snippets.

@fsalehpour
Last active April 25, 2024 17:46
Show Gist options
  • Select an option

  • Save fsalehpour/0cae06d8698c652f3c62d944d8ece9a4 to your computer and use it in GitHub Desktop.

Select an option

Save fsalehpour/0cae06d8698c652f3c62d944d8ece9a4 to your computer and use it in GitHub Desktop.

Revisions

  1. fsalehpour revised this gist Nov 5, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions watermark.bash
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,11 @@ mkdir -p output
    for i in *
    do
    output="output/$(echo $i | sed 's/\..*$/\.mp4/')"
    T=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$i")
    HEIGHT=$(ffprobe -v error -show_entries stream=height -of default=noprint_wrappers=1:nokey=1 "$i")
    T=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$i")
    HEIGHT=$(ffprobe -v error -show_entries stream=height -of default=noprint_wrappers=1:nokey=1 "$i")

    ffmpeg -i "$dir/logo.png" -y -v quiet -vf scale=-1:$HEIGHT/12 "$dir/scaled.png"
    ffmpeg -i "$dir/logo.png" -y -v quiet -vf scale=-1:$HEIGHT/12 "$dir/scaled.png"

    ffmpeg -i "$i" -i "$dir/scaled.png" -filter_complex "overlay=((W-w)/$T)*t:100,scale=-1:240" "$output"
    ffmpeg -i "$i" -i "$dir/scaled.png" -filter_complex "overlay=((W-w)/$T)*t:100,scale=-1:240" "$output"
    done
    )
  2. fsalehpour created this gist Nov 5, 2017.
    18 changes: 18 additions & 0 deletions watermark.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash

    dir=$(pwd)

    (cd $1
    mkdir -p output

    for i in *
    do
    output="output/$(echo $i | sed 's/\..*$/\.mp4/')"
    T=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$i")
    HEIGHT=$(ffprobe -v error -show_entries stream=height -of default=noprint_wrappers=1:nokey=1 "$i")

    ffmpeg -i "$dir/logo.png" -y -v quiet -vf scale=-1:$HEIGHT/12 "$dir/scaled.png"

    ffmpeg -i "$i" -i "$dir/scaled.png" -filter_complex "overlay=((W-w)/$T)*t:100,scale=-1:240" "$output"
    done
    )