Created
April 24, 2018 12:37
-
-
Save olegwtf/debe04585ee54d0ace884ecb90ada329 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# image at the center of the video | |
# https://stackoverflow.com/questions/10918907/how-to-add-transparent-watermark-in-center-of-a-video-with-ffmpeg | |
ffmpeg -i small.mp4 -i avatar.png -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.mp4 | |
# with transparency | |
# https://stackoverflow.com/questions/38753739/ffmpeg-overlay-a-png-image-on-a-video-with-custom-transparency | |
ffmpeg -i small.mp4 -i avatar.png -filter_complex "[1:v]format=argb,colorchannelmixer=aa=0.5[zork];[0:v][zork]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.mp4 | |
# text | |
# https://stackoverflow.com/questions/17623676/text-on-video-ffmpeg | |
ffmpeg -i small.mp4 -vf drawtext="fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: text='Hello World': fontcolor=white: fontsize=24: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -codec:a copy output.mp4 | |
# text with image | |
ffmpeg -i small.mp4 -i avatar.png -filter_complex '[1:v]drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: text="Hello World": fontcolor=white: fontsize=24: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2[zork];[0:v][zork]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' -codec:a copy output.mp4 | |
# only first 3 seconds | |
# https://superuser.com/questions/683643/how-to-add-my-logo-for-the-first-30-seconds-in-a-video-with-ffmpeg | |
ffmpeg -i small.mp4 -i avatar.png -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable=between(t\,0\,3)" -codec:a copy output.mp4 | |
# several | |
ffmpeg -i SampleVideo.mp4 -i avatar.png -i avatar1.png -filter_complex "[0:v][1:v]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable=between(t\,0\,10)[zork];[zork][2:v]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable=between(t\,10\,20)" -codec:a copy output.mp4 | |
# fade in effect for image | |
# https://superuser.com/questions/833232/create-video-with-5-images-with-fadein-out-effect-in-ffmpeg | |
ffmpeg -i small.mp4 -loop 1 -i avatar.png -filter_complex "[1:v]fade=t=in:st=0:d=1:alpha=1[zork]; [0:v][zork]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy -shortest output.mp4 | |
# fade in effect for text | |
ffmpeg -i small.mp4 -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: text='Hello World': fontcolor_expr='ffffff%{eif\\: if(between(t\, 0\, 3)\, t*85\, 255) \\: x \\: 2}': fontsize=24: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -codec:a copy output.mp4 | |
ffmpeg -i SampleVideo.mp4 -loop 1 -i avatar.png -filter_complex "[1:v]format=argb,colorchannelmixer=aa=0.5, fade=t=in:st=0:d=1:alpha=1, fade=t=out:st=14:d=1:alpha=1, drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: text='Hello World': fontcolor_expr='ffffff%{eif\\: if(between(t\, 0\, 1)\, t*255\, if(between(t\, 6\, 7)\, 255+255*(6-t)\, 255)) \\: x \\: 2}': fontsize=24: box=1: boxcolor=white@0: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2 : enable=between(t\,0\,7), drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: text='And other People': fontcolor_expr='ffffff%{eif\\: if(between(t\, 8\, 9)\, -(8-t)*255\, 255) \\: x \\: 2}': fontsize=24: box=1: boxcolor=white@0: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2 : enable=between(t\,8\,15)[zork]; [0:v][zork]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable=between(t\,0\,15)" -codec:a copy -shortest output.mp4 | |
ffmpeg -i small.mp4 -i t%d.png -filter_complex "[1:v]format=argb,colorchannelmixer=aa=0.7[zork];[0:v][zork]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:enable=between(t\,0\,3)" -codec:a copy output.mp4 | |
# video to frames (first second) | |
ffmpeg -t 1 -i wrk.mp4 -r 25 o%d.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment