You can use multi-platform FFmpeg encoder and command line tool to convert H.264 video data to M2TS video format. Install FFmpeg and type to command line:
ffmpeg -i /path/to/your/file.h264 -vcodec copy -acodec copy /path/to/your/newfile.m2ts
Updated: April 15, 2022