set filename=%1
set outfnm=%2
set metafnm=%3
SplitKMV.exe %filename%
AtomicParsley.exe xaa.mp4 --extract1uuid "kmvs"
AtomicParsley.exe xaa.mp4 --extract1uuid "kmvd"
AtomicParsley.exe xaa.mp4 --extract1uuid "kmve"
AtomicParsley.exe xaa.mp4 --extract1uuid "kmhq"
AtomicParsley.exe xaa.mp4 --extract1uuid "km4v"
AtomicParsley.exe xaa.mp4 --extract1uuid "khvq"
AtomicParsley.exe xaa.mp4 --metaEnema
ren xaa-temp-*.mp4 input.mp4
EditMetada.exe YAMB\MP4Box.exe input.mp4 %metafnm% tmp2.mp4
if exist xaa-kmvs-uuid.bin AtomicParsley.exe tmp2.mp4 --meta-uuid "kmvs" file xaa-kmvs-uuid.bin
if exist xaa-kmvd-uuid.bin AtomicParsley.exe tmp2.mp4 --meta-uuid "kmvd" file xaa-kmvd-uuid.bin
if exist xaa-kmve-uuid.key AtomicParsley.exe tmp2.mp4 --meta-uuid "kmve" file xaa-kmve-uuid.key
if exist xaa-kmhq-uuid.bin AtomicParsley.exe tmp2.mp4 --meta-uuid "kmhq" file xaa-kmhq-uuid.bin
if exist xaa-km4v-uuid.bin AtomicParsley.exe tmp2.mp4 --meta-uuid "km4v" file xaa-km4v-uuid.bin
if exist xaa-khvq-uuid.bin AtomicParsley.exe tmp2.mp4 --meta-uuid "khvq" file xaa-khvq-uuid.bin
if exist tmp2-temp*.* move /Y tmp2-temp*.* tmp2.mp4
del tmp.mp4
del input.mp4
copy /b tmp2.mp4+xab.bin tmp3.kmv
del tmp2.mp4
del xab.bin
del xaa.mp4
del xaa-kmvs-uuid.bin
del xaa-kmvd-uuid.bin
del xaa-kmve-uuid.key
del xaa-kmhq-uuid.bin
del xaa-km4v-uuid.bin
del xaa-khvq-uuid.bin
move /Y tmp3.kmv %outfnm%
