How to correctly read bitstreams in Python

365 Views Asked by At

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.

0

There are 0 best solutions below