Code Monkey home page Code Monkey logo

enzyme's Introduction

Hi there 👋

Somehow you've landed here 🤔

I am probably building something or learning some stuff. Feel free to look around, check my contributions below, website and LinkedIn profile.

enzyme's People

Contributors

diaoul avatar fgeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

enzyme's Issues

TypeError: 'Element' object is not iterable

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-005.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 866200f975093243ea049cc3d1ebddfe9e06953b

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 84, in _parse_seekhead
    self.tags.extend([Tag.fromelement(t) for t in ebml.parse_element(stream, specs, True, ignore_element_names=['Void', 'CRC-32'])])
TypeError: 'Element' object is not iterable

UnboundLocalError: local variable 'string' referenced before assignment

I'm encountering the following error when scanning a specific mkv file with subliminal 0.8.0 (had same issue with 0.7.3). It works fine with other mkv files.

Any clue?

Traceback (most recent call last):
File "/usr/local/bin/subliminal", line 9, in
load_entry_point('subliminal==0.8.0-dev', 'console_scripts', 'subliminal')()
File "/usr/local/lib/python2.7/dist-packages/subliminal-0.8.0_dev-py2.7.egg/subliminal/cli.py", line 144, in subliminal
embedded_subtitles=not args.force, age=args.age)
File "/usr/local/lib/python2.7/dist-packages/subliminal-0.8.0_dev-py2.7.egg/subliminal/video.py", line 341, in scan_videos
video = scan_video(filepath, subtitles, embedded_subtitles)
File "/usr/local/lib/python2.7/dist-packages/subliminal-0.8.0_dev-py2.7.egg/subliminal/video.py", line 212, in scan_video
mkv = enzyme.MKV(f)
File "/usr/local/lib/python2.7/dist-packages/enzyme/mkv.py", line 70, in init
self.chapters = [Chapter.fromelement(c) for c in ebml.parse_element(stream, specs, True, ignore_element_names=['Void', 'CRC-32'])[0] if c.name == 'ChapterAtom']
File "/usr/local/lib/python2.7/dist-packages/enzyme/mkv.py", line 335, in fromelement
return cls(start, hidden, enabled, end, string, language)
UnboundLocalError: local variable 'string' referenced before assignment

mkv.tags output format?

I assumed the output of mkv.tags was a python dictionary and tried to convert to json without success. The output is not json. XML conversion failed too.
What is the output format?

AttributeError: 'NoneType' object has no attribute 'name'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-006.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 54ef3fb27215ac01efb3c205ec6ce19ed04ecc24

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 51, in __init__
    if seek_head.name != 'SeekHead':
AttributeError: 'NoneType' object has no attribute 'name'

TypeError: 'NoneType' object is not iterable

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-015.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: eab6f36c7c16b06cfc350e0f9e04f334d075642f

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 74, in _parse_seekhead
    self.video_tracks.extend([VideoTrack.fromelement(t) for t in tracks if t['TrackType'].data == VIDEO_TRACK])
TypeError: 'NoneType' object is not iterable

Missing runtime dependency on setuptools

from pkg_resources import resource_stream in parsers/ebml/core.py makes the package depend on setuptools, which is currently not reflected in the package metadata

KeyError: 'TrackType'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-007.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: a4bd5c9aa2577bf4d9e28cdb368c0a806d5414a9

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 74, in _parse_seekhead
    self.video_tracks.extend([VideoTrack.fromelement(t) for t in tracks if t['TrackType'].data == VIDEO_TRACK])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 129, in __getitem__
    raise KeyError(key)
KeyError: 'TrackType'

IOError: [Errno 22] Invalid argument

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-008.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: f5150df5239856849977e711945631a31f325f48
Notes: This is similar to issue #10

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 40, in __init__
    segments = ebml.parse(stream, specs, ignore_element_names=['EBML'], max_level=0)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 172, in parse
    stream.seek(element.size, 1)
IOError: [Errno 22] Invalid argument

README (and docs) don’t say Enzyme only supports Matroska (*.mkv) files

From the GitHub repo description (Python video metadata parser) and the README, I thought this could parse many different kinds of video formats.

Unfortunately, it looks to me like it only supports Matroska. (Which is a great format! But many others exist…)

Please update the description and the README so others don’t get fooled like I was.

could enzyme get mp4 video file metadata?

I use enzyme-0.4.2.dev0 to get mp4 video file metadata, and there was an error:

raise MalformedMKVError('No Segment found')
enzyme.exceptions.MalformedMKVError: No Segment found

KeyError: 'SeekPosition'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-011.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 0670509156231c6b2b44b3ae53a34e9d574c984d

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 62, in _parse_seekhead
    element_position = seek['SeekPosition'].data + segment.position
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 129, in __getitem__
    raise KeyError(key)
KeyError: 'SeekPosition'

KeyError: 'Audio'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-003.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: de8facfbada0207fabfa512fb3674955e6e9af85

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 75, in _parse_seekhead
    self.audio_tracks.extend([AudioTrack.fromelement(t) for t in tracks if t['TrackType'].data == AUDIO_TRACK])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 246, in fromelement
    audiotrack.sampling_frequency = element['Audio'].get('SamplingFrequency', 8000.0)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 129, in __getitem__
    raise KeyError(key)
KeyError: 'Audio'

KeyError: 'More than 1 child with key PixelHeight (2)'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-017.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 4e58f9f4c71126c3d93edd920ebce35ce028f26f

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 74, in _parse_seekhead
    self.video_tracks.extend([VideoTrack.fromelement(t) for t in tracks if t['TrackType'].data == VIDEO_TRACK])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 202, in fromelement
    videotrack.height = element['Video'].get('PixelHeight', 0)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 119, in get
    element = self[name]
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 131, in __getitem__
    raise KeyError('More than 1 child with key %s (%d)' % (key, len(children)))
KeyError: 'More than 1 child with key PixelHeight (2)'

MemoryError with fuzzed sample

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-012.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 90813b495864e305d1af9924e5df6c0db042746f

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 53, in __init__
    seek_head.load(stream, specs, ignore_element_names=['Void', 'CRC-32'])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 107, in load
    self.data = parse(stream, specs, self.size, ignore_element_types, ignore_element_names, max_level)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 180, in parse
    element.data = parse(stream, specs, element.size, ignore_element_types, ignore_element_names, max_level)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 165, in parse
    element = parse_element(stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 221, in parse_element
    element.data = READERS[element_type](stream, element_size)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/readers.py", line 235, in read_element_binary
    return BytesIO(stream.read(size))
MemoryError

Error detecting subtitle language as english

I am having trouble with enzyme detecting the first(or maybe just english?) embedded subtitle language. This seems to be happening with all of my files so is it somehow possible that this is a result of something in my setup? I originally reported this as a bug with nzbget-subliminal but @caronc has helped me realise the actual problem lies with enzyme here. Apologies, but I am not sure how to get further debugging information from enzyme to help.

An example file I am talking about is: Game.of.Thrones.S05E01.The.Wars.to.Come.1080p.WEB-DL.DD5.1.H.264-NTb
ffprobe output: https://pastebin.com/iQVU4whX
mediainfo output: https://pastebin.com/BtUNSRjf
but the enzyme output is:

python test.py /home/matt/subliminal_test/Game.of.Thrones.S05E01.The.Wars.to.Come.1080p.WEB-DL.DD5.1.H.264-NTb.mkv /home/matt/subliminal_test/Game.of.Thrones.S05E01.The.Wars.to.Come.1080p.WEB-DL.DD5.1.H.264-NTb.mkv {'forced': False, 'name': None, 'language': None, 'default': False, 'enabled': True, 'number': 3, 'codec_name': None, 'codec_id': u'S_TEXT/UTF8', 'lacing': False, 'type': 17}

Another example is:
mediainfo output: https://pastebin.com/xS7B4L78
ffprobe output: https://pastebin.com/69bCLQ75
enzyme output is:
American Horror Story - S05E01 - Checking In (Bluray-1080p - x264 DTS [EN+FR+DE+JA+ES]).mkv {'forced': False, 'name': None, 'language': None, 'default': False, 'enabled': True, 'number': 3, 'codec_name': None, 'codec_id': u'S_HDMV/PGS', 'lacing': False, 'type': 17} {'forced': False, 'name': None, 'language': u'fre', 'default': False, 'enabled': True, 'number': 4, 'codec_name': None, 'codec_id': u'S_HDMV/PGS', 'lacing': False, 'type': 17} {'forced': False, 'name': None, 'language': u'ger', 'default': False, 'enabled': True, 'number': 5, 'codec_name': None, 'codec_id': u'S_HDMV/PGS', 'lacing': False, 'type': 17} {'forced': False, 'name': None, 'language': u'jpn', 'default': False, 'enabled': True, 'number': 6, 'codec_name': None, 'codec_id': u'S_HDMV/PGS', 'lacing': False, 'type': 17} {'forced': False, 'name': None, 'language': u'spa', 'default': False, 'enabled': True, 'number': 7, 'codec_name': None, 'codec_id': u'S_HDMV/PGS', 'lacing': False, 'type': 17}

Any help with getting this fixed would be fantastic :)

Writing metadata

It would be nice to be able to write metadata to files, and not only reading them.

IOError: [Errno 22] Invalid argument

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-002.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: c0d136e71eb1c1b6b30741a33b00ff9a84f104f5

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 73, in _parse_seekhead
    tracks = ebml.parse_element(stream, specs, True, ignore_element_names=['Void', 'CRC-32'])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 218, in parse_element
    element.data = parse(stream, specs, element.size, ignore_element_types, ignore_element_names, max_level)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 180, in parse
    element.data = parse(stream, specs, element.size, ignore_element_types, ignore_element_names, max_level)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 165, in parse
    element = parse_element(stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 212, in parse_element
    stream.seek(element_size, 1)
IOError: [Errno 22] Invalid argument

KeyError: 'SeekID'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-010.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: bdead89b6b29ecf42269bad88ed3ae8626ac3372

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 60, in _parse_seekhead
    element_id = ebml.read_element_id(seek['SeekID'].data)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 129, in __getitem__
    raise KeyError(key)
KeyError: 'SeekID'

OverflowError: Python int too large to convert to C long

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-001.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 71a9f94a2274db2aea1017f434fbc5f5b73daa69

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 68, in _parse_seekhead
    stream.seek(element_position)
OverflowError: Python int too large to convert to C long

Question about enzyme.exceptions.MalformedMKVError: Parsing error: Cannot read element id

@Diaoul
when I run this I get that error but i don't get any error running mkvinfo in linux:

What Im missing?

>>> import enzyme
>>> with open('/media/SAMSUNG/media/series/1.mkv', 'rb') as f:
...     mkv = enzyme.MKV(f)
...     mkv.info
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/local/lib/python2.7/dist-packages/enzyme/mkv.py", line 56, in __init__
    raise MalformedMKVError('Parsing error: %s' % e)
enzyme.exceptions.MalformedMKVError: Parsing error: Cannot read element id
>>>

but when i run MKVINFO it shows no error:

mkvinfo "/media/SAMSUNG/media/series/1.mkv"
|+ Doc type: matroska
|+ Doc type version: 4
|+ Doc type read version: 2
+ Segment, size 1803643838
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4027)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.3.3 + libmatroska v1.4.4
| + Writing application: mkvmerge v9.1.0 ('Little Earthquakes') 64bit
| + Duration: 2582.956s (00:43:02.956)
| + Date: Tue May 10 05:13:51 2016 UTC
| + Segment UID: 0xb0 0x20 0xaa 0xa8 0xdc 0x7e 0x34 0xf7 0xa8 0x9b 0xaa 0xbc 0x7b 0x89 0x02 0xca
|+ Segment tracks
| + A track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 16362155880837181071
|  + Track type: video
|  + Lacing flag: 0
|  + MinCache: 1
|  + Codec ID: V_MPEG4/ISO/AVC
|  + CodecPrivate, length 43 (h.264 profile: High @L4.0)
|  + Default duration: 41.708ms (23.976 frames/fields per second for a video track)
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 1080
|   + Display width: 1920
|   + Display height: 1080
| + A track
|  + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
|  + Track UID: 16338768801695860104
|  + Track type: audio
|  + Codec ID: A_AC3
|  + Default duration: 32.000ms (31.250 frames/fields per second for a video track)
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 6
| + A track
|  + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
|  + Track UID: 18344974354018286494
|  + Track type: subtitles
|  + Lacing flag: 0
|  + Codec ID: S_TEXT/UTF8
|+ EbmlVoid (size: 1147)
|+ Cluster

KeyError: 'Video'

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-004.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: d2098b279442b100e6d4c5606c5de0449f22e45e

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 74, in _parse_seekhead
    self.video_tracks.extend([VideoTrack.fromelement(t) for t in tracks if t['TrackType'].data == VIDEO_TRACK])
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 201, in fromelement
    videotrack.width = element['Video'].get('PixelWidth', 0)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/parsers/ebml/core.py", line 129, in __getitem__
    raise KeyError(key)
KeyError: 'Video'

No module named core

Hello Antoine,

Je viens tout juste de faire un update de subliminal par pip.

pip-2.7 install -U subliminal

Ca m'a mis à jour enzyme et depuis j'ai une erreur :

NAS> /opt/local/bin/subliminal 
Traceback (most recent call last):
  File "/opt/local/bin/subliminal", line 24, in <module>
    import subliminal
  File "/opt/local/lib/python2.7/site-packages/subliminal/__init__.py", line 18, in <module>
    from .api import list_subtitles, download_subtitles
  File "/opt/local/lib/python2.7/site-packages/subliminal/api.py", line 18, in <module>
    from .core import (SERVICES, LANGUAGE_INDEX, SERVICE_INDEX, SERVICE_CONFIDENCE,
  File "/opt/local/lib/python2.7/site-packages/subliminal/core.py", line 22, in <module>
    from .videos import Episode, Movie, scan
  File "/opt/local/lib/python2.7/site-packages/subliminal/videos.py", line 21, in <module>
    import enzyme.core
ImportError: No module named core

Est-ce que tu vois d'ou ca viendrais ?

Merci !

KeyError: 149

Fuzzed sample: http://bugs.fi/media/afl/enzyme/enzyme-014.mkv
Fuzzers used: http://lcamtuf.coredump.cx/afl/ https://bitbucket.org/jwilk/python-afl
SHA1: 88e26346a3631de7b112b4e102e7f1ee6779abfa

mkvinfo.py:

import sys
import enzyme
inputfile = sys.argv[1]
try:
    with open(inputfile, 'rb') as f:
        mkv = enzyme.MKV(f)
    print(mkv.info)
    print(mkv.video_tracks)
    print(mkv.audio_tracks)
except enzyme.exceptions.MalformedMKVError:
    pass
Traceback (most recent call last):
  File "mkvinfo.py", line 8, in <module>
    mkv = enzyme.MKV(f)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 54, in __init__
    self._parse_seekhead(seek_head, segment, stream, specs)
  File "/usr/local/lib/python2.7/dist-packages/enzyme-0.4.1-py2.7.egg/enzyme/mkv.py", line 61, in _parse_seekhead
    element_name = specs[element_id][1]
KeyError: 149

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.