Code Monkey home page Code Monkey logo

nativescript-ffmpeg's People

Contributors

michaelsolati avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ponnex

nativescript-ffmpeg's Issues

Cannot read property 'getInstance' of undefined

Steps for reproduce

  1. tns create App Name --ng
  2. tns plugin add nativescript-ffmpeg
  3. import { FFmpeg } from "nativescript-ffmpeg";
    System.err: StackTrace: System.err: Frame: function:'', file:'file:///data/data/org.nativescript.youtubemusic/files/app/tns_modules/nativescript-ffmpeg/ffmpeg.js', line: 7, column: 28 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.youtubemusic/files/app/item/item-detail.component.js', line: 5, column: 29 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.youtubemusic/files/app/app.routing.js', line: 6, column: 31 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.youtubemusic/files/app/app.module.js', line: 5, column: 21 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.youtubemusic/files/app/main.js', line: 5, column: 20 System.err: Frame: function:'require', file:'', line: 1, column: 266
    tns --version -> 4.2.2
    OS -> Windows 10 Version 1803 ( OS Build 17134.165 )

How to terminate ffmpeg thread

When the compression is done. it seems that the thread in background is still busy. because when I start a nieuwe compression then I get the error that the compression is still busy. does any body know the command to stop ffmpeg thread.

    onSuccess: function (message) {
                if (debug) {
                    console.log('Successfully run FFmpeg');
                }
                if (callback) {
                    callback();
                }
                return;
            },
            onFinish: function () {

// here ? ---------------------------------------------------------------------
if (callback) {
callback();
}
return;
}
});
try {

            ffmpeg.execute(command, new ExecuteBinaryResponseHandler());

//Or here ??-------------------------------------------------------------------
ffmpeg.process.terminate();
}

Error on compress image.

I´m doing app which records a interview with plugin nativescript-recorder but after record, the output file size is very big. I want to compress it to send it to server.
I´m facing troubles when I use the comand execute which doesn´t compress file.

It seems this algorithm enter on both conditionals

MY SMARTPHONE:

MOTO X 2nd

MY CODE:

this.recorder.on("finished", args => {
     clearInterval(this.interval);
     if (this.get("duration")) {
       const file = args.object.get('file');
       this._compress(file);
     }
  });

 private _compress(src: string): void {
  
   console.log("Original file size " + this._getSize(src));

   const out =  src.replace(/\.[^/.]+$/, "_COMPRESSED.mp4");
   FFmpeg.execute(["-i", src, "-vcodec", "h264", "-acodec", "mp4", out], (err) => {
     if (err) {
       console.log(err);
       console.log('it was error')
    } else {
       console.log(src);
       console.log(out);
       console.log("Compressed file size " + this._getSize(out));
     }
   });
 }

 private _getSize(path: string): string {
   let length: number = 0;
   if (isAndroid) {
     const file = new java.io.File(path);
     length = file.length();
   } else {
     const defManager = NSFileManager.defaultManager;
     const fileAttributes = defManager.attributesOfItemAtPathError(path);
     length = fileAttributes.objectForKey(NSFileSize);
   }
   return `${(length / (1000 * 1000)).toFixed(2)} MB`;
 }

error

compress video file

is it possible for me to use this plugin to just compress video file without using other functionalities

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.