I have developed a small batch script using ffmpeg library that can add a video lip at the starting of all the videos containing in the folder
Here is my script:
@echo off
mkdir append
(for %%i in (*.mp4) do @echo %%i) > append/mymp4list.txt
ffmpeg -i main.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts -y append/main.ts
for /F "tokens=*" %%A in (append/mymp4list.txt) do (
echo %%A
ffmpeg -i %%A -c copy -bsf:v h264_mp4toannexb -f mpegts -y append/%%A.ts
ffmpeg -i "concat:append/main.ts|append/%%A.ts" -c copy -bsf:a aac_adtstoasc -y append/%%A_output.mp4
)
it is working fine with video that has names with only digits or characters like sample.mp4 and video123.mp4
but when name of video file contains special characters or white space(like 2016-17 video - English - gateway (1).mp4 )it shows error in this line :
ffmpeg -i "concat:append/main.ts|append/%%A.ts" -c copy -bsf:a aac_adtstoasc -y append/%%A_output.mp4
where main.ts is starting clip of video and %%A is name of video from text file.
can someone tell me that how do i perform concatenate operation of video file when video file name contains special characters or white space ?