Q:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 106: character maps to 

im trying to merge multiple ts file into one if i try to run it it gives me the 

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 106: character maps to 

count = 76
main = "tsPath/seg_768x432_725648_"

for x in range(count):
    z = main+str(x)+".ts"
    print(z)
    with open(output, 'wb') as f:
        with open(z) as fh:
            f.write(fh.read())

A:

Okay, I see the problem now.
Solution
Assuming that the files exist on your computer, the following code will work correctly:
count = 76
main = "tsPath/seg_768x432_725648_"

with open(output, 'wb') as f:
    for x in range(count):
        z = main+str(x)+".ts"
        print(z)
        with open(z, 'rb') as fh:
            f.write(fh.read())

What changes were made and why?

Notice that the loop is inside the with block of open(output, 'wb') not the other way round. This needs to be done because every time you open a file in wb mode, all the data that existed in the file earlier is erased (same with w mode as well). So, we only open the output file for writing once. This will allow you to accumulate the data from the files you are reading (which is what you want to do).
The mode parameter of the open function is set to r(read text) by default. You are reading binary data so use rb mode. (Other answers got this point right but missed point #1).

