wapmorgan / mediafile Goto Github PK
View Code? Open in Web Editor NEWA unified reader of metadata from audio & video files.
Home Page: https://wapmorgan.github.io/MediaFile/
License: MIT License
A unified reader of metadata from audio & video files.
Home Page: https://wapmorgan.github.io/MediaFile/
License: MIT License
Here is issue text : "fread(): Argument #2 ($length) must be greater than 0";
It happens in analyzeMetadata function inside "if ($size >= 20)";
It happens for some .wav files. And i'm using actual .wav files.
I tried to convert my .wav file to .wav again using random online converter and this issue gone. I have been using this library for 2 years and have never got this issue (processed huge amount of files). And recently i started getting this issue again and again.
Can you suggest what should i do in this situation?
MediaFile is not providing duration/length for some mp3/mp4 files.
Hello!
I have an MP3 file which is generating an Unknown format for file "/tmp/phpaa3d76"!
exception, but works ok in other players and macOS recognizes it without any problem.
I later tried to fix it using using this tool and now it work just fine.
In the archive I'm sharing bot MP3s, the original and the fixed one: Archive.zip
Maybe this can be handled in the library and the exception avoided.
When trying to open this file, I get
In MediaFile.php line 42:
File "C:\Users\tacma\OneDrive\Pictures\JUFJ\Amanda\amanda--1.MOV" is not a supported video/audio, it's "video/mov"!
(MediaFile::open(...))
->getAudio()
->getLength();
fread() expects parameter 2 to be int, string given
in wapmorgan/binary-stream/src/BinaryStream.php
because segments_count
=== ''
.
Hello,
first I would like to thank you for this awesome project. Unfortunately with some of my files I get a Division by zero
error, that is not catchable...
It happens with multiple mp3
files, which i cannot provide publicly due to copyright but I think you should in any case fix the possible division by zero
. If you really need the files, feel free to contact me again, I'll try to provide you a sample.
Heres a trace:
... Division by zero (Code: 2) ...wapmorgan/mp3info/src/Mp3Info.php, line 384
#0 ...wapmorgan/mp3info/src/Mp3Info.php(384): {closure}(2, 'Division by zer...', '...', 384, Array)
#1 ...wapmorgan/mp3info/src/Mp3Info.php(279): wapmorgan\Mp3Info\Mp3Info->readMpegFrame(Resource id #24)
#2 ...wapmorgan/mp3info/src/Mp3Info.php(224): wapmorgan\Mp3Info\Mp3Info->parseAudio(Object(SplFileInfo), 8449196, 1)
#3 ...wapmorgan/media-file/src/Adapters/Mp3Adapter.php(15): wapmorgan\Mp3Info\Mp3Info->__construct(Object(SplFileInfo))
#4 ...wapmorgan/media-file/src/MediaFile.php(66): wapmorgan\MediaFile\Adapters\Mp3Adapter->__construct(Object(SplFileInfo))
#5 ...wapmorgan/media-file/src/MediaFile.php(44): wapmorgan\MediaFile\MediaFile->__construct(Object(SplFileInfo), 'audio', 'mp3')
#6 ...: wapmorgan\MediaFile\MediaFile::open(Object(SplFileInfo))
#7 {main}
I think that the $this->sampleRate
variable is not set correctly. Since it is not possible to catch this error under normal circumstances, I wrote a little script to, that's why it is a trace and not a fatal error output:
$path = 'path/to/mp3/files';
$directory = new \RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS | FilesystemIterator::CURRENT_AS_FILEINFO);
$files = new \RecursiveIteratorIterator($directory);
set_error_handler(function ($errorCode, $errorMessage, $file, $line) {
if (!(error_reporting() & $errorCode)) {
return false;
}
throw new Exception(sprintf('%s (Code: %s) in %s, line %s', $errorMessage,$errorCode, $file, $line));
});
foreach ($files as $file) {
if ($file->getExtension() !== "mp3") {
continue;
}
try {
$mediaFile = MediaFile::open($file);
} catch (Throwable $t) {
echo $file . PHP_EOL;
echo " ===> exception: " . $t->getMessage() . PHP_EOL;
echo $t->getTraceAsString().PHP_EOL;
}
}
restore_error_handler();
How can one get those tags using MediaFile? Thanks!
Hello,
I am reading an MP4 file, and I am getting this error:
Duration: 612.437
Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/mediametadata/src/Adapters/Mp4Adapter.php on line 14Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/mediametadata/src/Adapters/Mp4Adapter.php on line 21
Dimensions: x
Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/mediametadata/src/Adapters/Mp4Adapter.php on line 28
Framerate:
Using just the supplied sample code with a simple GoPro MP4 file will output the following:
Duration: 338.304
PHP Warning: Invalid argument supplied for foreach() in .../vendor/wapmorgan/media-file/src/Adapters/Mp4Adapter.php on line 14
PHP Warning: Invalid argument supplied for foreach() in .../vendor/wapmorgan/media-file/src/Adapters/Mp4Adapter.php on line 21
Dimensions: x
PHP Warning: Invalid argument supplied for foreach() in .../wapmorgan/media-file/src/Adapters/Mp4Adapter.php on line 28
Framerate:
File is propably corrupted: This file does not have "mvhd" box!
Here is my video: https://mega.nz/#!SUhDSAJI!oGArcly7xxexwenprYTX_sAKgrUIS1Z_KCv6h-06vKA
Currently the boyhagemann/Wave package is blocking the installation of this package unless forced or one changes there policy to accept dev packages.
boyhagemann hasn't responded to the request to do so for nearly a year and there has been no development since 2013.
A way around this would be to make wave support optional and not include the package by default. I for one don't need wave support and I would much rather use this libery then getID3, both for speed and and I have very little trust in there code as it's a big mess.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.