cordova-plugin-video-editor icon indicating copy to clipboard operation
cordova-plugin-video-editor copied to clipboard

Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100

Open sennmac opened this issue 9 years ago • 32 comments

Sorry about disturb. When I used the plugin,I got an error. E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android. net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100 at net.ypresto.androidtranscoder.engine.MediaFormatValidator.validateVideoOutputFormat(MediaFormatValidator.java:40) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine$1.onDetermineOutputFormat(MediaTranscoderEngine.java:169) at net.ypresto.androidtranscoder.engine.QueuedMuxer.onSetOutputFormat(QueuedMuxer.java:66) at net.ypresto.androidtranscoder.engine.QueuedMuxer.setOutputFormat(QueuedMuxer.java:61) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.drainEncoder(VideoTrackTranscoder.java:212) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.stepPipeline(VideoTrackTranscoder.java:107) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:198) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:99) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:179) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:160) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

And,this is how I use it.

uploadVideo(){ let self = this; var captureSuccess = function(mediaFiles) { let file = mediaFiles[0]; // if(device.platform=="iOS"){ var videoFileName = file.name; VideoEditor.transcodeVideo( videoTranscodeSuccess, videoTranscodeError, { fileUri: file.fullPath, outputFileName: videoFileName, outputFileType: VideoEditorOptions.OutputFileType.MPEG4, optimizeForNetworkUse: VideoEditorOptions.OptimizeForNetworkUse.YES, saveToLibrary: true, maintainAspectRatio: true, videoBitrate: 1000000, // 1 megabit audioChannels: 2, audioSampleRate: 44100, audioBitrate: 128000, // 128 kilobits progress: function(info) { console.log('transcodeVideo progress callback, info: ' + info); } } ); function videoTranscodeSuccess(result) { let win = function (r) { let data = JSON.parse(r.response); self.setState({ video: data.result }) } let fail = function (error) { alert("An error has occurred: Code = " + error.code); console.log("upload error source " + error.source); console.log("upload error target " + error.target); } let options = new FileUploadOptions(); options.fileKey = "video"; options.fileName = "myvideo"; options.mimeType = 'video/mp4'; let params = {}; options.params = params; let ft = new FileTransfer(); ft.upload(result, encodeURI("xxxx"), win, fail, options); } function videoTranscodeError(err) { console.log('videoTranscodeError, err: ' + err); } }; var captureError = function(error) { navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); }; navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration: 60, quality: 1}); }

sennmac avatar Aug 23 '16 08:08 sennmac

@sennmac Did you found any workaround for this?

pradeepuxd avatar Sep 05 '16 16:09 pradeepuxd

I was also hit by this bug. Tried different options but nothing helps. Any ideas?

leshik avatar Sep 14 '16 13:09 leshik

@leshik I am not sure what I did is right approach, but still I will tell you if this can help you. For me this error was coming on those devices where captured video resolution is not so high e.g moto g phone and so video size was less e.g 2 mb for 1 minute video. It was working fine with nexus 5 where captured video size was more i.e. 12 mb for 3 second. I was using this plugin so that I can reduce the size of video before uploading. What I did is on both success and failure I started uploading the video. In case there is failure I uploaded the original video file and in case of success I upload the new transcoded video. So this served my purpose.

pradeepuxd avatar Sep 14 '16 15:09 pradeepuxd

I'm just having the same issue on my bq Aquaris e5 HD, with an android 5.0.

Unluckily for me, with a 13Mb file the message came in the way I'm posting bellow:

screen shot 2016-10-04 at 19 19 07

The message error is:

net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100

As well, I'm pasting my code:

recordStory: function (callback) {

  var options = {
    limit: 1,
    duration: 60,
    quality: 1
  };

  document.addEventListener("deviceready", function () {
    $cordovaCapture.captureVideo(options).then(function (videoData) { // Success! Video data is here

      VideoEditor.transcodeVideo(function (success) {
        console.log(success);
      }, function (error) {
        console.log(error);
      }, {
        fileUri: videoData[0].fullPath, // the path to the video on the device
        outputFileName: 'encoded1', // the file name for the transcoded video
        outputFileType: VideoEditorOptions.OutputFileType.MPEG4,
        optimizeForNetworkUse: VideoEditorOptions.OptimizeForNetworkUse.YES,
        saveToLibrary: true,
        maintainAspectRatio: true,
        width: 640,
        height: 640,
        videoBitrate: 1000000, // 1 megabit
        audioChannels: 2,
        audioSampleRate: 44100,
        audioBitrate: 128000, // 128 kilobits
        progress: function  (info) {
          console.log('transcodeVideo progress callback, info: ' + info);
        }
      });

      callback(null, videoData);
    }, function (err) { // An error occurred. Show a message to the user
      callback(err);
    });
  }, false);
}

DevStarlight avatar Oct 04 '16 17:10 DevStarlight

I can confirm that my code works for a nexus 5 with Android 6.0. I'm investigating but one of the reasons could be that this plugin ONLY works on devices with GPU integrated.

DevStarlight avatar Oct 04 '16 23:10 DevStarlight

I can confirm that unfortunately I get the same error with both an LG-D331 (Android 4.4.2) and an Elephant P8000 (Android 5.1)

Maybe it's worth noting that both these phones capture videos in 3gpp format.

cdecaux avatar Jan 11 '17 15:01 cdecaux

Facing same problem here with the following configuration :

Device : Wiko Rainbow Android : 6.0.1

Here are a few informations about the taken video, optained thanks to VideoEditor.getVideoInfos()

{
    "width": 1920,
    "height": 1080,
    "orientation": "portrait", // ( don't blame me, it's not me who takes the video :) )
    "duration": 4.907,
    "size": 10433343,
    "bitrate": 17011175
}

Any idea on how we could possibly solve this?

I'll be glad to contribute but I'm definitely not a Java nor Android expert. I will try to see if I find some time to dig into...

flo-sch avatar May 11 '17 17:05 flo-sch

Same issue here on Highscreen Zera F rev.S (Android 4.4, 3gp video)

Ebuall avatar Sep 15 '17 17:09 Ebuall

This is fixed with https://github.com/ypresto/android-transcoder/pull/73 but hasn't been merged yet. Also, requires that this plugin bumps the version when it's available eventually...

maxpaj avatar Mar 20 '19 14:03 maxpaj

It sounds like the author of the android-transcoder isn't too keen to update it any time soon. Does anyone have any workaround on this?

coreysherman avatar Apr 03 '19 15:04 coreysherman

Same error here on Android 9. (Xiaomi Mi A1)..

Any solution? thanks!

martinbertinat avatar Apr 21 '19 18:04 martinbertinat

Use this plugin fork instead:

https://github.com/ffMathy/cordova-plugin-video-editor

javray avatar Jun 21 '19 15:06 javray

Hi @javray How do I install this fork?

I'm using Ionic 4. Gracias!

martinbertinat avatar Jun 21 '19 18:06 martinbertinat

@martinbertinat

ionic cordova plugin add https://github.com/ffMathy/cordova-plugin-video-editor.git

javray avatar Jun 21 '19 18:06 javray

@javray Thank you.. I think it installed correctly but now I'm having problem when compiling in android.

java/org/apache/cordova/videoeditor/VideoEditor.java:242: error: incompatible types: CustomAndroidFormatStrategy cannot be converted to Listener

Thank you anyway!

martinbertinat avatar Jun 21 '19 19:06 martinbertinat

@martinbertinat try to update Android SDK to last version.

javray avatar Jun 22 '19 05:06 javray

Same error here on Android 9. (Xiaomi Mi Note 5 Pro)..

But it works fine on Android 8 or Lower version.

Any solution? thanks! It's very urgent.

hmondal210 avatar Jun 24 '19 09:06 hmondal210

Use this plugin fork instead:

https://github.com/ffMathy/cordova-plugin-video-editor

i used it but it‘s it's wrong at 242lines MediaTranscoder.getInstance().transcodeVideo(fin.getFD(), outputFilePath, formatStrategy, listener); ’错误:(242, 95) 错误: 不兼容的类型: CustomAndroidFormatStrategy无法转换为Listener

zzt1413 avatar Jun 24 '19 10:06 zzt1413

Use this plugin fork instead: https://github.com/ffMathy/cordova-plugin-video-editor

i used it but it‘s it's wrong at 242lines MediaTranscoder.getInstance().transcodeVideo(fin.getFD(), outputFilePath, formatStrategy, listener); ’错误:(242, 95) 错误: 不兼容的类型: CustomAndroidFormatStrategy无法转换为Listener

Same problem here @zzt1413 . Please If you find a solution post it here..

I'm working on this today trying to find a solution!

martinbertinat avatar Jun 24 '19 13:06 martinbertinat

Android

Before this my SDK is 27,now i try to update SDK to 29 or 28,they are not working,that means i need return SDK to 26?

zzt1413 avatar Jun 26 '19 07:06 zzt1413

@javray Hi, did it work for you with no issues?

valgen avatar Jul 03 '19 13:07 valgen

Hi @valgen,

There is my ionic info:

Ionic:

ionic (Ionic CLI) : 4.4.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.3.1 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.3.8 @angular/cli : 7.3.8 @ionic/angular-toolkit : 1.5.1

Cordova:

cordova (Cordova CLI) : 9.0.0 ([email protected]) Cordova Platforms : android 8.0.0, ios 5.0.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 15 other plugins)

System:

ios-deploy : 1.9.4 ios-sim : 8.0.1 NodeJS : v10.13.0 (/usr/local/bin/node) npm : 6.9.0 OS : macOS Xcode : Xcode 10.2.1 Build version 10E1001

My build.gradle: ... project.ext { defaultBuildToolsVersion="28.0.3" //String defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4 defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default ...

I've deployed the app to One Plus 3T with Android 9.

If you need more info about my conf, please tell me.

javray avatar Jul 03 '19 16:07 javray

@javray hi, Have you successfully implemented ionic video editor in your project without getting the above error? If so can you please share your package.json file

ashutosh05 avatar May 28 '20 02:05 ashutosh05

@ashutosh05 here it is my package.json:

{ "name": "Awesome", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/fire": "^5.1.3", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@ionic-native/android-permissions": "^5.8.0", "@ionic-native/app-rate": "^5.8.0", "@ionic-native/app-version": "^5.8.0", "@ionic-native/camera": "^5.6.0", "@ionic-native/camera-preview": "^5.6.0", "@ionic-native/core": "^5.0.0", "@ionic-native/fcm": "^5.10.0", "@ionic-native/file": "^5.6.0", "@ionic-native/geolocation": "^5.5.1", "@ionic-native/http": "^5.19.1", "@ionic-native/image-resizer": "^5.8.0", "@ionic-native/keyboard": "^5.8.0", "@ionic-native/media-capture": "^5.7.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.16.0", "@ionic-native/video-editor": "^5.8.0", "@ionic/angular": "^4.1.0", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "@types/googlemaps": "^3.30.19", "@types/jquery": "^3.3.29", "@types/leaflet-routing-machine": "^3.2.1", "@types/leaflet.gridlayer.googlemutant": "^0.4.4", "@types/mapbox-gl": "^0.54.4", "@types/pouchdb": "^6.4.0", "angular-cropperjs": "^1.0.1", "angularfire2": "^5.1.3", "await-to-js": "^2.1.1", "cordova-android": "8.0.0", "cordova-ios": "^5.1.1", "cordova-plugin-advanced-http": "^2.3.1", "cordova-plugin-android-permissions": "1.0.0", "cordova-plugin-app-version": "0.1.9", "cordova-plugin-apprate": "1.4.0", "cordova-plugin-camera": "4.0.3", "cordova-plugin-camera-preview": "0.11.0", "cordova-plugin-device": "^2.0.2", "cordova-plugin-dialogs": "2.0.1", "cordova-plugin-fcm-with-dependecy-updated": "2.4.0", "cordova-plugin-file": "6.0.1", "cordova-plugin-geolocation": "4.0.1", "cordova-plugin-globalization": "1.11.0", "cordova-plugin-inappbrowser": "3.0.0", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "4.1.0", "cordova-plugin-ios-camera-permissions": "1.2.0", "cordova-plugin-media-capture": "3.0.2", "cordova-plugin-media-capture-mp4video": "1.0.5", "cordova-plugin-nativestorage": "2.3.2", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-video-editor": "git+https://github.com/ffMathy/cordova-plugin-video-editor.git", "cordova-plugin-whitelist": "^1.3.3", "core-js": "^2.5.4", "cropperjs": "^1.5.6", "firebase": "^6.0.1", "geofirestore": "^3.3.0", "geokit": "^0.1.3", "info.protonet.imageresizer": "0.1.1", "jquery": "^3.4.1", "leaflet": "^1.4.0", "leaflet-routing-machine": "^3.2.12", "leaflet.gridlayer.googlemutant": "^0.8.0", "leaflet.tilelayer.pouchdbcached": "^1.0.0", "lrm-google-router": "^1.2.0", "mapbox-gl": "^1.4.1", "pouchdb": "^7.1.1", "rxjs": "~6.5.1", "tslib": "^1.9.0", "zone.js": "~0.8.29" }, "devDependencies": { "@angular-devkit/architect": "~0.13.8", "@angular-devkit/build-angular": "^0.13.9", "@angular-devkit/core": "~7.3.8", "@angular-devkit/schematics": "~7.3.8", "@angular/cli": "~7.3.8", "@angular/compiler": "~7.2.2", "@angular/compiler-cli": "~7.2.2", "@angular/language-service": "~7.2.2", "@ionic/angular-toolkit": "~1.5.1", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~10.14.2", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~8.1.0", "tslint": "~5.16.0", "typescript": "~3.1.6" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-geolocation": {}, "cordova-plugin-camera": {}, "cordova-plugin-file": {}, "cordova-plugin-camera-preview": { "ANDROID_SUPPORT_LIBRARY_VERSION": "26+" }, "cordova-plugin-media-capture": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-android-permissions": {}, "info.protonet.imageresizer": {}, "cordova-plugin-apprate": {}, "cordova-plugin-app-version": {}, "cordova-plugin-video-editor": {}, "cordova-plugin-fcm-with-dependecy-updated": {}, "cordova-plugin-ios-camera-permissions": { "CAMERA_USAGE_DESCRIPTION": "your usage message", "MICROPHONE_USAGE_DESCRIPTION": "your microphone usage message here", "PHOTOLIBRARY_ADD_USAGE_DESCRIPTION": "your photo library usage message here", "PHOTOLIBRARY_USAGE_DESCRIPTION": "your photo library usage message here" }, "cordova-plugin-advanced-http": { "OKHTTP_VERSION": "3.10.0" } }, "platforms": [ "android", "ios" ] } }

javray avatar May 28 '20 06:05 javray

javray how can i change video editor with https://github.com/ffMathy/cordova-plugin-video-editor.git

step by step please.

davidTaveras48 avatar Aug 23 '20 23:08 davidTaveras48

@davidTaveras48 Instead of use ionic cordova plugin add cordova-plugin-video-editor, you use:

ionic cordova plugin add https://github.com/ffMathy/cordova-plugin-video-editor.git

That's all, there is no more steps, only one.

javray avatar Aug 26 '20 18:08 javray

@javray im trying but im getting an error, do you have a tutorial with a basic project explaining how to use the ffMathy git folder im going to be thankful if you can make a tutorial like how to do it for rookies like me like us.

PD: i did this

$ ionic cordova plugin rm cordova-plugin-video-editor $ npm uninstall @ionic-native/video-editor

then this $ ionic cordova plugin add https://github.com/ffMathy/cordova-plugin-video-editor.git

and nothing happens. Thanks!

davidTaveras48 avatar Aug 28 '20 22:08 davidTaveras48

@davidTaveras48 You should not uninstall @ionic-native/video-editor, so install it again and then all works:

npm install @ionic-native/video-editor

javray avatar Aug 29 '20 19:08 javray

ok you telling me that i have to do is the code below:

$ ionic cordova plugin add cordova-plugin-video-editor $ npm install @ionic-native/video-editor

then this $ ionic cordova plugin add https://github.com/ffMathy/cordova-plugin-video-editor.git

???

davidTaveras48 avatar Aug 29 '20 19:08 davidTaveras48

@davidTaveras48 No, do this:

$ ionic cordova plugin rm cordova-plugin-video-editor $ ionic cordova plugin add https://github.com/ffMathy/cordova-plugin-video-editor.git $ npm install @ionic-native/video-editor

javray avatar Aug 29 '20 20:08 javray