Jszip: How can I zip a mp4 video file?

Created on 26 Apr 2016  路  5Comments  路  Source: Stuk/jszip

I'm trying to zip a mp4 video from remote URL, is this possible? any advice?

thanks in advance!

questiosupport

Most helpful comment

Ok here is the solution to do it on locals mp4 videos :
```javascript
var fileURL = URL.createObjectURL(localFile)
JSZipUtils.getBinaryContent(fileURL, function (err, data) {
if(err) {
console.log(err); // or handle the error
}
var zip = new JSZip();
zip.file("video.mp4", data, {binary:true});
zip.generateAsync({type:"blob"}).then(function (blob) {
saveAs(blob, "archive.zip");
}, function (err) {
console.log(err);
});

});

All 5 comments

In a browser or with nodejs ? Either way, you should see the relevant part of the documentation.
MP4 files are already compressed so you can skip the compression (compression = STORE, the default) here.

close now?

Hi guys,

I have the same issue. @carloscarcamo I would like to know if you have found a solution ?

Thanks in advance.
Best regards.

Without response from @carloscarcamo, I'm closing this one. @waylander47: could you create a new issue with more details (what you're trying to do, where you're stuck at, etc) ?

Ok here is the solution to do it on locals mp4 videos :
```javascript
var fileURL = URL.createObjectURL(localFile)
JSZipUtils.getBinaryContent(fileURL, function (err, data) {
if(err) {
console.log(err); // or handle the error
}
var zip = new JSZip();
zip.file("video.mp4", data, {binary:true});
zip.generateAsync({type:"blob"}).then(function (blob) {
saveAs(blob, "archive.zip");
}, function (err) {
console.log(err);
});

});

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zizizi17 picture zizizi17  路  6Comments

RUSHt picture RUSHt  路  5Comments

v1nce picture v1nce  路  3Comments

ghigt picture ghigt  路  4Comments

jimmywarting picture jimmywarting  路  4Comments