Page 1 of 1

使用ffmepg推流

Posted: 2024-06-24 2:02
by Meekdai
由于RKIPC的延迟比较大,想使用其他方式实现推流。在使用ffmpeg的时候遇到如下问题。
设备:Luckfox Pico Ultra + SC3336 + 官方buildroot镜像

在使用RKIPC的情况下,可以通过VLC查看到视频输出后。

结束RKIPC

Code: Select all

killall rkipc
列出摄像头

Code: Select all

[root@luckfox root]$ v4l2-ctl --list-devices
rkisp-statistics (platform: rkisp):
        /dev/video19
        /dev/video20

rkcif-mipi-lvds (platform:rkcif):
        /dev/media0

rkcif (platform:rkcif-mipi-lvds):
        /dev/video0
        /dev/video1
        /dev/video2
        /dev/video3
        /dev/video4
        /dev/video5
        /dev/video6
        /dev/video7
        /dev/video8
        /dev/video9
        /dev/video10

rkisp_mainpath (platform:rkisp-vir0):
        /dev/video11
        /dev/video12
        /dev/video13
        /dev/video14
        /dev/video15
        /dev/video16
        /dev/video17
        /dev/video18
        /dev/media1
查看/dev/video11的格式

Code: Select all

[root@luckfox root]$ v4l2-ctl --device=/dev/video11 --all
Driver Info:
        Driver name      : rkisp_v7
        Card type        : rkisp_mainpath
        Bus info         : platform:rkisp-vir0
        Driver version   : 2.0.0
        Capabilities     : 0x84201000
                Video Capture Multiplanar
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04201000
                Video Capture Multiplanar
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : rkisp-vir0
        Model            : rkisp0
        Serial           :
        Bus info         :
        Media version    : 5.10.110
        Hardware revision: 0x00000000 (0)
        Driver version   : 5.10.110
Interface Info:
        ID               : 0x03000007
        Type             : V4L Video
Entity Info:
        ID               : 0x00000006 (6)
        Name             : rkisp_mainpath
        Function         : V4L2 I/O
        Pad 0x01000009   : 0: Sink
          Link 0x0200000a: from remote pad 0x1000004 of entity 'rkisp-isp-subdev' (Unknown V4L2 Sub-Device): Data, Enabled
Priority: 2
Format Video Capture Multiplanar:
        Width/Height      : 2304/1296
        Pixel Format      : 'NV12' (Y/CbCr 4:2:0)
        Field             : None
        Number of planes  : 1
        Flags             :
        Colorspace        : Default
        Transfer Function : Default
        YCbCr/HSV Encoding: Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 2304
           Size Image     : 4478976
Selection Video Capture: crop, Left 0, Top 0, Width 2304, Height 1296, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 2304, Height 1296, Flags:
Selection Video Output: crop, Left 0, Top 0, Width 2304, Height 1296, Flags:
Selection Video Output: crop_bounds, Left 0, Top 0, Width 2304, Height 1296, Flags:

Image Processing Controls
pixel_rate 0x009f0902 (int64)  : min=0 max=1000000000 step=1 default=1000000000 value=101250000 flags=read-only, volatile
运行ffmpeg指令

Code: Select all

[root@luckfox root]$ ffmpeg -f v4l2 -input_format nv12 -video_size 2304x1296 -i /dev/video11 -c:v libx264 -b:v 2000k -f flv rtmp://192.168.11.16/live/0
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 8.3.0 (crosstool-NG 1.24.0)
  configuration: --enable-cross-compile --cross-prefix=/opt/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/arm-rockchip830-linux-uclibcgnueabihf- --sysroot=/opt/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot --host-cc=/usr/bin/gcc --arch=arm --target-os=linux --disable-stripping --pkg-config=/opt/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid --disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --disable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --enable-libv4l2 --enable-avresample --enable-ffprobe --disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --disable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --disable-libdrm --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-mmal --disable-omx --disable-omx-rpi --disable-libopencv --disable-libopus --disable-libvpx --enable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --disable-libtheora --enable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --disable-libx264 --disable-libx265 --disable-libdav1d --disable-x86asm --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --enable-armv6 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=cortex-a7
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
[video4linux2,v4l2 @ 0x5269b0] Not a video capture device.
/dev/video11: No such device
使用最简单的ffmpeg指令也是一样

Code: Select all

ffmpeg -f v4l2 -i /dev/video11 output.mp4
报错

Code: Select all

[video4linux2,v4l2 @ 0x4e6950] Not a video capture device.
/dev/video11: No such device
这个我尝试了其他/dev/video* 都是一样的结果,请帮忙看看问题出在哪里?

Re: 使用ffmepg推流

Posted: 2024-07-16 15:33
by 14Og
Hey! I've got my pico mini b yesterday and encountered the same problem, did you make any progress to resolve it? Why this topic is not supported by developers? There is v4l2 driver for camera and it should be easy to use ffmpeg or gstreamer to capture video, but there is 0 information about it in their wiki, which is quite strange...
Any information would be helpful

Re: 使用ffmepg推流

Posted: 2024-07-17 1:17
by Luckfox Taylor
14Og wrote: 2024-07-16 15:33 Hey! I've got my pico mini b yesterday and encountered the same problem, did you make any progress to resolve it? Why this topic is not supported by developers? There is v4l2 driver for camera and it should be easy to use ffmpeg or gstreamer to capture video, but there is 0 information about it in their wiki, which is quite strange...
Any information would be helpful
https://wiki.luckfox.com/Luckfox-Pico/L ... ls-toolkit

Re: 使用ffmepg推流

Posted: 2024-07-17 7:59
by 14Og
Luckfox Taylor wrote: 2024-07-17 1:17
14Og wrote: 2024-07-16 15:33 Hey! I've got my pico mini b yesterday and encountered the same problem, did you make any progress to resolve it? Why this topic is not supported by developers? There is v4l2 driver for camera and it should be easy to use ffmpeg or gstreamer to capture video, but there is 0 information about it in their wiki, which is quite strange...
Any information would be helpful
https://wiki.luckfox.com/Luckfox-Pico/L ... ls-toolkit
Yep, thank you! I've already experienced the fact that v4l2-ctl tool is working fine, and i can capture video with it. But the problem is that ffmpeg with parameter v4l2 as input format can not identify my camera device as video capture device, the same problem that @Meekdai has mentioned above. I'd like to build whole video pipeline with ffmpeg, but for now it seems to be impossible, so that why i came here. Thanks in advance for your help!