mobile CCTV,mobile surveillance,police body worn cameras

标题: MPU里面的视频编码分辨率是从设备查询上报来的吗? [打印本页]

author: besovideo    time: 2019-11-19 09:28
标题: MPU里面的视频编码分辨率是从设备查询上报来的吗?
底层视频分辨率加上了720*576(上面的红框),但是一运行MPU就被覆盖了,变成了下面红框MPU里的数据,上面是底层现有的分辨率,下面是MPU的分辨率,明显MPU是多于底层的分辨率的,那是否说明,MPU并没有依赖于底层?


author: besovideo    time: 2019-11-19 09:30
我们研发答复:
mpu只是获取预览流分辨率列表,并打开预览流,作为普通应用是不可能有权限修改分辨率列表的。
为什么会变化,还需要安卓系统底层找下原因。
author: besovideo    time: 2019-11-19 09:34

1)mpu的视频分辨率设置列表 是怎么得来的?
2)如果需要添加一个分辨率,比如720X576,需要如何处理?
3)我发现mpu每次启动的时候,其实会去设置camera的参数 video-size-values,其值为:video-size-values: 2688x1512,1920x1080,1600x1200,1440x1080,1280x960,1280x768,1280x720,1200x1200,1024x768,800x600,864x480,800x480,720x480,640x480,640x360,480x640,480x360,480x320,352x288,320x240,240x320,176x144,160x120,144x176。
     而我们TW8的固件,预设的video-size-values是:1920x1080,1280x960,1280x720,864x480,800x480,720x480,640x480,480x640,640x360,480x360,480x320,352x288,320x240,240x320,176x144,144x176,160x120。
     所以,我自己觉得mpu 的视频分辨率可选项跟固件的default,并没有关联。是不是可以这么理解?

可以用adb shell dumpsys media.camera | grep video 打印出camera的各种参数。

author: xuwei    time: 2019-11-19 09:37
besovideo post on2019-11-19 09:34
1)mpu的视频分辨率设置列表 是怎么得来的?
2)如果需要添加一个分辨率,比如720X576,需要如何处理?
...

使用如下代码即可获取到预览分辨率列表
Camera camera = Camera.open();
Parametersparameters = camera.getParameters();
List<Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes();
author: janeyre    time: 2019-11-19 09:42
camera parameter预设值是系统设定的,但是app可以通过setParameter去修改。如果没有调用setParameter,不可能出现跟mpu视频分辨率选项完全一致的video-size-values值。
你们可以用adb shell dumpsys media.camera去dump一下,mpu启动过后,video-size-values的列表。
代码里的video-size-values预设值如下表:

static cam_dimension_t default_video_sizes[] = {
  { 4096, 2160},// true 4K
  { 3840, 2160},// 4K
  { 1920, 1080},// 1080p
  { 1280, 960},
  { 1280, 720}, // 720p
  { 864, 480},  // FWVGA
  { 800, 480},  // WVGA
  { 720, 480},  // 480p
  { 640, 480},  // VGA
  { 480, 640},  // VGA portrait
  { 640, 360},
  { 480, 360},  // HVGA for HFR support
  { 480, 320},  // HVGA
  { 352, 288},  // CIF
  { 320, 240},  // QVGA
  { 240, 320},  // QVGA portrait
  { 176, 144},  // QCIF
  { 144, 176},  // QCIF portrait
  { 160, 120}
};
里边并没有1200X1200这样的内容,而在mpu的选项里边有。
author: xuwei    time: 2019-11-19 09:45
janeyre post on2019-11-19 09:42
camera parameter预设值是系统设定的,但是app可以通过setParameter去修改。如果没有调用setParameter,不 ...

android里面有三个分辨率列表,分别是videoSize,previewSize,和PictureSize,MPU使用的是预览流,所以获取的是预览分辨率previewSize,你用上面给出的代码,写一个demo打印出结果就知道怎么回事了
author: janeyre    time: 2019-11-19 09:47
而且,我真正测试过,我选择1200X1200 视频分辨率,在smarteye client端看到的图传分辨率就是1200X1200,是有效的。我确认1200x1200分辨率,不在我预设的video_sizes列表里。
author: xuwei    time: 2019-11-19 09:51
janeyre post on2019-11-19 09:47
而且,我真正测试过,我选择1200X1200 视频分辨率,在smarteye client端看到的图传分辨率就是1200X1200,是 ...

你所说的应该是VideoSize,android里面有三个分辨率列表,分别是videoSize,previewSize,和PictureSize,MPU使用的是预览流,所以获取的是预览分辨率previewSize,你用上面给出的代码,写一个demo打印出结果就知道怎么回事了
author: janeyre    time: 2019-11-19 09:53
我把mpu配置开机不自启动。我打开别的APP来开启摄像头,然后dump得到的video参数是:
         video-batch-size: 0

        video-cds-mode-values: off,on,auto
        video-flip: off
        video-frame-format: android-opaque
        video-hfr: off
        video-hfr-values: 60,90,120,off
        video-hsr: off
        video-rotation: 0
        video-rotation-values: 0,90,180,270
        video-size: 1920x1080
        video-size-values: 1920x1080,1280x960,1280x720,864x480,800x480,720x576,720x480,640x480,480x640,640x360,480x360,480x320,352x288,320x240,240x320,176x144,144x176,160x120
        video-snapshot-supported: true
        video-stabilization-supported: false
        video-tnr-mode-values: off,on

    ———— video-size-values,跟固件系统的default,是完全一致的。

author: xuwei    time: 2019-11-19 09:55
janeyre post on2019-11-19 09:53
我把mpu配置开机不自启动。我打开别的APP来开启摄像头,然后dump得到的video参数是:
         video-batc ...

MPU使用的是预览流,所以获取的是预览分辨率previewSize,你用上面给出的代码,写一个demo打印出结果就知道怎么回事了
author: besovideo    time: 2019-11-19 09:56
嗯,有不同的流,我们用的是Preview流。可能差异就在这里吧?

author: janeyre    time: 2019-11-19 10:38
打印出来的log:
getSupportedPreviewSizes strList = [640x480, 640x360, 576x432, 480x360, 480x320, 384x288, 352x288, 320x240, 240x320, 240x160, 176x144, 144x176, 160x120]
adb dump出来的数据如下:
        preview-flip: off
        preview-format: yuv420sp
        preview-format-values: yuv420sp,yuv420p,nv12-venus
        preview-fps-range: 30000,30000
        preview-fps-range-values: (15000,15000),(20000,20000),(24000,24000),(7000,30000),(30000,30000)
        preview-frame-rate: 30
        preview-frame-rate-values: 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
        preview-size: 640x480
        preview-size-values: 640x480,640x360,576x432,480x360,480x320,384x288,352x288,320x240,240x320,240x160,176x144,144x176,160x120


author: janeyre    time: 2019-11-19 10:45
用 Camera.Parameters.getSupportedPreviewSizes()打印出来的数据为:
getSupportedPreviewSizes strList = [640x480, 640x360, 576x432, 480x360, 480x320, 384x288, 352x288, 320x240, 240x320, 240x160, 176x144, 144x176, 160x120]
与adb shell dumpsys media.camera | grep preview   这条指令dump出来的数据是一致的
preview-flip: off
        preview-format: yuv420sp
        preview-format-values: yuv420sp,yuv420p,nv12-venus
        preview-fps-range: 7000,30000
        preview-fps-range-values: (15000,15000),(20000,20000),(24000,24000),(7000,30000),(30000,30000)
        preview-frame-rate: 30
        preview-frame-rate-values: 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
        preview-size: 640x480
        preview-size-values: 640x480,640x360,576x432,480x360,480x320,384x288,352x288,320x240,240x320,240x160,176x144,144x176,160x120
         preview-flip: off
        preview-format: yuv420sp
        preview-format-values: yuv420sp,yuv420p,nv12-venus
        preview-fps-range: 30000,30000
        preview-fps-range-values: (15000,15000),(20000,20000),(24000,24000),(7000,30000),(30000,30000)
        preview-frame-rate: 30
        preview-frame-rate-values: 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
        preview-size: 640x480
        preview-size-values: 640x480,640x360,576x432,480x360,480x320,384x288,352x288,320x240,240x320,240x160,176x144,144x176,160x120

       这个跟我们要讨论的视频图传分辨率有什么关系呢?
author: janeyre    time: 2019-11-19 10:49
在运行MPU之后,dump出来的值是:
        C:\Users\jiana>adb shell dumpsys media.camera | grep preview
        preferred-preview-size-for-video: 1920x1080
        preview-format: yuv420sp
        preview-format-values: yuv420p,yuv420sp,
        preview-fps-range: 7000,30000
        preview-fps-range-values: (15000,15000),(20000,20000),(24000,24000),(7000,30000),(30000,30000)
        preview-frame-rate: 30
        preview-frame-rate-values: 15,20,24,30
        preview-size: 1920x1080
        preview-size-values: 1920x1080,1600x1200,1440x1080,1280x960,1280x768,1280x720,1200x1200,1024x768,800x600,864x480,800x480,720x480,640x480,640x360,480x640,480x360,480x320,352x288,320x240,240x320,176x144,160x120,144x176
   Active request: preview (paused: no)

      这也不是固件原始的数据。也是被改变了的。跟MPU视频分辨率一致了。
author: xuwei    time: 2019-11-19 10:50
janeyre post on2019-11-19 10:45
用 Camera.Parameters.getSupportedPreviewSizes()打印出来的数据为:
getSupportedPreviewSizes strList  ...

图传的图像就是来自预览流,预览的分辨率来自getSupportedPreviewSizes
author: janeyre    time: 2019-11-19 11:00
现在的问题是为什么 运行MPU的时候,preview-size-values会变成不一样的参数? 我的demo运行时的得到的数据是很少的。
author: xuwei    time: 2019-11-19 11:08
janeyre post on2019-11-19 11:00
现在的问题是为什么 运行MPU的时候,preview-size-values会变成不一样的参数? 我的demo运行时的得到的数据 ...

我这边写的单独一个demo获取的分辨率如下:
2016-12-31 16:30:22.628 11695-11695/? D/MainActivity: 1920*1080
2016-12-31 16:30:22.628 11695-11695/? D/MainActivity: 1600*1200
2016-12-31 16:30:22.628 11695-11695/? D/MainActivity: 1440*1080
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 1280*960
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 1280*768
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 1280*720
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 1200*1200
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 1024*768
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 800*600
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 864*480
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 800*480
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 720*480
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 640*480
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 640*360
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 480*640
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 480*360
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 480*320
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 352*288
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 320*240
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 240*320
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 176*144
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 160*120
2016-12-31 16:30:22.629 11695-11695/? D/MainActivity: 144*176
author: xuwei    time: 2019-11-19 11:09
janeyre post on2019-11-19 11:00
现在的问题是为什么 运行MPU的时候,preview-size-values会变成不一样的参数? 我的demo运行时的得到的数据 ...

代码如下:
                        if (mCamera == null) {
                                mCamera = Camera.open();
                        }
                        Camera.Parameters parameters = mCamera.getParameters();
                        parameters.setPreviewFormat(ImageFormat.NV21);
                        List<Size> sizes = parameters.getSupportedPreviewSizes();
                        for(Size size:sizes){
                                Log.d(TAG,size.width+"*"+size.height);
                        }
author: xuwei    time: 2019-11-19 11:12
janeyre post on2019-11-19 11:00
现在的问题是为什么 运行MPU的时候,preview-size-values会变成不一样的参数? 我的demo运行时的得到的数据 ...

按照你测试结果,测试demo只是调用getSupportedPreviewSizes,dump参数不是也发生了变化了么
author: janeyre    time: 2019-11-19 11:21
我运行demo getSupportedPreviewSizes打印的数据和dump出来的数据是一致的。 没有变化呀!
都是——[640x480, 640x360, 576x432, 480x360, 480x320, 384x288, 352x288, 320x240, 240x320, 240x160, 176x144, 144x176, 160x120]

但是运行MPU之后,再去dump就变成了——1920x1080,1600x1200,1440x1080,1280x960,1280x768,1280x720,1200x1200,1024x768,800x600,864x480,800x480,720x480,640x480,640x360,480x640,480x360,480x320,352x288,320x240,240x320,176x144,160x120,144x176  
多出来很多分辨率。这是我无法理解的。
author: xuwei    time: 2019-11-19 11:26
janeyre post on2019-11-19 11:21
我运行demo getSupportedPreviewSizes打印的数据和dump出来的数据是一致的。 没有变化呀!
都是——[640x4 ...

MPU打印出来的数据和dump数据也是一样的
author: xuwei    time: 2019-11-19 11:30
janeyre post on2019-11-19 11:21
我运行demo getSupportedPreviewSizes打印的数据和dump出来的数据是一致的。 没有变化呀!
都是——[640x4 ...

现在你需要知道的就是MPU使用的是getSupportedPreviewSizes获取分辨率列表,如果你要添加新的分辨率支持,就在这个列表里面支持
author: xuwei    time: 2019-11-19 11:33
xuwei post on2019-11-19 11:30
现在你需要知道的就是MPU使用的是getSupportedPreviewSizes获取分辨率列表,如果你要添加新的分辨率支持 ...

不要纠结改不改变的问题,据我们所知,普通应用是没法改getSupportedPreviewSizes的结果,也没有提供这个接口,如果你认为有,你可以把测试好的DEMO代码发出来,我们这边也学习下
author: janeyre    time: 2019-11-19 13:43
看来问题的确在我这边,我打印出来的数据正确了:
11-19 13:40:37.186  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1920*1080
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1600*1200
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1440*1080
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1280*960
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1280*768
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1280*720
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1200*1200
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:1024*768
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:800*600
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:864*480
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:800*480
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:720*480
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:640*480
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:640*360
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:480*640
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:480*360
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:480*320
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:352*288
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:320*240
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:240*320
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:176*144
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:160*120
11-19 13:40:37.187  2852  2852 D CameraTest: getSupportedPreviewSizes@initNativeCamera:144*176

我来查如何添加preview的分辨率吧。谢谢!
author: besovideo    time: 2019-11-19 13:49
多谢简总。

author: besovideo    time: 2019-11-19 17:13
getSupportedPreviewSizes 已经可以枚举到 [1920x1080,1600x1200,1440x1080,1280x960,1280x768,1280x720,1200x1200,1024x768,800x600,864x480,800x480,720x576,720x480,640x480,640x360,480x640,480x360,480x320,352x288,320x240,240x320,176x144,160x120,144x176]tianj 添加新分辨率720*576






欢迎光临 mobile CCTV,mobile surveillance,police body worn cameras (http://bbs.besovideo.com:8067/) Powered by Discuz! X3.2