gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.94k stars 326 forks source link

When will full specification of MP4Box.js be published? #303

Closed 1kilogram closed 1 year ago

1kilogram commented 1 year ago

When will full specification of MP4Box.js be published?

While studying the MP4Box.js library it was found that there are more than 25 functions and methods for the argument: var mp4boxfile = MP4Box.createFile() besides 7-8 functions mentioned in README;

Unfortunately this function does not save data that is included in the mp4boxfile, such as the audio track arrayBuffer. If such a function were mp4boxfile.saveAll('name') - it would make using the MP4Box.js library much easier. For example, it would load audioTracks: [ArrayBuffer] from info into the mp4boxfile variable and save it all to a file. That would be handy.

In any case, a detailed specification would make it easier to use, the MP4Box.js library. I suggest to make specification as a separate .js file. A specification like ffmpeg.js is quite justified.

Regards, @1kilogram

1kilogram commented 1 year ago

?

kcarter80 commented 1 year ago

?

1kilogram commented 1 year ago

Maybe never

1kilogram commented 1 year ago

I found a way to solve this problem [Cross-platform audio extraction from video] back in January. This is only the second time I came to this site, since I haven't found anything worthwhile, at least not that I needed. Even FFmpeg I found by chance through a search on duckduckgo. I suspect that gitHub is used more for advertising than for serious projects. At least about JavaScript projects.

The solution is made without using FFmpeg and doesn't require mp4box library, which depends on MSE API. And the direct dependence on MSE API makes the library - trash, in contrast to, for example FFmpeg, which depends on the technical data of the device. For example on iOS 4S full FFmpeg assembly can't be run due to memory shortage. At the same time build FFmpeg for mp4 - allows you to select audio from no more than 9 seconds of video. On iOS 13+ there is a time limit too, but not critical since there is more RAM in the new stump models. But the problem is that FFmpeg doesn't use BLOb API but reads whole file: hence memory leaks.

Anyway, the solution itself takes about 400 lines with size up to 20 Kb and uses just the BLOb API and some other standard APIs.

So we have compatibility since stumb 6+. I focused exactly on stumb, because at some point in the development of the program, I found that on stumbs, up to the latest versions of iOS, a commercial bug is embedded, which goes against the W3C specification.

This intentional commercial bug from Apple - does not allow the full use of the Web Audio API, according to the W3C. It does not allow to manipulate Audio data if it is Video and in .mp4 container.

I've tried 3 different ways to do this, including using a low-performance ScriptProcessorNode that only allows real-time rendering, but because of an Apple commercial bug - stumps just won't record audio, contrary to W3C spec. At the same time everything works fine on Gecko and Webkit from Google.

So the problem is solved, and full device support is as follows: iOS6+ Chrome20+ Firefox13+ Opera 12.1+ IE10+ Edge0+ Samsung0+ In terms of performance: it takes no more than 2.5 seconds to extract original audio quality from a half hour .MOV video on a regular 4S Apple stumb.

This is an indicator, as the performance on more recent devices is an order of magnitude faster. There is also no limit on file size. For example Opera 32 browser: the process of extracting audio from 2+ gb of video takes no more than 9 seconds.

Such a thing.

If you have a desire to help with the following task:

Compressing video sizes. For example, from FHD to 240p.

From .mp4 to .mp4 is not suitable because it is too long process. Broadway.js may solve the problem, but it works through WASM, which is not suitable for all browsers.

I solve it with PLAYBox : Video API (

Maybe there is a solution, but I don't understand how to make my assembly based on FFmpeg sources to solve one single function : ".mp4 -> .gif" without extra libraries, the solution would be no more than 3-4 mb

This process works about as fast as PLAYBox, but without using Video API. Maybe there is an even easier way to extract frames from a video file.

I would like to know the opinion of people who will read my words.

@1kilogram