How to create video by using FFmpeg with solid background color with desired length?

Here i have used the following FFmpeg command to create video with solid background color and desired length video. Here i have given the set of useful command to achieve same ouput. 


1) Create video frame with colored background 


 ffmpeg -f lavfi -i color=c=green:s=600×400:d=3.20 outputl.mp4 
 ffmpeg -f lavfi color=c=#ADFF2F:s=600×400:d=3.20 output3.mp4 

2) write text on video frame in single command from text file and using font type and font color. 


ffmpeg -f lavfi color=c=#006400:s=600×400:d=5.20 -vf drawtext=’fontfile=C\:/Windows/Fonts/arial.ttf:fontsize=30: fontcohor=white:x=(w-text_w)/2:y=(h-text_h)/2:textfile=’hello.txt’ ” output21.mp4   


3) Setting image in background of video frame.

ffmpeg -loop 1 -i Lighthouse.jpg -vframes 100 -vf scale-720:-1 -acodec copy -threads 12 imgoutput.mp4 


ffmpeg -i imageoutput.mp4 imgoutputFinal.mp4

4) Join multiple mp4 video files into one video. 

    ffmpeg -f concat join.txt -c copy joined.mp4



5) Adding audio file with Video file mp4.

  ffmpeg joined.mp4 mechanicalgatew.wav -shortest output.mp4 



Use following FFmpeg command to write text on video frame in single command from text file and using font type and time duration parameter.

ffmpeg -f lavfi -i color=c=green:s=600×400:d=3.20 -vf drawtext=”fontfile=C\:/Windows/Fonts/arial.ttf:fontsize=30: fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:textfile=’hello.txt'” output1.mpg

*Note:  d=3.20, this is defined time for video length.



<<Previous                          Next>>


Leave a Comment