split files
ffmpeg -i introVideoWithLogo.mp4 -y -filter_complex ^
"split=2[out1][out2]" -map "[out1]" -ss 0 -t 10.4 -map 0 output1.mp4 -map "[out2]" -ss 10.5 -t 7 -map 0 output2.mp4
scale file
ffmpeg -i cure4UrinaryProblems.mp4 -vf "scale='min(640,iw)':min'(352,ih)':force_original_aspect_ratio=decrease,pad=640:352:-1:-1:color=pink" scaled.mp4
Crop files
set OUTPUT_FILE="vlogOpener.mp4"
set CROP_WIDTH=1366
set CROP_HEIGHT=768
set CROP_STARTX=277
set CROP_STARTY=156
set OUTPUT_FILE="vlogOpener%CROP_WIDTH%x%CROP_HEIGHT%.mp4"
ffmpeg -i vlogOpener1920x1080.mp4 -filter:v "crop=%CROP_WIDTH%:%CROP_HEIGHT%:%CROP_STARTX%:%CROP_STARTy%" -c:v libx264 -pix_fmt yuv420p %OUTPUT_FILE% -y
concat files https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg
ffmpeg -i output1.mp4 -i output2.mp4 -filter_complex ^
"[0:v] [0:a] [1:v] [1:a] ^
concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" concatOutput.mp4
set target bit rate
set TARGET_BITRATE=278
ffmpeg -i output2.mp4 -c:v libx264 -b:v %TARGET_BITRATE%k -y output2_%TARGET_BITRATE%k.mp4
ffmpeg -i output1.mp4 -c:v libx264 -b:v %TARGET_BITRATE%k -y output1_%TARGET_BITRATE%k.mp4
concat with vsync when bit rates differ
set CONTENT_FOLDER=sajeev
set CONTENT_FILE=scaled
ffmpeg -i output1_%TARGET_BITRATE%k.mp4 -i "%CONTENT_FOLDER%/%CONTENT_FILE%.mp4" -i output2_%TARGET_BITRATE%k.mp4 -filter_complex ^
"[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" "%CONTENT_FOLDER%/%CONTENT_FILE%_OP.mp4" -y -vsync 2
ffmpeg -i output1.mp4 -i "%CONTENT_FOLDER%/%CONTENT_FILE%.mp4" -i output2.mp4 -filter_complex ^
"[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" "%CONTENT_FOLDER%/%CONTENT_FILE%_OP2.mp4" -y -vsync 2
add watermark
PS : while setting WATERMARK_TEXT care should be taken escape charachters ,;'" with \ etc
set WATERMARK_TEXT='Dr. Sajeev Pancha Kailasi\: Curing Urinary Issues with Yogasanas. Patanjali Yoga Training and Research Centre\, Kochi\, Kerala'
set FILENAME_WITH_WATERMARK="%CONTENT_FOLDER%/%CONTENT_FILE%_OP2_wwm.mp4"
ffmpeg -i "%CONTENT_FOLDER%/%CONTENT_FILE%_OP2.mp4" -filter_complex drawtext="fontfile='D:/projects/tests/ReactJS/vlogMaker/Fonts/ITCBLKAD.TTF':fontsize=20:fontcolor=orange@.5:box=1:boxcolor=white@0.1:shadowcolor=black@0.5:shadowx=2:shadowy=2:text=%WATERMARK_TEXT%:y=h-line_h-50:x=(mod(1*n\,w+tw)-tw)" "%FILENAME_WITH_WATERMARK%" -y
Scrolling from right to left : One time
<https://superuser.com/questions/1026763/scrolling-from-right-to-left-in-ffmpeg-drawtext>
ffmpeg -i "%CONTENT_FOLDER%/%CONTENT_FILE%_OP2.mp4" -filter_complex drawtext="fontfile='D:/projects/tests/ReactJS/vlogMaker/Fonts/ITCBLKAD.TTF':fontsize=20:fontcolor=orange@.5:box=1:boxcolor=white@0.1:shadowcolor=black@0.5:shadowx=2:shadowy=2:text=%WATERMARK_TEXT%:y=h-line_h-50:x=w-(t-10)*w/5.5" "%FILENAME_WITH_WATERMARK%" -y
Scrolling from right to left loop
ffmpeg -i "%CONTENT_FOLDER%/%CONTENT_FILE%_OP2.mp4" -filter_complex drawtext="fontfile='D:/projects/tests/ReactJS/vlogMaker/Fonts/ITCBLKAD.TTF':fontsize=20:fontcolor=orange@.5:box=1:boxcolor=white@0.1:shadowcolor=black@0.5:shadowx=2:shadowy=2:text=%WATERMARK_TEXT%:y=h-line_h-50:x=w-mod(max(t-4.5\,0)*(w+tw)/60\,(w+tw))" "%FILENAME_WITH_WATERMARK%" -y
Create videos from image and concatenating them with effects
<https://superuser.com/a/778967>
ffmpeg -y -i output1.mp4 -i output2.mp4 -f lavfi -i color=black:s=640x352 -filter_complex ^
"[0:v]format=pix_fmts=yuva420p,fade=t=out:st=7:d=3:alpha=1,setpts=PTS-STARTPTS[v0]; ^
[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=3:alpha=1,fade=t=out:st=4:d=3:alpha=1,setpts=PTS-STARTPTS+10/TB[v1]; ^
[2:v]trim=duration=17[over]; ^
[over][v0]overlay[over1]; ^
[over1][v1]overlay=format=yuv420[outv]" -vcodec libx264 -map [outv] merge.mp4
with 3 videos
ffmpeg -y -i part1.mp4 -i part2.mp4 -i part3.mp4 -f lavfi -i color=black:s=1920x1080 -filter_complex \
"[0:v]format=pix_fmts=yuva420p,fade=t=out:st=10:d=1:alpha=1,setpts=PTS-STARTPTS[v0]; \
[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=10:d=1:alpha=1,setpts=PTS-STARTPTS+10/TB[v1]; \
[2:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=10:d=1:alpha=1,setpts=PTS-STARTPTS+20/TB[v2]; \
[3:v]trim=duration=30[over]; \
[over][v0]overlay[over1]; \
[over1][v1]overlay[over2]; \
[over2][v2]overlay=format=yuv420[outv]" \
-vcodec libx264 -map [outv] merge.mp4
With xfade
<https://superuser.com/questions/778762/crossfade-between-2-videos-using-ffmpeg>
<https://trac.ffmpeg.org/wiki/Xfade>
ffmpeg -y -i output1.mp4 -i output2.mp4 -filter_complex ^
"[0:v][1:v]xfade=transition=circlecrop:duration=2:offset=8[outv];^
[0:a][1:a]acrossfade=duration=2[outa]" -map [outv] -map [outa] xfadeOutput.avi
CreateVlog.bat
@echo off
setlocal
set CONTENT_FOLDER=sajeev
set INPUT_FILE="YOGA_4_STUDENTS"
set WATERMARK_TEXT='Dr. Sajeev Pancha Kailasi\: YOGA FOR STUDENTS. Patanjali Yoga Training and Research Centre\, Kochi\, Kerala'
set WATERMARK_THUMBNAIL="pytrc-logo-square_thumbnail.png"
rem set output file names-------------------------------------------------------------------------------------------------
set SCALED_OUTPUT_FILE=%INPUT_FILE%_scaled
set OUTPUT_FILE_WITH_WATERMARK_IMAGE=%INPUT_FILE%_scaled_wwi
set FILENAME_WITH_WATERMARK_TEXT=%INPUT_FILE%_OP_wwmT
set FINAL_FILE_4_YT=%INPUT_FILE%_4YT
rem scale video
ffmpeg -i "%CONTENT_FOLDER%/%INPUT_FILE%.mp4" -vf ^
"scale='min(640,iw)':min'(352,ih)':force_original_aspect_ratio=decrease,pad=640:352:-1:-1:color=pink" "%CONTENT_FOLDER%/%SCALED_OUTPUT_FILE%.mp4" -y
rem add water mark image
ffmpeg -i "%CONTENT_FOLDER%/%SCALED_OUTPUT_FILE%.mp4" -i %WATERMARK_THUMBNAIL% -filter_complex "overlay=main_w-(overlay_w+10):10" "%CONTENT_FOLDER%/%OUTPUT_FILE_WITH_WATERMARK_IMAGE%.mp4" -y
rem add water mark text
ffmpeg -i "%CONTENT_FOLDER%/%OUTPUT_FILE_WITH_WATERMARK_IMAGE%.mp4" -filter_complex drawtext="fontfile='D:/projects/tests/ReactJS/vlogMaker/Fonts/ITCBLKAD.TTF':fontsize=20:fontcolor=orange@.5:box=1:boxcolor=white@0.1:shadowcolor=black@0.5:shadowx=2:shadowy=2:text=%WATERMARK_TEXT%:y=h-line_h-50:x=w-mod(max(t-1\,0)*(w+tw)/60\,(w+tw))" "%CONTENT_FOLDER%/%FILENAME_WITH_WATERMARK_TEXT%.mp4" -y
rem concat video
ffmpeg -i output1.mp4 -i "%CONTENT_FOLDER%/%FILENAME_WITH_WATERMARK_TEXT%.mp4" -i output2.mp4 -filter_complex ^
"[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" "%CONTENT_FOLDER%/%FINAL_FILE_4_YT%.mp4" -y -vsync 2
set /p id="Press any key to continue: "
|
|