Skip to content

Instantly share code, notes, and snippets.

@ciaran
Created November 8, 2016 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciaran/f37d71332d764d46aba6e1655099a4af to your computer and use it in GitHub Desktop.
Save ciaran/f37d71332d764d46aba6e1655099a4af to your computer and use it in GitHub Desktop.
FRAME_COUNT=$(ffprobe -v error -count_frames -select_streams v:0 \
-show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 \
"$INPUT")
FPS=$(ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate "$INPUT")
ffmpeg -y \
-r "$FPS" -i "$INPUT" \
-loop 1 -r "$FPS" -i "$WATERMARK" \
-filter_complex \
"[1:v][0:v]scale2ref[logo][video]; \
[video][logo]overlay=:x=0:y=0:enable='eq(n,${FRAME_COUNT}-1):eof_action=pass'" \
-shortest "${OUTPUT_VIDEO}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment