title: Non-baseline AVC video profile is not supported by Android OS
body: <p>I have been using the "<a href="https://github.com/jbavari/cordova-plugin-video-editor" rel="nofollow noreferrer">cordova-plugin-video-editor</a>" plugin to reduce the size/quality of my videos before uploading them to the server.</p>
  
  <p>The plugin works correctly on most Android phones and no worries on iOS.</p>
  
  <p>But on recent Android phones it happens that it crashes.
  I reproduce this error with a Xiaomi RedMi Note 7 under Android 9.</p>
  
  <p>I have this mistake: </p>
  
  <blockquote>
    <p>net.ypresto.androidtranscoder.engine.InvalidOutputFormatException:</p>
    
    <p>Non-baseline AVC video profile is not supported by Android OS, actual
    profile_idc: 100</p>
  </blockquote>
  
  <p>Here are the characteristics of the video:</p>
  
  <pre><code>H264 - MPEG-4 AVC (part10)(avc1)
  1920x1080
  Planar 4:2:0 YUV
  ITU-R BT.601 (50 Hz)
  
  MPEG AAC Audio (mp4a)
  48000Hz
  32bits
  </code></pre>
  
  <p>After several searches I can't find a solution but still some leads like :</p>
  
  <ul>
  <li><p><a href="https://github.com/ypresto/android-transcoder/issues/72" rel="nofollow noreferrer">https://github.com/ypresto/android-transcoder/issues/72</a></p></li>
  <li><p><a href="https://github.com/ypresto/android-transcoder/pull/73#issuecomment-475871771" rel="nofollow noreferrer">https://github.com/ypresto/android-transcoder/pull/73#issuecomment-475871771</a></p></li>
  </ul>
  
  <p>Today I can't come to any other conclusion than to have to create my own plugin to use another Android library that is compatible with new video formats.
  I must admit that I don't like this solution too much and that's why I call on the community.</p>
  
  <p>Do you think you have any additional information on this problem that could help me?</p>
  
  <p>Thank you very much.</p>
  
  <h2>Solved with :</h2>
  
  <p>It was indeed the plugin dependency that was not compatible with the new codecs.</p>
  
  <p>So I fork the plugin on my github and then modify the code part that transcodes the video.
  Now I use this library instead of the old one: <a href="https://github.com/tangpeng/VideoCompressor" rel="nofollow noreferrer">https://github.com/tangpeng/VideoCompressor</a></p>
  
  <p>You can see the changes in the commits of this repo: 
  <a href="https://github.com/Eblancho/cordova-plugin-video-editor" rel="nofollow noreferrer">https://github.com/Eblancho/cordova-plugin-video-editor</a></p>
  
  <p>I do not advise you to use it for your projects because it is not 100% tested / compatible with all phones, it is very recent as a change.</p>
  
  <p>In addition to that, unlike the previous version which allowed to choose the height/width, bitrates and other things, my version the calculations:</p>
  
  <pre><code>newHeight = videoHeight / 2;
  newWidth = videoWidth / 2;
  bitrates = (newHeight / 2) * (newWidth / 2) * 10;
  </code></pre>
  
  <p>If you have any comments or questions about my code, feel free to ask it.</p>
  
  <h2>But a new problem has emerged :</h2>
  
  <p>This new problem is not a side effect due to my modifications because it also appears on the old versions, I just thought it was also related to transcoding.</p>
  
  <p>Now, when I open the camera to record my video, as soon as I want to close the intent to go back to the Cordova mainActivity, the application restarts.</p>
  
  <p>I don't think that's really the topic for discussion, so I'm going to create a new discussion to better separate my problems.</p>