set dir=Nearheadon
md %dir%
set input=2020_0729_071652_981.MP4
ffmpeg -y -i %input% -ss 00:00:10.00 -to 00:00:37.99 -an -c copy -copyts %dir%/1.mp4
rem below line slows down
set filter= -filter:v "setpts=4.0*PTS"
rem line below would speed up
rem set filter= -filter:v "setpts=.50*PTS"
ffmpeg -y -i %input% -ss 00:00:20.50 -to 00:00:23.95 -an -c copy -copyts %dir%/tmp.3.mp4
ffmpeg -y -i %dir%/tmp.3.mp4 -an %filter% %dir%/3.%input%
ffmpeg -y -i %input% -ss 00:00:31.00 -to 00:00:38.00 -an -c copy -copyts %dir%/tmp.4.mp4
rem filter below crops a section
set filter= -filter:v "crop=1051:588:430:450" -c:a copy
ffmpeg -y -i %dir%/tmp.4.mp4 %filter% %dir%/tmp.tmp.4.mp4
set font=-vf drawtext="fontfile=c:/windows/fonts/Arial .ttf:
set text=text='Seems other vehicles are having problems following the lines and staying in their lanes':
set xy=x=1: y=540:
set sizeClr=fontsize=22: fontcolor=black@0.9: box=1: boxcolor=white@0.9" -acodec copy
set out=%dir%/4.mp4
ffmpeg -y -i %dir%/tmp.tmp.4.mp4 %font% %text% %xy% %sizeClr% %out%
set input=2020_0729_072553_990.mp4
ffmpeg -y -i %input% -ss 00:00:07.00 -to 00:00:17.00 -c copy -copyts %dir%/tmp.2a.mp4
ffmpeg -y -i %input% -ss 00:00:17.04 -to 00:00:33.04 -c copy -copyts %dir%/2b.mp4
set font=-vf drawtext="fontfile=c:/windows/fonts/Arial .ttf:
set text=text='Coming from the opposite direction (North bound this time)':
set xy=x=30: y=1150:
set sizeClr=fontsize=75: fontcolor=black@0.9: box=1: boxcolor=white@0.9" -acodec copy
ffmpeg -y -i %dir%/tmp.2a.mp4 %font% %text% %xy% %sizeClr% %dir%/2a.mp4
del %dir%\tmp.*
rem convert still images to videos
set input=6map-2.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 7 -pix_fmt yuv420p %dir%/%input%.mp4
set input=vlcsnap-2020-07-30-04h40m11s117.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 3 -pix_fmt yuv420p %dir%/vlc1.mp4
set input=vlcsnap-2020-07-30-04h40m19s760.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 3 -pix_fmt yuv420p %dir%/vlc2.mp4
set input=vlcsnap-2020-07-30-04h40m33s148.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 3 -pix_fmt yuv420p %dir%/vlc3.mp4
set input=vlcsnap-2020-07-30-04h40m40s965.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 3 -pix_fmt yuv420p %dir%/vlc4.mp4
set input=vlcsnap-2020-07-30-04h40m50s207.png
ffmpeg -y -loop 1 -i %input% -c:v libx264 -t 3 -pix_fmt yuv420p %dir%/vlc5.mp4
cd %dir%
rem convert all mp4 files to webm using an encoding suitable for youtube
set ffm=ffmpeg -y -i
set filter= -c:v libvpx-vp9 -crf 32 -b:v 0 -threads 2 -quality good -speed 1 -c:a libvorbis
for %%i in (*.mp4) do %ffm% %%i %filter% tmp.%%i.webm
rem merge all temp webm files to one file
set target=nearHeadon.webm
del %target%
(for %%i in (*.webm) do @echo file '%%i') > mylist.txt
ffmpeg -f concat -safe 0 -i mylist.txt -c copy %target%
rem remove all temp files
del tmp.* *.mp4 mylist.txt