@echo on

..\_tools\x264 --crf 18 --profile baseline --level 3.0 --ref 2 --keyint 30 --bframes 0 --sar 1:1 --force-cfr --fps 30000/1001 -o intro.264 1__TITLE-vid_to-append__w-sound.avi

..\_tools\ffmpeg -i 1__TITLE-vid_to-append__w-sound.avi -acodec pcm_s16le -ac 2 ..\_tools\QAAC-255-port\audio.wav
cd ..\_tools\QAAC-255-port

QAAC\qaac audio.wav --cbr 256 --no-delay -o intro_qaac_cbr256.m4a
move intro_qaac_cbr256.m4a ..\..\480-example\

del /q audio.wav
cd ..\..\480-example



..\_tools\ffmpeg -i intro_qaac_cbr256.m4a -acodec copy intro_qaac_cbr256.aac
..\_tools\ffmpeg -i intro.264 -i intro_qaac_cbr256.aac -bsf:a aac_adtstoasc -vcodec copy -acodec copy intro-w-sound.mp4

..\_tools\ffmpeg -i intro-w-sound.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
..\_tools\ffmpeg -i 2__ORIG-vid.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
..\_tools\ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc RESULT__w-sound.mp4



del /q intermediate?.ts
del /q intermediate??.ts
del /q intermediate???.ts
del /q intermediate????.ts
del /q *.264
del /q *.h264
del /q intro.264
del /q intro.mp4
del /q *.aac
del /q *.m4a
del /q intro-w-sound.mp4

