All Projects → wapmorgan → Mediafile

wapmorgan / Mediafile

Licence: mit
A unified reader of metadata from audio & video files.

Projects that are alternatives of or similar to Mediafile

Symphonia
Pure Rust multimedia format demuxing, tag reading, and audio decoding library
Stars: ✭ 191 (+38.41%)
Mutual labels:  wav, audio, mp3, mp4, aac, flac
Av Converter
[av-converter.com] Audio and Video Converter, and YouTube downloader. Convert to MP3, MP4, AAC, FLAC, AC3, WAV, etc.
Stars: ✭ 97 (-29.71%)
Mutual labels:  wav, audio, mp3, mp4, aac, flac
Atldotnet
Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
Stars: ✭ 180 (+30.43%)
Mutual labels:  wav, audio, mp3, mp4, aac, flac
Ni Media
NI Media is a C++ library for reading and writing audio streams.
Stars: ✭ 158 (+14.49%)
Mutual labels:  wav, audio, mp3, mp4, flac
Audioplayer
Audio Player for Nextcloud and ownCloud
Stars: ✭ 179 (+29.71%)
Mutual labels:  wav, audio, mp3, mp4, flac
Flacon
Audio File Encoder. Extracts audio tracks from an audio CD image to separate tracks.
Stars: ✭ 252 (+82.61%)
Mutual labels:  wav, audio, mp3, aac, flac
loudgain
ReplayGain 2.0 loudness normalizer based on the EBU R128/ITU BS.1770 standard (-18 LUFS, FLAC, Ogg, MP2, MP3, MP4, M4A, AAC, ALAC, Opus, ASF, WMA, WAV, AIFF, WavPack, APE)
Stars: ✭ 127 (-7.97%)
Mutual labels:  mp4, mp3, aac, wav, flac
Audio Steganography Algorithms
A Library of Audio Steganography & Watermarking Algorithms
Stars: ✭ 146 (+5.8%)
Mutual labels:  wav, audio, mp3, aac, flac
Music Metadata
Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
Stars: ✭ 455 (+229.71%)
Mutual labels:  wav, audio, mp3, mp4, flac
Recorder
html5 js 录音 mp3 wav ogg webm amr 格式,支持pc和Android、ios部分浏览器、和Hybrid App(提供Android IOS App源码),微信也是支持的,提供H5版语音通话聊天示例 和DTMF编解码
Stars: ✭ 2,891 (+1994.93%)
Mutual labels:  wav, audio, mp3, amr
Youtube-DL-GUI
Graphical User Interace built around youtube-dl CLI
Stars: ✭ 38 (-72.46%)
Mutual labels:  mp3, aac, wav, flac
Esp8266audio
Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
Stars: ✭ 972 (+604.35%)
Mutual labels:  wav, mp3, aac, flac
Music Metadata Browser
Browser version of music-metadata parser Supporting a wide range of audio and tag formats.
Stars: ✭ 105 (-23.91%)
Mutual labels:  wav, audio, mp3, flac
aplay-
a simple BitPerfect player
Stars: ✭ 23 (-83.33%)
Mutual labels:  mp4, mp3, aac, flac
Gogglesmm
Goggles Music Manager
Stars: ✭ 41 (-70.29%)
Mutual labels:  mp3, mp4, aac, flac
Libnyquist
🎤 Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
Stars: ✭ 311 (+125.36%)
Mutual labels:  wav, audio, mp3, flac
slibs
Single file libraries for C/C++
Stars: ✭ 80 (-42.03%)
Mutual labels:  mp4, mp3, aac, flac
Miniaudio
Single file audio playback and capture library written in C.
Stars: ✭ 1,889 (+1268.84%)
Mutual labels:  wav, audio, mp3, flac
audio-metadata
A library for reading and, in the future, writing audio metadata. https://audio-metadata.readthedocs.io/
Stars: ✭ 41 (-70.29%)
Mutual labels:  mp4, mp3, wav, flac
Freac
The fre:ac audio converter project
Stars: ✭ 518 (+275.36%)
Mutual labels:  audio, mp3, aac, flac

MediaFile

Allows you easily get meta information about any media file with unified interface. The library has no requirements of external libs or system unitilies.

Latest Stable Version License Latest Unstable Version Tests

Supported formats

Audio Video
aac, amr, flac, mp3, ogg, wav, wma avi, mkv, mp4, wmv
- length - length
- bitRate - width
- sampleRate - height
- channels - frameRate

Table of contents:

  1. Usage
  2. API
  3. Why not using getID3?
  4. Technical details

Usage

use wapmorgan\MediaFile\MediaFile;

try {
  $media = MediaFile::open('123.mp3');
  // for audio
  if ($media->isAudio()) {
    $audio = $media->getAudio();
    echo 'Duration: '.$audio->getLength().PHP_EOL;
    echo 'Bit rate: '.$audio->getBitRate().PHP_EOL;
    echo 'Sample rate: '.$audio->getSampleRate().PHP_EOL;
    echo 'Channels: '.$audio->getChannels().PHP_EOL;
  }
  // for video
  else {
    $video = $media->getVideo();
    // calls to VideoAdapter interface
    echo 'Duration: '.$video->getLength().PHP_EOL;
    echo 'Dimensions: '.$video->getWidth().'x'.$video->getHeight().PHP_EOL;
    echo 'Framerate: '.$video->getFramerate().PHP_EOL;
  }
} catch (wapmorgan\MediaFile\Exceptions\FileAccessException $e) {
  // FileAccessException throws when file is not a detected media
} catch (wapmorgan\MediaFile\Exceptions\ParsingException $e) {
   echo 'File is propably corrupted: '.$e->getMessage().PHP_EOL;
}

API

MediaFile

wapmorgan\wapmorgan\MediaFile

Method Description Notes
static open($filename): MediaFile Detects file type and format and calls constructor with these parameters. Throws an \Exception if file is not a media or is not accessible.
isAudio(): boolean Returns true if media is just audio.
isVideo(): boolean Returns true if media is a video with audio.
isContainer(): boolean Returns true if media is also a container (can store multiple audios and videos).
getFormat(): string Returns media file format.
getAudio(): AudioAdapter Returns an AudioAdapter interface for audio.
getVideo(): VideoAdapter Returns an VideoAdapter interface for video.

AudioAdapter

wapmorgan\MediaFile\AudioAdapter

Method Description
getLength(): float Returns audio length in seconds and microseconds as float.
getBitRate(): int Returns audio bit rate as int.
getSampleRate(): int Returns audio sampling rate as int.
getChannels(): int Returns number of channels used in audio as int.
isVariableBitRate(): boolean Returns whether format support VBR and file has VBR as boolean.
isLossless(): boolean Returns whether format has compression lossless as boolean.

VideoAdapter

wapmorgan\MediaFile\VideoAdapter

Method Description
getLength(): int Returns video length in seconds and microseconds as float.
getWidth(): int Returns width of video as int.
getHeight(): int Returns height of video as int.
getFramerate(): int Returns video frame rate of video as int.

ContainerAdapter

wapmorgan\MediaFile\ContainerAdapter

Method Description
countStreams(): int Returns number of streams in container as int.
countVideoStreams(): int Returns number of video streams as int.
countAudioStreams(): int Returns number of audio streams as int.
getStreams(): array Returns streams information as array.

Why not using getID3?

getID3 library is very popular and has a lot of features, but it's old and too slow.

Following table shows comparation of analyzing speed of fixtures, distributed with first release of MediaFile:

File getID3 MediaFile Speed gain
video.avi 0.215 0.126 1.71x
video.mp4 3.055 0.429 7.12x
video.wmv 0.354 0.372 0.95x
audio.aac 0.560 0.262 2.13x
audio.amr 8.241 12.248 0.67x
audio.flac 1.880 0.071 26.41x
audio.m4a 13.372 0.169 79.14x
audio.mp3 10.931 0.077 141.54x
audio.ogg 0.170 0.096 1.78x
audio.wav 0.114 0.070 1.64x
audio.wma 0.195 0.158 1.23x

Technical information

Format Full format name Specifications Notes
aac MPEG 4 Part 12 container with audio only http://l.web.umkc.edu/lizhu/teaching/2016sp.video-communication/ref/mp4.pdf Does not provide support of MPEG2-AAC
amr AMR-NB http://hackipedia.org/File%20formats/Containers/AMR,%20Adaptive%20MultiRate/AMR%20format.pdf Does not provide support of AMR-WB
avi - http://www.alexander-noe.com/video/documentation/avi.pdf
flac - - Support based on third-party library
mkv Matroska container https://www.matroska.org/technical/specs/index.html
mp3 MPEG 1/2 Layer 1/2/3 https://github.com/wapmorgan/mp3info#technical-information
mp4 MPEG 4 Part 12/14 container with few audio and video streams Part 12 specification: http://l.web.umkc.edu/lizhu/teaching/2016sp.video-communication/ref/mp4.pdf Part 14 extension: https://www.cmlab.csie.ntu.edu.tw/~cathyp/eBooks/14496_MPEG4/ISO_IEC_14496-14_2003-11-15.pdf
ogg Ogg container with Vorbis audio https://xiph.org/vorbis/doc/Vorbis_I_spec.html
wav - - Support based on third-party library
wma ASF container with only one audio stream http://go.microsoft.com/fwlink/p/?linkid=31334
wmv ASF container with few audio and video streams http://go.microsoft.com/fwlink/p/?linkid=31334
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].