You need to write the timecodes to a file and then mux them into the video.
Code:
vspipe --y4m <foo.vpy> --timecodes timecodes.txt - | ffmpeg -i pipe: -c:v libx265 -preset veryslow -crf 20 -vf "nlmeans=s=10" -y "outfoo.mkv"
Then:
Code:
mkvmerge --output finalfoo.mkv --timestamps 0:timecodes.txt outfoo.mkv