0

I have been developing a camera app using camera 2 and taking codes from these video series: https://www.youtube.com/watch?v=69J2ycNCtpE&lc=z23lu3jo4xuwzjataacdp43bf4ywaag5x2tpbiljkf1w03c010c I had to update the codes with the run time permissions.

The video quality I obtain is terrible and I do not know why. I tried playing with the output format, the video encoder, the bitrate (according to what I found on other answers) but the quality does not change and it is much worse when compared to the original camera application. When comparing two similar videos with the same length, the resolutions are the same (1080x1920) but the video size resulting from this app is 0.95 MB while the one of the video taken with the original camera app is 12 MB. Clearly, there is something not working, but I do not know what. PS: this phenomenon does not seem to happen to the tutorial guy when he tries the app on his phone. Any help will be much appreciated!

  • Please [edit] to add meaningful code .Posting a [Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve) that demonstrates your problem would help you get better answers. Thanks! – Morse Feb 05 '19 at 19:00

2 Answers2

1

If you try the official video recording sample, Camera2Video, does it also record poor video?

If so, there's likely a device bug that causes it to ignore the configured video quality. If Camera2Video works OK, then see what it does differently from your own app.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
  • Thank you! That example was actually really helpful. I have not had the chance to compare the codes yet, but the official recording sample actually works on my device! – Davide Piaggio Feb 06 '19 at 17:28
-1

I recommend you see this sample https://github.com/googlesamples/android-Camera2Basic

Maybe with this configuration could resolve

// For still image captures, we use the largest available size.
            Size largest = Collections.max(
                    Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
                    new CompareSizesByArea());
            mImageReader = ImageReader.newInstance(largest.getWidth(), largest.getHeight(),
                    ImageFormat.JPEG, /*maxImages*/2);
            mImageReader.setOnImageAvailableListener(
                    mOnImageAvailableListener, mBackgroundHandler);