title: How to convert codec of video recorded by inbuilt Android camera?
body: <p>I record video using the inbuilt camera of android,but when I send to server via Retrofit2,the video cannot seen in browser.So after long time of searching,I know that the video that I record by android,the codec is <code>MP42</code> so I need to convert it to <code>H.264</code> codec in order to make it playable in browser.</p>
  
  <p><strong>Here is how I capture the video</strong>  </p>
  
  <pre><code> private void recordVideo() {
  
          Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
  
          fileUri = getOutputMediaFileUri();
          intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,1);
          intent.putExtra(MediaStore.EXTRA_OUTPUT,fileUri);
          intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,15);
          startActivityForResult(intent, REQUEST_VIDEO_CAPTURE);
      }
  
  @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if(requestCode == RECORD_VIDEO_PERMISSION &amp;&amp; resultCode == RESULT_OK){
              Uri uri =data.getData(); //so the video file I get it here 
              Log.d("videoData",data.getData().toString());
              videoView.setVideoURI(uri);
              videoView.start();
          }
      }
  </code></pre>
  
  <p>I get the uri of the video in <code>onActivityResult</code>,the video is in <code>MP42</code> codec,how can I convert it to <code>H.264</code>? </p>
  
  <p>I tried to use <a href="https://developer.android.com/reference/android/media/MediaCodec.html" rel="nofollow noreferrer">MediaCodec Documentation</a>,but I didnt know where to input my <code>Uri</code> (mp42) to get the output in H.264 codec video(which I want to play in browser).</p>
  
  <p>Somebody please give me some guidance..</p>