从原始视频中提取帧

问题描述

我将配置设置为:

v4l2-ctl -v pixelformat=pRCC,width=4056,height=3040
v4l2-ctl -p 10

然后获取帧:

v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=test.avi

成功结束。现在我一直在尝试从这个视频文件提取帧并将它们转换为 RGB 以供查看。

我有两种相机操作模式,第一种是直接将它连接到地址总线,而不是将格式结果列为:

v4l2-ctl --list-formats-ext

ioctl: VIdioC_ENUM_FMT
Type: Video Capture

[0]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)
    Size: discrete 4056x3040
    Size: discrete 2028x1520
    Size: discrete 2028x1080
[1]: 'RG12' (12-bit Bayer RGRG/GBGB)
    Size: discrete 4056x3040
    Size: discrete 2028x1520
    Size: discrete 2028x1080
[2]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)
    Size: discrete 1012x760
[3]: 'RG10' (10-bit Bayer RGRG/GBGB)
    Size: discrete 1012x760

如果我通过操作系统连接,那么结果是:

ioctl: VIdioC_ENUM_FMT
Type: Video Capture

[0]: 'YU12' (Planar YUV 4:2:0)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[1]: 'YUYV' (YUYV 4:2:2)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[2]: 'RGB3' (24-bit RGB 8-8-8)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[3]: 'JPEG' (JFIF JPEG,compressed)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[4]: 'H264' (H.264,compressed)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[5]: 'MJPG' (Motion-JPEG,compressed)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[6]: 'YVYU' (YVYU 4:2:2)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[7]: 'VYUY' (VYUY 4:2:2)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[8]: 'UYVY' (UYVY 4:2:2)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[9]: 'NV12' (Y/CbCr 4:2:0)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10]: 'BGR3' (24-bit BGR 8-8-8)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[11]: 'YV12' (Planar YVU 4:2:0)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[12]: 'NV21' (Y/CrCb 4:2:0)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2
[13]: 'RX24' (32-bit XBGR 8-8-8-8)
    Size: Stepwise 32x32 - 4056x3040 with step 2/2

正如我所提到的,我试图尽可能快地获得未触及的 12 位数据,然后我可以在 Python 中查看像素数据,最好(我也愿意接受其他建议)。

如果有经验的用户提供一些解决方案,我会很高兴。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)