OpenEdv-开源电子网

标题: ffmpeg 推流 ov2640摄像头问题 [打印本页]

作者: gaopp    时间: 2022-2-10 17:48
标题: ffmpeg 推流 ov2640摄像头问题
最近一直在学习应用开发,系统烧写的正点原子的官方固件,在做最后的视频监控实验时遇到如下问题:
1.所用摄像头为OV2640,参照手册重新编译了设备树,系统启动时能正常初始化该摄像头。
2.在做V4L2摄像头应用试验时也正常,能正常打开摄像头并将摄像内容显示到屏幕上。
3.在做视频监控实验时,Nginx移植正常,并且可以正常推送开发板上的mp4视频文件。
4.在用教程中的 ffmpeg -f v4l2 -video_size 320x240 -framerate 15 -i /dev/video2 -q 10 -f flv rtmp://127.0.0.1/live/mytest想推送摄像头内容时,执行命令后显示如下:
root@ATK-IMX6U:~# ffmpeg -f v4l2 -video_size 320x240 -framerate 15 -i /dev/video1 -q 10 -f flv rtmp://127.0.0.1/live/mytest
ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc[11381.217361] unknown pixelformat:'YU12'
5.3.0 (GCC)
  configuration: --[11381.222557] mx6s-csi 21c4000.csi: Fourcc format (0x32315559) invalid.
disable-stripping --enable-pic --[11381.232908] unknown pixelformat:'YU12'
enable-shared --enable-pthreads -[11381.238582] mx6s-csi 21c4000.csi: Fourcc format (0x32315559) invalid.
-cross-prefix=arm-poky-linux-gnue[11381.248474] unknown pixelformat:'YV12'
abi- --ld='arm-poky-linux-gnueabi[11381.254439] mx6s-csi 21c4000.csi: Fourcc format (0x32315659) invalid.
-gcc -march=armv7ve -mfpu=neon -m[11381.264310] unknown pixelformat:'422P'
float-abi=hard -mcpu=cortex-a7 --[11381.270308] mx6s-csi 21c4000.csi: Fourcc format (0x50323234) invalid.
sysroot=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk' --arch=arm --target-os=linux --enable-cross-compile --extra-cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/3.0-r0=/usr/src/debug/ffmpeg/3.0-r0 -fdebug-prefix-map=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk= -march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --sysroot=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk --enable-hardcoded-tables --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --disable-avresample --enable-bzlib --disable-libfaac --enable-gpl --disable-libgsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmp3lame --disable-openssl --enable-postproc --disable-libschroedinger --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-libvpx --enable-x11grab --enable-libx264 --enable-outdev=xv
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[video4linux2,v4l2 @ 0x1a04240] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device
/dev/video1: Inappropriate ioctl for device
哪位高人遇到过这种情况,请赐教?
怀疑几个因素:
1)分辨率不支持,但是换成352×288,800×600等都不行
2)ffmpeg -f v4l2这个参数不对,也不知改成其他摄像头支持的格式?
3)命令换成:ffmpeg -f h264 -video_size 352x288 -framerate 10 -i /dev/video1 -q 10 -f flv rtmp://127.0.0.1/live/mytest,执行情况如下:
root@ATK-IMX6U:~# ffmpeg -f h264 -video_size 352x288 -framerate 10 -i /dev/video1 -q 10 -f flv rtmp://127.0.0.1/live/mytest
ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc[11646.531493] ------------[ cut here ]------------
5.3.0 (GCC)
  configuration: --[11646.537794] WARNING: CPU: 0 PID: 934 at drivers/media/v4l2-core/videobuf2-core.c:2822 __vb2_init_fileio+0x124/0x318()
disable-stripping --enable-pic --[11646.551850] Modules linked in:enable-shared --enable-pthreads - icm20608(O)-cross-prefix=arm-poky-linux-gnue mx6s_captureabi- --ld='arm-poky-linux-gnueabi ov2640-gcc -march=armv7ve -mfpu=neon -m
float-abi=hard -mcpu=cortex-a7 --[11646.571246] CPU: 0 PID: 934 Comm: ffmpeg Tainted: G        W  O    4.1.15 #1
sysroot=/home/linuxdzm/alientek_w[11646.581187] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
orkspace/ycoto/fsl-release-bsp/bu[11646.590235] [<80015d78>] (unwind_backtrace) from [<8001271c>] (show_stack+0x10/0x14)
ildQt5.12.9/tmp/sysroots/imx6ull1[11646.600826] [<8001271c>] (show_stack) from [<808237a8>] (dump_stack+0x84/0xc4)
4x14evk' --arch=arm --target-os=l[11646.610900] [<808237a8>] (dump_stack) from [<80036b68>] (warn_slowpath_common+0x80/0xb0)
inux --enable-cross-compile --ext[11646.621848] [<80036b68>] (warn_slowpath_common) from [<80036c34>] (warn_slowpath_null+0x1c/0x24)
ra-cflags=' -O2 -pipe -g -felimin[11646.633500] [<80036c34>] (warn_slowpath_null) from [<8054e150>] (__vb2_init_fileio+0x124/0x318)
ate-unused-debug-types -fdebug-pr[11646.645049] [<8054e150>] (__vb2_init_fileio) from [<8054eb38>] (__vb2_perform_fileio+0x494/0x5d4)
efix-map=/home/linuxdzm/alientek_[11646.656774] [<8054eb38>] (__vb2_perform_fileio) from [<8054ec90>] (vb2_read+0x18/0x20)
workspace/ycoto/fsl-release-bsp/b[11646.667558] [<8054ec90>] (vb2_read) from [<7f005e78>] (mx6s_csi_read+0x4c/0x64 [mx6s_capture])
uildQt5.12.9/tmp/work/cortexa7hf-[11646.679037] [<7f005e78>] (mx6s_csi_read [mx6s_capture]) from [<80536db0>] (v4l2_read+0x60/0x98)
neon-poky-linux-gnueabi/ffmpeg/3.[11646.690586] [<80536db0>] (v4l2_read) from [<800eb4c8>] (__vfs_read+0x1c/0xd0)
0-r0=/usr/src/debug/ffmpeg/3.0-r0[11646.700576] [<800eb4c8>] (__vfs_read) from [<800ebcb0>] (vfs_read+0x7c/0x108)
-fdebug-prefix-map=/home/linuxdz[11646.710575] [<800ebcb0>] (vfs_read) from [<800ec548>] (SyS_read+0x44/0x9c)
m/alientek_workspace/ycoto/fsl-re[11646.720308] [<800ec548>] (SyS_read) from [<8000f480>] (ret_fast_syscall+0x0/0x3c)
lease-bsp/buildQt5.12.9/tmp/sysroots/x86_64-linux= -fdebug-prefix[11646.733980] ---[ end trace c7508cd99e8b472c ]---
-map=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk= -march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --sysroot=/home/linuxdzm/alientek_workspace/ycoto/fsl-release-bsp/buildQt5.12.9/tmp/sysroots/imx6ull14x14evk --enable-hardcoded-tables --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --disable-avresample --enable-bzlib --disable-libfaac --enable-gpl --disable-libgsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmp3lame --disable-openssl --enable-postproc --disable-libschroedinger --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-libvpx --enable-x11grab --enable-libx264 --enable-outdev=xv
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Option video_size not found.??这个表示什么,换成其他分辨率也是不行。

还请高人指点一二,感谢。




作者: a1281854907    时间: 2022-2-11 09:01
sizeStr = str(img_shape[2]) + 'x' + str(img_shape[1])
    bvStr = str(int((img_shape[2] * img_shape[1])/1000)) + 'k'
    fpsStr = str(int(fps))
    command = ['ffmpeg',
               '-y', '-an',
               '-f', 'rawvideo',
               '-vcodec', 'rawvideo',
               '-pix_fmt', 'bgr24',
               '-s', sizeStr,
               '-r', fpsStr,
               '-i', '-',
               '-c:v', 'h264_nvenc',
               '-b:v', bvStr,
               '-maxrate', '8000k',
               '-bufsize', '8000k',
               '-pix_fmt', 'yuv420p',
               '-f', 'flv',
               rtmp_url]
作者: 茂茂2019    时间: 2022-2-11 09:40
帮顶
作者: A571157242    时间: 2022-2-11 10:23
帮顶  
作者: 仰望星空之云    时间: 2022-2-14 10:07
帮顶,帮顶
作者: 茂茂2019    时间: 2022-2-14 10:17
ov2640摄像头好像是video1,你先按快速体验手册看看摄像头是哪个节点
作者: gaopp    时间: 2022-2-14 14:41
茂茂2019 发表于 2022-2-14 10:17
ov2640摄像头好像是video1,你先按快速体验手册看看摄像头是哪个节点

你是对的,我贴子中写错了,但是我把摄像头节点换成video1也是不行的。
作者: 秀才231    时间: 2022-7-4 17:29
gaopp 发表于 2022-2-14 14:41
你是对的,我贴子中写错了,但是我把摄像头节点换成video1也是不行的。

遇到了同样问题,请问楼主解决了么
作者: 秀才231    时间: 2022-7-5 10:01
顶贴,求大神
作者: 1007884316    时间: 2023-5-18 10:55
楼主解决了吗

作者: hangon    时间: 2024-4-9 19:12
这问题两年都没解?




欢迎光临 OpenEdv-开源电子网 (http://47.111.11.73/) Powered by Discuz! X3.4