(Jul-20-2018, 11:23 PM)malonn Wrote: the basic approach I need is to open the file in binary mode and read a certain amount of bytes, right?That's a start,read some data let say 1000 bytes at time and look at the data.
Example.
with open('planet.mkv', 'rb') as f: data = f.read()[:1000] print(data)When doing this test i can see that some of the meta data is in clear text.
To take of some data.
import re with open('planet.mkv', 'rb') as f: data = f.read()[:3000] #print(data) rate = re.search(b'bitrate=\d+', data) print(rate.group()) vbv_max = re.search(b'vbv_maxrate=\d+', data) print(vbv_max.group())
Output:b'bitrate=2250'
b'vbv_maxrate=2812'
From bytes to string(this Unicode bye default) in Python 3.>>> b = b'bitrate=2250' >>> type(b) <class 'bytes'> >>> s = b.decode() # same as decode('utf-8') >>> s 'bitrate=2250' >>> type(s) <class 'str'>