This is tested in macOS Mojave 10.14.6 (18G87)
Please make sure you install FFMPEG
library in your machine before using this gem.
gem install erika
A complete, cross-platform solution to record, convert and stream audio and video.
brew install ffmpeg
apt-get install ffmpeg
To compile images in ~/pictures/birthday
, you need to make sure files are named in proper order.
I recommend you to prefix the files with number like
- 0 My first birthday.jpg
- 1 My second birthday.jpg
- 2 My second birthday.jpg
- 3 My third birthday.jpg
single command to compile
cd ~/pictures
erika g -s birthday -o mybirthday.mp4
# This will generate video called `mybirthday.mp4`
erika help g
Usage:
erika g
Options:
-o, [--output=OUTPUT] # Output path; where to generate output movie
-s, [--source=SOURCE] # Input path; folder path where the images are located
-a, [--audio=AUDIO] # Audio path; the path to bg audio
-t, [--transition-duration=TRANSITION_DURATION] # Transition animation duration between two images
-S, [--slide-duration=SLIDE_DURATION] # Slide duration between two images
Generate movie
Example:-
erika g -s happy -S=5 -t=4 -o=opt/mymovie.mp4
Creating intermediate mpeg's for each image and then concatenate them
all into a video
.
For example, say you have 5
images; you would run this for each one of the
images to create the intermediate mpeg's with a fade in at the beginning and a fade out at the end.
ffmpeg -y -loop 1 -i <your-image> -vf "fade=t=in:st=0:d=0.5,fade=t=out:st=4.5:d=0.5" -c:v mpeg2video -t 5 -q:v 1 image-1.mpeg
where t
is the duration, or time, of each image. Once you have all of these mpeg's, you use
ffmpeg's concat command to combine them all into an mp4
.
ffmpeg -y -i image-1.mpeg -i image-2.mpeg -i image-3.mpeg -i image-4.mpeg -i image-5.mpeg -filter_complex '[0:v][1:v][2:v][3:v][4:v] concat=n=5:v=1 [v]' -map '[v]' -c:v libx264 -s 1280x720 -aspect 16:9 -q:v 1 -pix_fmt yuv420p output.mp4
-
get Image dimension
-
IMAGE SCALING
-
FFMPEG filters
-
Resizing and padding image
-
Capturing STD Streams to prevent logs being cluttered
-
Animation in Slide Transition
-
Image to Video Guide FFMPEG
-
Repeat Audio and generate a new audio file
-
Add Subtitles to the video
https://superuser.com/questions/547296/resizing-videos-with-ffmpeg-avconv-to-fit-into-static-sized-player/1136305#1136305 https://trac.ffmpeg.org/wiki/Concatenate