Tell me how to write bitstreams correctly
Here is my code, it works, but it seems to me that I am not writing data to the file correctly.
fd = stream.open()
filename = 'file.ts'
while True:
data = fd.read(8192)
file_output = open(filename, "ab")
file_output.write(data)
fd is a data stream, it is replenished and, accordingly, I must read from it until it ends.