Skip to content

Commit 440065d

Browse files
committed
Cleanup README
1 parent 46d2a93 commit 440065d

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

README.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
mp4analyzer.js
22
==============
33

4-
mp4analyzer.js is a tool for parsing mp4/mov files and extracting information. It uses HTML5 [FileReader](http://developer.mozilla.org/en-US/docs/Web/API/FileReader) and [DataView](http://developer.mozilla.org/en-US/docs/Web/API/DataView) APIs to read local files. Currently it only returns the codec of the first video and audio streams, but it can be extended to extract anything contained in mp4 atoms.
4+
mp4analyzer.js is a tool for parsing mp4/mov files and extracting information.
5+
It uses HTML5 [FileReader](http://developer.mozilla.org/en-US/docs/Web/API/FileReader) and
6+
[DataView](http://developer.mozilla.org/en-US/docs/Web/API/DataView) APIs to read local files.
7+
Currently it only returns the codec of the first video and audio streams, but it can be extended
8+
to extract anything contained in mp4 atoms.
59

610
Building
711
--------
812

9-
mp4analyzer.js has been designed to be minified and optimized with [Google Closure Compiler](https://developers.google.com/closure/compiler/). The included makefile helps in the building process. It contains four targets:
13+
mp4analyzer.js has been designed to be minified and optimized with
14+
[Google Closure Compiler](https://developers.google.com/closure/compiler/). The included makefile
15+
helps in the building process. It contains four targets:
1016

1117
* __wrap__: wrap the library in a single uncompressed file (output: build/mp4analyzer.js)
1218
* __minify__: minify the library with Closure compiler (output: build/mp4analyzer.min.js)
13-
* __optimize__: minify the library with Closure Compiler in advanced mode (output: build/mp4analyzer.opt.js); this is the best choice and should be preferred. Closure Compiler removes dead code and produces code which is easier to optimize for modern JavaScript engines.
19+
* __optimize__: minify the library with Closure Compiler's
20+
[advanced mode](https://developers.google.com/closure/compiler/docs/api-tutorial3) (output: build/mp4analyzer.opt.js)
1421
* __all (default):__ build plain, minified and optimized versions of the library
1522

16-
To use Closure Compiler you make tell make where the Closure Compiler's jar file is located:
17-
```
23+
To use Closure Compiler you must tell make where the Closure Compiler's jar file is located:
24+
25+
```sh
1826
make CLOSURE_COMPILER=/path/to/compiler.jar
1927
```
20-
Make will invoke ```java -jar /path/to/compiler.jar```. Alternatively you can override the full command:
21-
```
28+
29+
Make will invoke ```java -jar /path/to/compiler.jar```. You can also override the full command:
30+
31+
```sh
2232
make CLOSURE_COMMAND=your_compiler_cmd
2333
```
2434

@@ -27,7 +37,7 @@ Usage
2737

2838
### A trivial example
2939

30-
```
40+
```html
3141
<!DOCTYPE html>
3242
<html>
3343
<head>
@@ -53,34 +63,42 @@ Usage
5363

5464
### Namespace
5565

56-
mp4analyzer.js exports a global object named ```MP4```. This namespace contains all methods and properties defined by the library.
66+
mp4analyzer.js exports a global object named ```MP4```. This namespace contains all methods and
67+
properties defined by the library.
5768

5869
### Checking for browser support
5970

60-
```
71+
```js
6172
MP4.supported = true/false;
6273
```
6374

6475
A boolean property named ```supported``` is defined in the ```MP4``` namespace.
65-
It will be set to false when the requested APIs are not supported.
76+
It is set to false if the requested APIs are not supported.
6677

6778
### Running the analyzer
6879

69-
```
80+
```js
7081
MP4.analyze = function( // return type: boolean
7182
blob, // type: Blob
7283
callback // type: function(result)
7384
);
7485
```
7586

76-
To analyze a file you only need to call ```MP4.analyze```. The first argument must be a HTML5 [File](http://developer.mozilla.org/en-US/docs/Web/API/File) or [Blob](http://developer.mozilla.org/en-US/docs/Web/API/Blob) object. A [TypeError](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) exception is thrown when ```blob``` does not inherit the ```Blob``` object and when ```blob.type``` is not 'video/mp4', 'audio/mp4' or 'video/quicktime'.
77-
The second argument is a completion callback. The analysis process is asynchronous to avoid blocking the browser while waiting for disk I/O. The argument passed to the callback is the result object.
87+
To analyze a file you only need to call ```MP4.analyze```. The first argument must be a HTML5
88+
[File](http://developer.mozilla.org/en-US/docs/Web/API/File) or
89+
[Blob](http://developer.mozilla.org/en-US/docs/Web/API/Blob) object.
90+
A [TypeError](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) exception
91+
is thrown when ```blob``` does not inherit the ```Blob``` object and when ```blob.type``` is not 'video/mp4',
92+
'audio/mp4' or 'video/quicktime'.
93+
The second argument is a completion callback. The analysis process is asynchronous to avoid blocking the browser
94+
while waiting for disk I/O. The argument passed to the callback is the result object.
7895

79-
```MP4.analyze``` will return ```false``` and do nothing when ```MP4.supported``` is ```false```; it will return ```true``` otherwise.
96+
```MP4.analyze``` will return ```false``` and do nothing when ```MP4.supported``` is ```false```;
97+
it will return ```true``` otherwise.
8098

8199
### Reading results
82100

83-
```
101+
```js
84102
{
85103
video: { // null if no video stream found
86104
codec: 'codec name'
@@ -91,7 +109,9 @@ The second argument is a completion callback. The analysis process is asynchrono
91109
};
92110
```
93111

94-
This is the structure of the result object passed to the callback. As stated above, the analyzer currently extracts only the codec name for the first video and audio streams. If no video or audio stream is found the concerning field in the result object is set to ```null```.
112+
This is the structure of the result object passed to the callback. As stated above, the analyzer
113+
currently extracts only the codec name for the first video and audio streams. If no video or audio stream
114+
is found, the concerning field in the result object is set to ```null```.
95115

96116
```result.video.codec``` contains a FOURCC code. You can find a FOURCC list [there](http://www.fourcc.org/codecs.php).
97117
```result.audio.codec``` containes one of these strings:
@@ -106,7 +126,7 @@ This is the structure of the result object passed to the callback. As stated abo
106126
Browser support
107127
---------------
108128

109-
Firefox 15, Chrome 9, Internet Explorer 10, Opera 12.1, Safari 6.0.2
129+
Firefox >= 15, Chrome >= 9, Internet Explorer >= 10, Opera >= 12.1, Safari >= 6.0.2
110130

111131
Detail:
112132

0 commit comments

Comments
 (0)