Code Monkey home page Code Monkey logo

Comments (5)

leocov-dev avatar leocov-dev commented on May 16, 2024 2

This library is well thought out, so in my project I ended up adding a type matcher like this:

class Mp4Compatible(video.Mp4):
    """
    More lenient mp4 detection
    """
    def match(self, buf):
        if not self._is_isobmff(buf):
            return False

        major_brand, minor_version, compatible_brands = self._get_ftyp(buf)
        return any([cb in ['mp41', 'mp42'] for cb in compatible_brands])

filetype.add_type(Mp4Compatible())

But it would be nice to have more insight into the decisions and inner workings of the library.

from filetype.py.

lin-evil avatar lin-evil commented on May 16, 2024

I'm having an issue with detecting .mp4 files too. This is what I get from _get_ftype():
major brand:
isom
minor version:
512
compatible brands:
['isom', 'iso2', 'avc1', 'mp41']

from filetype.py.

lucidBrot avatar lucidBrot commented on May 16, 2024

@leocov-dev Sounds nice! But I'm not understanding where you add this. Did you modify this library's source code in your cloned version, or is it possible to add this modification when I got the library through pip?

Copy pasting your code and using from filetype import * gives me AttributeError: 'function' object has no attribute 'Mp4'

from filetype.py.

fgsalomon avatar fgsalomon commented on May 16, 2024

@leocov-dev Sounds nice! But I'm not understanding where you add this. Did you modify this library's source code in your cloned version, or is it possible to add this modification when I got the library through pip?

Copy pasting your code and using from filetype import * gives me AttributeError: 'function' object has no attribute 'Mp4'

I guess that you already fixed that by now but anyways this worked for me:

from filetype.types import video

I wonder why @leocov-dev more lenient matcher is not added to the library.

UPDATE: My bad, I'm using an old version. It looks like it was fixed here.

from filetype.py.

dosas avatar dosas commented on May 16, 2024

@leocov-dev So can we close this then?

from filetype.py.

Related Issues (20)

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.