Improve the concatenate script for handling both ts and mp4
Finally, making concat works.