Created
May 3, 2016 15:35
-
-
Save dechadou/46a030a8b1a9cd5f02cdf61b45ff060c to your computer and use it in GitHub Desktop.
This file contains 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
/* First image to video, add background image for getting the correct aspect:ratio */ | |
/* Rescale the second image to fit height or width depending on their max size */ | |
/* Add zoom pan effect, from the center to the right */ | |
ffmpeg -i background.jpg -i firstimage.jpg -filter_complex "[1:v]scale='if(gt(a,4/3),1920,-1):if(gt(a,4/3),-1,1080)' [ovrl], [0:v][ovrl] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2, zoompan=z='zoom+0.001':x='if(gte(zoom,1.5),x+1)':d=1000" -t 5.96 -r 23.976 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1385 -s 1920x1080 -aspect 16:9 -c:v libx264 -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k firstImage.m2v | |
/* Do the same for third image */ | |
ffmpeg -i background.jpg -i https://s3-us-west-1.amazonaws.com/hyundai-nfl-uat-s3bucket/hyundai-nfl/uploads/userFiles/89/12473928-10208483723709039-458355032907144613-ojpg -filter_complex "[1:v]scale='if(gt(a,4/3),1920,-1):if(gt(a,4/3),-1,1080)' [ovrl], [0:v][ovrl] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2, zoompan=z='zoom+0.0001':x='if(gte(zoom,1.5),x+1)':d=999999" -t 3 -r 23.976 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1385 -s 1920x1080 -aspect 16:9 -c:v libx264 -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k thirdImage.m2v | |
/* Add footer to generated videos */ | |
ffmpeg -i firstImage.m2v -i footer.png -q:v 1 -filter_complex " [1:v]scale=1920:1080 [ovrl], [0:v][ovrl] overlay=0:0" -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k firstImageWithFooter.m2v | |
ffmpeg -i thirdImage.m2v -i footer.png -q:v 1 -filter_complex " [1:v]scale=1920:1080 [ovrl], [0:v][ovrl] overlay=0:0" -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k thirdImageWithFooter.m2v | |
/* Add text in position to generated videos */ | |
ffmpeg -i firstImageWithFooter.m2v -filter_complex " drawtext=fontfile=din-regular.ttf: text='Text':fontsize=60:fontcolor=white:x=90:y=960" -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k secondVideo.m2v | |
ffmpeg -i thirdImageWithFooter.m2v -filter_complex " drawtext=fontfile=din-regular.ttf: text='text2':fontsize=60:fontcolor=white:x=90:y=960" -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k fourthVideo.m2v | |
/* Create third video with image on the right top corner and paste on base video */ | |
ffmpeg -i 4b.m2v -i image.jpg -q:v 1 -filter_complex "[1:v]scale=715:-1 [ovrl], [0:v][ovrl] overlay=1160:120:enable='between(t,1,7)'" -r 23.976 -threads 2 -an -vcodec libx264 -b:v 6500k -minrate 6500k -maxrate 6500k -bufsize 1835k thirdVideo.m2v | |
/* Concatenate all videos togheter and add audio */ | |
ffmpeg -i "concat:first.m2v|secondVideo.m2v|thirdVideo.m2v|fourthVideo.m2v|fifth.m2v" -i 4.aac -c:v libx264 -c:a copy -bsf:a aac_adtstoasc -preset ultrafast -threads 2 finalVideo.mp4 | |
/* take screenshot of the video for facebook and scale it */ | |
ffmpeg -ss 00:00:16.010 -i 1462202904.mp4 -vf scale="1200:627" -vframes 1 -q:v 2 output.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment