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

How to Remove the video track from an .mp4 file? #186

Open
1kilogram opened this issue Dec 5, 2022 · 1 comment
Open

How to Remove the video track from an .mp4 file? #186

1kilogram opened this issue Dec 5, 2022 · 1 comment

Comments

@1kilogram
Copy link

Remove the video track from an .mp4 file?

Exists the JS program that can do just one function: remove video from an mp4 media file?
That is, it works like the function: ffmpeg -i input.mp4 -an output.mp4.

It's important that this program is compatible with all browsers and doesn't depend on MSE API (iOS10+ Safari doesn't support MSE API and Codecs API)

ffmpeg.js can do this task, but it takes 26 mb of memory.
I need a solution that takes up to 3 mb max of memory and works only with .mp4 container.

P.S. MP4Box.js is not suitable because the final result requires MSE and Codecs API which iOS Safari does NOT SUPPORT!
@1kilogram
Copy link
Author

I found a way to solve this problem 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 goggle.

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.

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

No branches or pull requests

1 participant