Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider reading duration from media files as well #7

Open
lehni opened this issue Mar 15, 2023 · 2 comments
Open

Consider reading duration from media files as well #7

lehni opened this issue Mar 15, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@lehni
Copy link
Contributor

lehni commented Mar 15, 2023

The get-media-dimensions package does this, and also supports MP3s and other audio files:

https://github.com/noblesamurai/get-media-dimensions

It would be quite nice to have this property as well.

@SidOfc
Copy link
Owner

SidOfc commented Mar 15, 2023

The problem here is that this requires external binaries (ffmpeg/ffprobe). It's certainly possible to add this, but would likely become problematic on Windows requiring additional workarounds. The advantage of this package is that it requires no external binaries at the cost of requiring implementations for extracting data to live within the codebase.

Unfortunately it is non-trivial to get the duration for all video formats (I tried). Some don't store it or require more complex calculations (looking at you, ogv). The specifications for each vary in documentation quality as well which makes supporting this rather expensive/intensive to build (imagine implementing parts of ffmpeg/ffprobe in JS in a lightweight way).

At some point I do want to spend more time on this plugin since the initial focus was to go wide instead of deep (also due to specification info being scattered everywhere which makes it a pain to find the right spec for some cases).

All that said I must admit it is yet another good suggestion. However, implementing this would require me to fully understand every file format leather currently supports. This is going to take some significant amount of time 😅

I will leave this open since I do intend to give it another try for sure. But if you're building anything right now I would recommend installing an additional package or replacing leather all together with something which uses ffmpeg/ffprobe utilities.

@SidOfc SidOfc self-assigned this Mar 15, 2023
@SidOfc SidOfc added the enhancement New feature or request label Mar 15, 2023
@lehni
Copy link
Contributor Author

lehni commented Mar 15, 2023

I understand. The lack of external dependencies is a huge plus for me, and I'd prefer that over having duration read from the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants