jacksonliam / mjpg-streamer

Fork of http://sourceforge.net/projects/mjpg-streamer/
3.04k stars 1.23k forks source link

Stream is Slow in AR9331 board #329

Closed dhawal2611 closed 3 years ago

dhawal2611 commented 3 years ago

Hi all,

Board : AR9331 openwrt module

I have Cross compiled mjpg-streamer package for OpenWRT system. Below are the steps for cross compiled mjpg-sreamer for AR9331 module

PATH=$PATH:/home/sysadmin/Public/Dhawal/openwrt_dhawal/vet-openwrt/openwrt-19.07.7/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin export STAGING_DIR=/home/sysadmin/Public/Dhawal/openwrt_dhawal/vet-openwrt/openwrt-19.07.7/staging_dir/ export CROSS_COMPILE=mips-openwrt-linux- export ARCH=mips export CC=mips-openwrt-linux-gcc make

While Running the binary in the OpenWRT the device shows low speed. At Resolution 1280x720 approx 7-8 frames are captured per second But At Resolution 640x480 approx 12-13 frames are captured per second Also At Resolution 320x240 approx 12-13 frames are captured per second The details is as shown in below image.

image

_We have disabled code in outputfile.so, So the image is not stored in file.

Just we are taking the frame from uvc only and getting count of frames read from camera That's the reason we have used the command mentioned

The frames are captured, but the count of frames at resolution 1280x720 is very low. So, When transfering the image over http(seen video on below mentioned IP) gets slow down or struct sometime

Camera used is endoscope USB camera. Part number of Camera is HD603, provided by shenzhen angell technology co. ltd..

I have tested it on Orange Pi 3, the stream is smooth on it.

So, Can I get the reason why the stream is slow on AR9331 board


Below are few more details regarding AR9331 board

BOARD: GainStrong Oolite v1-Dev SOC: AR9330 rev. 1 CPU: MIPS 24Kc RAM: 64 MB DDR2 16-bit CL3-4-4-10 FLASH: 16 MB Winbond W25Q128 MAC: 00:03:7F:09:0B:AD CLOCKS: CPU/RAM/AHB/SPI/REF 400/400/200/ 25/ 25 MHz

Hit any key to stop booting: 0 Booting image from 0x9F020000...

Image name: MIPS OpenWrt Linux-4.14.221 Build date: 2021-02-15 15:22:37 UTC Architecture: MIPS OS/image type: Linux Kernel Compression: LZMA Data size: 1.4 MB (1500591 bytes) Load address: 0x80060000 Entry point: 0x80060000

Number of CPU used : 1

CPU details are : root@SLSVETAIE:/# cat /proc/cpuinfo system type : Atheros AR9330 rev 1 machine : GainStrong Oolite V1.0 processor : 0 cpu model : MIPS 24Kc V7.4 BogoMIPS : 265.42 wait instruction : yes microsecond timers : yes tlb_entries : 16 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : mips16 Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc dc_aliases perf_cntr_intr_bit nan_legacy nan_2008 perf shadow register sets : 1 kscratch registers : 0 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available


In comparison below are details of orange Pi 3

CPU: Allwinner H6 (SUN50I) Model: OrangePi 3 DRAM: 2 GiB MMC: mmc@4020000: 0, mmc@4022000: 1 Loading Environment from FAT... Unable to use mmc 1:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: No ethernet found.

root@orangepi3:/home/tempie_fr# cat /proc/cpuinfo processor : 0 Processor : AArch64 Processor rev 4 (aarch64) Hardware : sun50iw1p1 BogoMIPS : 48.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 1 Processor : AArch64 Processor rev 4 (aarch64) Hardware : sun50iw1p1 BogoMIPS : 48.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 2 Processor : AArch64 Processor rev 4 (aarch64) Hardware : sun50iw1p1 BogoMIPS : 48.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 3 Processor : AArch64 Processor rev 4 (aarch64) Hardware : sun50iw1p1 BogoMIPS : 48.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4


Above details are for comparison of the board regarding CPU and memory related details Please Have a look on it and let me know why stream is slow in AR9331 module as compare to Orange Pi 3

Thanks in advance Dhawal Lad

dhawal2611 commented 3 years ago

Below Image shows frames read from camera per second at resolution 1280x720 image Below Image shows frames read from camera per second at resolution 640x480 image Below Image shows frames read from camera per second at resolution 320x240 image

Please let me know why we are getting slow stream and less frames in the device _NOTE : "outputfile.so" this file dose not contain any code, No files are generated

jacksonliam commented 3 years ago

Closed duplicate #328.

Please don't open a new issue for the same thing. This is not an issue with mjpg-streamer code. You can reply to the closed issue.

Check top command, what is using all the CPU?

Are you able to capture frames faster with any other software on this CPU?

dhawal2611 commented 3 years ago

image

Please have a look on the above image. It shows that Nothing is using CPU So What may be the reason??????

jacksonliam commented 3 years ago

Possibly USB bandwidth issue, are you able to grab frames faster with another application e.g. libav / ffmepg?

dhawal2611 commented 3 years ago

lsusb logs image

Below are the logs that shows the high speed USB detected


root@SLSVETAIE:/# lsusb -d 1d6b:0002 -v

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 1 Single TT bMaxPacketSize0 64 idVendor 0x1d6b Linux Foundation idProduct 0x0002 2.0 root hub bcdDevice 4.14 iManufacturer 3 Linux 4.14.221 ehci_hcd iProduct 2 EHCI Host Controller iSerial 1 ehci-platform bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 25 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xe0 Self Powered Remote Wakeup MaxPower 0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 9 Hub bInterfaceSubClass 0 Unused bInterfaceProtocol 0 Full speed (or root) hub iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0004 1x 4 bytes bInterval 12 Hub Descriptor: bLength 9 bDescriptorType 41 nNbrPorts 1 wHubCharacteristic 0x0009 Per-port power switching Per-port overcurrent protection TT think time 8 FS bits bPwrOn2PwrGood 10 * 2 milli seconds bHubContrCurrent 0 milli Ampere DeviceRemovable 0x00 PortPwrCtrlMask 0xff Hub Port Status: Port 1: 0000.0503 highspeed power enable connect Device Status: 0x0001 Self Powered


USB detected LOGS

[20740.620719] usb 1-1: new high-speed USB device number 2 using ehci-platform [20740.859462] uvcvideo: Found UVC 1.00 device USB Camera (0bda:5846) [20740.876413] input: USB Camera: USB Camera as /devices/platform/ehci-platform/usb1/1-1/1-1:1.0/input/input0

USB detected is High speed USB only

Please have a look on it and let me know if any comments regarding it

dhawal2611 commented 3 years ago

Hi, I have tested the code with ffmpeg but when I tried to run the code with Resolution with 1280*720 then crash is occured and code gets stop due to low memory while running the ffmpeg code

Running ffmpeg with resolution 640480 or 320240 the code gets executed and we get the frames count between 12-13 frames/sec


Logs at Resolution 640*480

root@SLSVETAIE:/tmp# ffmpeg -f v4l2 -input_format mjpeg -framerate 30 -video_siz e 640x480 -i /dev/video0 -c:v copy output.mkvv-f mpegts -flush_packets 0 udp://192.168.1.4:5000?pkt_s

ize=1316 ffmpeg version 3.4.7 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7.5.0 (OpenWrt GCC 7.5.0 r11306-c4a6851c72) configuration: --enable-cross-compile --cross-prefix=mips-openwrt-linux-musl- --arch=mips --cpu=24kc --target-os=linux --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --disable-altivec --disable-vsx --disable-power8 --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-inline-asm --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi --disable-fast-unaligned --disable-runtime-cpudetect --disable-asm --disable-inline-asm --disable-x86asm --enable-avresample --disable-decoder=atrac3 --disable-decoder=h264 --disable-decoder=hevc --disable-decoder=vc1 --disable-muxer=h264 --disable-muxer=hevc --disable-muxer=vc1 --disable-demuxer=h264 --disable-demuxer=hevc --disable-demuxer=vc1 --disable-parser=h264 --disable-parser=hevc --disable-parser=vc1 --enable-small --enable-libshine libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 [video4linux2,v4l2 @ 0x77ecc710] The driver changed the time per frame from 1/30 to 1/15 Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 456.961099, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 15 fps, 15 tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg2video (native)) Press [q] to stop, [?] for help [swscaler @ 0x67c000] deprecated pixel format used, make sure you did set range correctly Output #0, mpegts, to 'udp://192.168.1.4:5000?pkt_size=1316': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: mpeg2video, yuv422p, 640x480, q=2-31, 200 kb/s, 15 fps, 90k tbn, 15 tbc Metadata: encoder : Lavc57.107.100 mpeg2video Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 frame= 2 fps=0.6 q=4.7 size= 26kB time=-00:00:00.13 bitrate=N/A speed=N/A
frame= 3 fps=0.6 q=2.0 size= 66kB time=00:00:00.00 bitrate=48811636.4kbits/s speed=2.02e-06x
frame= 4 fps=0.5 q=2.0 size= 112kB time=00:00:00.13 bitrate=6869.0kbits/s speed=0.0181x
frame= 5 fps=0.6 q=2.0 size= 154kB time=00:00:00.20 bitrate=6316.5kbits/s speed=0.0235x
frame= 6 fps=0.6 q=3.6 size= 171kB time=00:00:00.26 bitrate=5250.6kbits/s speed=0.0279x
frame= 7 fps=0.7 q=6.0 size= 179kB time=00:00:00.33 bitrate=4390.0kbits/s speed=0.031x
frame= 8 fps=0.7 q=8.7 size= 182kB time=00:00:00.40 bitrate=3737.3kbits/s speed=0.0333x
frame= 9 fps=0.7 q=11.5 size= 185kB time=00:00:00.46 bitrate=3248.6kbits/s speed=0.0367x
frame= 10 fps=0.7 q=14.4 size= 185kB time=00:00:00.60 bitrate=2526.7kbits/s speed=0.0447x
frame= 11 fps=0.8 q=15.1 size= 186kB time=00:00:00.73 bitrate=2081.6kbits/s speed=0.0513x
frame= 12 fps=0.8 q=14.2 size= 188kB time=00:00:00.80 bitrate=1921.3kbits/s speed=0.0534x
frame= 13 fps=0.8 q=13.2 size= 189kB time=00:00:00.86 bitrate=1785.7kbits/s speed=0.0554x
frame= 14 fps=0.9 q=9.7 size= 207kB time=00:00:00.93 bitrate=1816.1kbits/s speed=0.0572x
frame= 15 fps=0.9 q=12.9 size= 208kB time=00:00:01.00 bitrate=1705.5kbits/s speed=0.0587x
frame= 16 fps=0.9 q=13.5 size= 209kB time=00:00:01.06 bitrate=1608.8kbits/s speed=0.0601x
frame= 17 fps=0.9 q=13.8 size= 211kB time=00:00:01.13 bitrate=1523.4kbits/s speed=0.0615x
frame= 18 fps=0.9 q=13.3 size= 212kB time=00:00:01.20 bitrate=1447.6kbits/s speed=0.0628x
frame= 19 fps=1.0 q=13.2 size= 213kB time=00:00:01.26 bitrate=1379.7kbits/s speed=0.064x
frame= 20 fps=1.0 q=13.0 size= 215kB time=00:00:01.33 bitrate=1318.6kbits/s speed=0.0651x
frame= 21 fps=1.0 q=12.8 size= 216kB time=00:00:01.40 bitrate=1263.4kbits/s speed=0.0661x
frame= 22 fps=1.0 q=12.5 size= 217kB time=00:00:01.46 bitrate=1213.1kbits/s speed=0.0671x
frame= 23 fps=1.0 q=12.3 size= 218kB time=00:00:01.53 bitrate=1167.2kbits/s speed=0.068x
frame= 24 fps=1.0 q=12.8 size= 220kB time=00:00:01.66 bitrate=1080.2kbits/s speed=0.0718x
frame= 25 fps=1.0 q=12.6 size= 221kB time=00:00:01.73 bitrate=1044.7kbits/s speed=0.0725x
frame= 26 fps=1.1 q=9.9 size= 239kB time=00:00:01.80 bitrate=1087.9kbits/s speed=0.0732x
frame= 27 fps=1.1 q=13.0 size= 240kB time=00:00:01.86 bitrate=1054.7kbits/s speed=0.0738x
frame= 28 fps=1.1 q=14.1 size= 242kB time=00:00:01.93 bitrate=1023.8kbits/s speed=0.0744x
frame= 29 fps=1.1 q=13.9 size= 243kB time=00:00:02.00 bitrate= 994.9kbits/s speed=0.075x
frame= 30 fps=1.1 q=13.5 size= 244kB time=00:00:02.06 bitrate= 967.9kbits/s speed=0.0755x
frame= 31 fps=1.1 q=13.5 size= 245kB time=00:00:02.13 bitrate= 942.6kbits/s speed=0.0761x
frame= 32 fps=1.1 q=13.0 size= 247kB time=00:00:02.20 bitrate= 918.8kbits/s speed=0.0766x
frame= 33 fps=1.1 q=12.9 size= 248kB time=00:00:02.26 bitrate= 896.4kbits/s speed=0.0771x
frame= 34 fps=1.1 q=13.0 size= 249kB time=00:00:02.33 bitrate= 875.3kbits/s speed=0.0775x
frame= 35 fps=1.1 q=13.5 size= 251kB time=00:00:02.40 bitrate= 855.4kbits/s speed=0.078x
frame= 36 fps=1.1 q=14.0 size= 253kB time=00:00:04.26 bitrate= 486.1kbits/s speed=0.136x
frame= 37 fps=1.1 q=13.2 size= 254kB time=00:00:06.06 bitrate= 343.6kbits/s speed=0.188x
frame= 38 fps=1.2 q=10.0 size= 272kB time=00:00:08.00 bitrate= 279.0kbits/s speed=0.243x
frame= 39 fps=1.1 q=12.9 size= 275kB time=00:00:09.20 bitrate= 244.9kbits/s speed=0.27x
frame= 40 fps=1.1 q=14.1 size= 279kB time=00:00:10.20 bitrate= 224.0kbits/s speed=0.293x
frame= 41 fps=1.2 q=14.0 size= 281kB time=00:00:11.73 bitrate= 196.5kbits/s speed=0.329x
frame= 42 fps=1.2 q=13.4 size= 285kB time=00:00:12.66 bitrate= 184.5kbits/s speed=0.348x
frame= 43 fps=1.2 q=13.4 size= 288kB time=00:00:13.33 bitrate= 176.9kbits/s speed=0.359x
frame= 44 fps=1.2 q=14.9 size= 294kB time=00:00:14.26 bitrate= 169.0kbits/s speed=0.376x
frame= 45 fps=1.2 q=15.2 size= 299kB time=00:00:14.93 bitrate= 164.3kbits/s speed=0.385x
frame= 46 fps=1.2 q=16.8 size= 305kB time=00:00:15.60 bitrate= 159.9kbits/s speed=0.394x
frame= 47 fps=1.2 q=16.1 size= 307kB time=00:00:16.33 bitrate= 154.1kbits/s speed=0.404x
frame= 48 fps=1.2 q=14.3 size= 308kB time=00:00:16.93 bitrate= 149.2kbits/s speed=0.412x
frame= 49 fps=1.2 q=12.0 size= 311kB time=00:00:17.73 bitrate= 143.7kbits/s speed=0.424x
frame= 50 fps=1.2 q=7.8 size= 332kB time=00:00:18.40 bitrate= 147.6kbits/s speed=0.433x
frame= 51 fps=1.2 q=10.9 size= 334kB time=00:00:19.00 bitrate= 144.1kbits/s speed=0.439x
frame= 52 fps=1.2 q=10.3 size= 337kB time=00:00:19.86 bitrate= 138.8kbits/s speed=0.452x
frame= 53 fps=1.2 q=10.4 size= 342kB time=00:00:20.46 bitrate= 136.8kbits/s speed=0.458x
frame= 54 fps=1.2 q=11.1 size= 344kB time=00:00:21.13 bitrate= 133.5kbits/s speed=0.465x
frame= 55 fps=1.2 q=10.6 size= 346kB time=00:00:21.73 bitrate= 130.3kbits/s speed=0.471x
frame= 56 fps=1.2 q=9.7 size= 348kB time=00:00:22.46 bitrate= 127.0kbits/s speed=0.479x
frame= 57 fps=1.2 q=9.2 size= 352kB time=00:00:23.20 bitrate= 124.3kbits/s speed=0.488x
frame= 58 fps=1.2 q=9.3 size= 356kB time=00:00:23.80 bitrate= 122.5kbits/s speed=0.493x
frame= 59 fps=1.2 q=9.2 size= 360kB time=00:00:24.53 bitrate= 120.2kbits/s speed=0.501x
frame= 60 fps=1.2 q=9.1 size= 362kB time=00:00:25.20 bitrate= 117.8kbits/s speed=0.507x
frame= 61 fps=1.2 q=9.0 size= 365kB time=00:00:25.93 bitrate= 115.3kbits/s speed=0.515x
frame= 62 fps=1.2 q=7.1 size= 387kB time=00:00:26.60 bitrate= 119.1kbits/s speed=0.521x
frame= 63 fps=1.2 q=8.9 size= 391kB time=00:00:27.40 bitrate= 116.8kbits/s speed=0.529x
frame= 64 fps=1.2 q=8.9 size= 395kB time=00:00:28.00 bitrate= 115.4kbits/s speed=0.533x
frame= 65 fps=1.2 q=8.7 size= 397kB time=00:00:28.73 bitrate= 113.2kbits/s speed=0.54x
frame= 66 fps=1.2 q=8.4 size= 402kB time=00:00:29.40 bitrate= 112.1kbits/s speed=0.545x
frame= 67 fps=1.2 q=8.8 size= 405kB time=00:00:30.06 bitrate= 110.3kbits/s speed=0.55x
frame= 68 fps=1.2 q=8.6 size= 409kB time=00:00:30.66 bitrate= 109.2kbits/s speed=0.554x
frame= 69 fps=1.2 q=8.3 size= 413kB time=00:00:31.40 bitrate= 107.6kbits/s speed=0.56x
frame= 70 fps=1.2 q=8.4 size= 416kB time=00:00:32.06 bitrate= 106.4kbits/s speed=0.565x
frame= 71 fps=1.2 q=8.6 size= 420kB time=00:00:32.86 bitrate= 104.7kbits/s speed=0.572x
frame= 72 fps=1.2 q=8.3 size= 424kB time=00:00:33.66 bitrate= 103.2kbits/s speed=0.578x
frame= 73 fps=1.2 q=8.2 size= 429kB time=00:00:34.73 bitrate= 101.2kbits/s speed=0.59x
frame= 74 fps=1.2 q=6.6 size= 451kB time=00:00:35.53 bitrate= 104.0kbits/s speed=0.596x
frame= 75 fps=1.2 q=8.4 size= 456kB time=00:00:36.26 bitrate= 103.1kbits/s speed=0.601x
frame= 76 fps=1.2 q=8.7 size= 460kB time=00:00:36.93 bitrate= 102.0kbits/s speed=0.605x
frame= 77 fps=1.2 q=8.3 size= 464kB time=00:00:37.80 bitrate= 100.5kbits/s speed=0.612x
frame= 78 fps=1.2 q=8.2 size= 469kB time=00:00:38.53 bitrate= 99.7kbits/s speed=0.617x
frame= 79 fps=1.2 q=8.1 size= 473kB time=00:00:39.33 bitrate= 98.5kbits/s speed=0.622x
frame= 80 fps=1.3 q=8.0 size= 478kB time=00:00:40.26 bitrate= 97.3kbits/s speed=0.63x
frame= 81 fps=1.3 q=7.9 size= 482kB time=00:00:41.00 bitrate= 96.3kbits/s speed=0.634x
frame= 82 fps=1.3 q=7.7 size= 487kB time=00:00:41.73 bitrate= 95.6kbits/s speed=0.639x
frame= 83 fps=1.3 q=7.5 size= 491kB time=00:00:42.40 bitrate= 94.9kbits/s speed=0.642x
frame= 84 fps=1.3 q=7.4 size= 497kB time=00:00:43.26 bitrate= 94.2kbits/s speed=0.648x
frame= 85 fps=1.3 q=7.7 size= 502kB time=00:00:43.93 bitrate= 93.7kbits/s speed=0.651x
frame= 86 fps=1.3 q=6.4 size= 527kB time=00:00:44.53 bitrate= 96.9kbits/s speed=0.653x
frame= 87 fps=1.3 q=7.6 size= 531kB time=00:00:45.33 bitrate= 95.9kbits/s speed=0.657x
frame= 88 fps=1.3 q=7.6 size= 536kB time=00:00:46.20 bitrate= 95.0kbits/s speed=0.663x
frame= 89 fps=1.3 q=7.4 size= 542kB time=00:00:46.73 bitrate= 95.1kbits/s speed=0.664x
frame= 90 fps=1.3 q=7.6 size= 546kB time=00:00:47.46 bitrate= 94.3kbits/s speed=0.667x
frame= 91 fps=1.3 q=7.5 size= 553kB time=00:00:48.13 bitrate= 94.1kbits/s speed=0.67x
frame= 92 fps=1.3 q=7.6 size= 558kB time=00:00:48.93 bitrate= 93.4kbits/s speed=0.674x
frame= 93 fps=1.3 q=7.4 size= 563kB time=00:00:49.66 bitrate= 92.8kbits/s speed=0.677x
frame= 94 fps=1.3 q=7.5 size= 569kB time=00:00:50.26 bitrate= 92.8kbits/s speed=0.679x
frame= 95 fps=1.3 q=7.5 size= 574kB time=00:00:51.06 bitrate= 92.2kbits/s speed=0.682x
frame= 96 fps=1.3 q=7.3 size= 580kB time=00:00:51.66 bitrate= 91.9kbits/s speed=0.684x
frame= 97 fps=1.3 q=7.3 size= 586kB time=00:00:52.40 bitrate= 91.6kbits/s speed=0.685x
frame= 98 fps=1.3 q=5.8 size= 610kB time=00:00:53.20 bitrate= 94.0kbits/s speed=0.689x
frame= 99 fps=1.3 q=8.8 size= 623kB time=00:00:53.93 bitrate= 94.7kbits/s speed=0.692x
frame= 100 fps=1.3 q=9.1 size= 631kB time=00:00:54.60 bitrate= 94.7kbits/s speed=0.69x
frame= 101 fps=1.3 q=8.5 size= 639kB time=00:00:55.33 bitrate= 94.6kbits/s speed=0.692x
frame= 102 fps=1.3 q=8.5 size= 646kB time=00:00:56.00 bitrate= 94.6kbits/s speed=0.693x
frame= 103 fps=1.3 q=8.8 size= 654kB time=00:00:56.66 bitrate= 94.6kbits/s speed=0.694x
^C^Cav_interleaved_write_frame(): Immediate exit requested frame= 342 fps=1.2 q=6.3 size= 3656kB time=00:04:10.80 bitrate= 119.4kbits/s speed=0.895x
Error writing trailer of udp://192.168.1.4:5000?pkt_size=1316: Immediate exit requested frame= 342 fps=1.2 q=6.3 Lsize= 3656kB time=00:04:10.80 bitrate= 119.4kbits/s speed=0.89x
video:3366kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.634165% Exiting normally, received signal 2. root@SLSVETAIE:/tmp# root@SLSVETAIE:/tmp#


Logs at Resolution 1280*720

root@SLSVETAIE:/# ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -i /de v/video0 -c:v copy output.mkv ffmpeg version 3.4.7 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7.5.0 (OpenWrt GCC 7.5.0 r11306-c4a6851c72) configuration: --enable-cross-compile --cross-prefix=mips-openwrt-linux-musl- --arch=mips --cpu=24kc --target-os=linux --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --disable-altivec --disable-vsx --disable-power8 --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-inline-asm --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi --disable-fast-unaligned --disable-runtime-cpudetect --disable-asm --disable-inline-asm --disable-x86asm --enable-avresample --disable-decoder=atrac3 --disable-decoder=h264 --disable-decoder=hevc --disable-decoder=vc1 --disable-muxer=h264 --disable-muxer=hevc --disable-muxer=vc1 --disable-demuxer=h264 --disable-demuxer=hevc --disable-demuxer=vc1 --disable-parser=h264 --disable-parser=hevc --disable-parser=vc1 --enable-small --enable-libshine libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 [ 81.711755] ffmpeg invoked oom-killer: gfp_mask=0x14082c2(GFP_KERNEL|GFP_HIGHMEM|__GFP_NOWARN|GFP_ZERO), nodemask=(null), order=0, oom_score_adj=0 [ 81.723960] CPU: 0 PID: 1169 Comm: ffmpeg Not tainted 4.14.221 #0 [ 81.729982] Stack : 804c0000 8046e9dc 00000000 00000000 8044b090 82f879cc 83902fdc 804952a7 [ 81.738306] 80447120 00000491 80503810 00200000 ffffffff 00000001 82f87980 1877435e [ 81.746635] 00000000 00000000 80500000 00003448 00000000 00000000 00000007 00000000 [ 81.754969] 000000b9 cca00000 000000b8 00000000 80000000 83902d00 82f87b68 8044f2ac [ 81.763287] 0000001e 00200000 ffffffff 000001c8 00000000 00000000 00000000 80500000 [ 81.771634] ... [ 81.774052] Call Trace: [ 81.776522] [<8006c75c>] show_stack+0x58/0x100 [ 81.780967] [<800f9c2c>] dump_header.isra.28+0x8c/0x1e0 [ 81.786155] [<800f8f04>] oom_kill_process+0xd0/0x460 [ 81.791277] [<800f9acc>] out_of_memory+0x3b0/0x420 [ 81.795915] [<800fe1fc>] alloc_pages_nodemask+0x888/0xc80 [ 81.801422] [<8012e968>] vmalloc_node_range+0x178/0x2a4 [ 81.806813] [<8012ebbc>] vmalloc_user+0x4c/0x7c [ 81.811323] [<8325d5f0>] 0x8325d5f0 [ 81.814806] Mem-Info: [ 81.817053] active_anon:643 inactive_anon:4 isolated_anon:0 [ 81.817053] active_file:2 inactive_file:3 isolated_file:0 [ 81.817053] unevictable:0 dirty:0 writeback:0 unstable:0 [ 81.817053] slab_reclaimable:150 slab_unreclaimable:1029 [ 81.817053] mapped:2 shmem:12 pagetables:48 bounce:0 [ 81.817053] free:2047 free_pcp:9 free_cma:0 [ 81.848144] Node 0 active_anon:2572kB inactive_anon:16kB active_file:8kB inactive_file:12kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:8kB dirty:0kB writeback:0kB shmem:48kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes [ 81.869884] Normal free:8188kB min:8192kB low:10240kB high:12288kB active_anon:2572kB inactive_anon:16kB active_file:8kB inactive_file:12kB unevictable:0kB writepending:0kB present:65536kB managed:59860kB mlocked:0kB kernel_stack:320kB pagetables:192kB bounce:0kB free_pcp:36kB local_pcp:36kB free_cma:0kB [ 81.896838] lowmem_reserve[]: 0 0 [ 81.900008] Normal: 1154kB (UM) 948kB (UM) 5816kB (UM) 3332kB (UM) 3264kB (UM) 9128kB (UM) 5256kB (UM) 1512kB (U) 01024kB 02048kB 04096kB = 8188kB [ 81.914108] 17 total pagecache pages [ 81.917639] 0 pages in swap cache [ 81.920930] Swap cache stats: add 0, delete 0, find 0/0 [ 81.926152] Free swap = 0kB [ 81.929000] Total swap = 0kB [ 81.931865] 16384 pages RAM [ 81.934660] 0 pages HighMem/MovableOnly [ 81.938461] 1419 pages reserved [ 81.941589] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name [ 81.950141] [ 501] 0 501 301 15 3 0 0 0 ubusd [ 81.958718] [ 503] 0 503 312 11 5 0 0 0 ash [ 81.967141] [ 918] 0 918 436 40 4 0 0 0 netifd [ 81.975819] [ 1025] 0 1025 503 33 4 0 0 0 wpa_supplicant [ 81.985192] [ 1039] 0 1039 312 12 5 0 0 0 sh [ 81.993510] [ 1070] 0 1070 311 12 3 0 0 0 ntpd [ 82.002175] [ 1080] 0 1080 311 11 4 0 0 0 syslogd [ 82.010830] [ 1085] 0 1085 310 10 4 0 0 0 sleep [ 82.019395] [ 1091] 0 1091 310 10 4 0 0 0 udhcpc [ 82.028074] [ 1169] 0 1169 5103 462 8 0 0 0 ffmpeg [ 82.036747] Out of memory: Kill process 1169 (ffmpeg) score 30 or sacrifice child [ 82.044213] Killed process 1169 (ffmpeg) total-vm:20412kB, anon-rss:1844kB, file-rss:4kB, shmem-rss:0kB [ 82.062113] oom_reaper: reaped process 1169 (ffmpeg), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 82.247351] ffmpeg invoked oom-killer: gfp_mask=0x14082c2(GFP_KERNEL|GFP_HIGHMEM|__GFP_NOWARN|GFP_ZERO), nodemask=(null), order=0, oom_score_adj=0 [ 82.259549] CPU: 0 PID: 1169 Comm: ffmpeg Not tainted 4.14.221 #0 [ 82.265573] Stack : 804c0000 8046e9dc 00000000 00000000 8044b090 82f879cc 83902fdc 804952a7 [ 82.273888] 80447120 00000491 80503810 00200000 ffffffff 00000001 82f87980 1877435e [ 82.282238] 00000000 00000000 80500000 00004440 00000000 00000000 00000007 00000000 [ 82.290569] 000000e6 43800000 000000e5 00000000 80000000 83a37840 82f87b68 8044f2ac [ 82.298915] 00000002 00200000 ffffffff 0000000e 00000000 00000000 00000000 80500000 [ 82.307250] ... [ 82.309653] Call Trace: [ 82.312244] [<8006c75c>] show_stack+0x58/0x100 [ 82.316592] [<800f9c2c>] dump_header.isra.28+0x8c/0x1e0 [ 82.321730] [<800f8f04>] oom_kill_process+0xd0/0x460 [ 82.326700] [<800f9acc>] out_of_memory+0x3b0/0x420 [ 82.331465] [<800fe1fc>] alloc_pages_nodemask+0x888/0xc80 [ 82.337049] [<8012e968>] vmalloc_node_range+0x178/0x2a4 [ 82.342391] [<8012ebbc>] vmalloc_user+0x4c/0x7c [ 82.346961] [<8325d5f0>] 0x8325d5f0 [ 82.350371] Mem-Info: [ 82.352652] active_anon:182 inactive_anon:4 isolated_anon:0 [ 82.352652] active_file:3 inactive_file:2 isolated_file:0 [ 82.352652] unevictable:0 dirty:0 writeback:0 unstable:0 [ 82.352652] slab_reclaimable:147 slab_unreclaimable:1030 [ 82.352652] mapped:2 shmem:12 pagetables:48 bounce:0 [ 82.352652] free:1022 free_pcp:16 free_cma:0 [ 82.383838] Node 0 active_anon:728kB inactive_anon:16kB active_file:12kB inactive_file:8kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:8kB dirty:0kB writeback:0kB shmem:48kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes [ 82.405452] Normal free:4088kB min:8192kB low:10240kB high:12288kB active_anon:728kB inactive_anon:16kB active_file:12kB inactive_file:8kB unevictable:0kB writepending:0kB present:65536kB managed:59860kB mlocked:0kB kernel_stack:320kB pagetables:192kB bounce:0kB free_pcp:64kB local_pcp:64kB free_cma:0kB [ 82.432410] lowmem_reserve[]: 0 0 [ 82.435566] Normal: 404kB (UM) 398kB (M) 2016kB (M) 732kB (UM) 664kB (M) 1128kB (M) 2256kB (M) 2512kB (UM) 11024kB (M) 02048kB 04096kB = 4088kB [ 82.449342] 17 total pagecache pages [ 82.452885] 0 pages in swap cache [ 82.456201] Swap cache stats: add 0, delete 0, find 0/0 [ 82.461390] Free swap = 0kB [ 82.464254] Total swap = 0kB [ 82.467136] 16384 pages RAM [ 82.469898] 0 pages HighMem/MovableOnly [ 82.473716] 1419 pages reserved [ 82.476859] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name [ 82.485400] [ 501] 0 501 301 15 3 0 0 0 ubusd [ 82.493956] [ 503] 0 503 312 11 5 0 0 0 ash [ 82.502397] [ 918] 0 918 436 40 4 0 0 0 netifd [ 82.511074] [ 1025] 0 1025 503 33 4 0 0 0 wpa_supplicant [ 82.520619] [ 1039] 0 1039 312 12 5 0 0 0 sh [ 82.528921] [ 1070] 0 1070 311 12 3 0 0 0 ntpd [ 82.537328] [ 1080] 0 1080 311 11 4 0 0 0 syslogd [ 82.546057] [ 1085] 0 1085 310 10 4 0 0 0 sleep [ 82.554651] [ 1091] 0 1091 310 10 4 0 0 0 udhcpc [ 82.563313] [ 1169] 0 1169 5103 0 8 0 0 0 ffmpeg [ 82.572004] Out of memory: Kill process 918 (netifd) score 2 or sacrifice child [ 82.579354] Killed process 1091 (udhcpc) total-vm:1240kB, anon-rss:36kB, file-rss:4kB, shmem-rss:0kB [ 82.589289] ffmpeg: vmalloc: allocation failure, allocated 1351680 of 1847296 bytes, mode:0x14080c0(GFP_KERNEL|GFP_ZERO), nodemask=(null) [ 82.600962] CPU: 0 PID: 1169 Comm: ffmpeg Not tainted 4.14.221 #0 [ 82.606986] Stack : 804c0000 8046e9dc 00000000 00000000 8044b090 82f87b2c 83902fdc 804952a7 [ 82.615313] 80447120 00000491 80503810 00400000 014080c0 00000001 82f87ae0 1877435e [ 82.623627] 00000000 00000000 80500000 000053a8 00000000 00000000 00000007 00000000 [ 82.632104] 00000112 a6e00000 00000111 00000000 80000000 00000000 83b0b180 ffffffff [ 82.640342] 014082c2 00400000 014080c0 ffffffff 00000000 00000000 00000000 80500000 [ 82.648645] ... [ 82.651061] Call Trace: [ 82.653513] [<8006c75c>] show_stack+0x58/0x100 [ 82.657978] [<800fd8e4>] warn_alloc+0xc4/0x154 [ 82.662373] [<8012ea14>] __vmalloc_node_range+0x224/0x2a4 [ 82.667762] [<8012ebbc>] vmalloc_user+0x4c/0x7c [ 82.672272] [<8325d5f0>] 0x8325d5f0 [ 82.675743] Mem-Info: [ 82.678031] active_anon:182 inactive_anon:4 isolated_anon:0 [ 82.678031] active_file:3 inactive_file:2 isolated_file:0 [ 82.678031] unevictable:0 dirty:0 writeback:0 unstable:0 [ 82.678031] slab_reclaimable:147 slab_unreclaimable:1030 [ 82.678031] mapped:2 shmem:12 pagetables:48 bounce:0 [ 82.678031] free:1030 free_pcp:16 free_cma:0 [ 82.709212] Node 0 active_anon:728kB inactive_anon:16kB active_file:12kB inactive_file:8kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:8kB dirty:0kB writeback:0kB shmem:48kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes [ 82.730982] Normal free:4120kB min:8192kB low:10240kB high:12288kB active_anon:728kB inactive_anon:16kB active_file:12kB inactive_file:8kB unevictable:0kB writepending:0kB present:65536kB managed:59860kB mlocked:0kB kernel_stack:320kB pagetables:192kB bounce:0kB free_pcp:64kB local_pcp:64kB free_cma:0kB [ 82.757625] lowmem_reserve[]: 0 0 [ 82.760871] Normal: 404kB (UM) 398kB (M) 2016kB (M) 832kB (UM) 664kB (M) 1128kB (M) 2256kB (M) 2512kB (UM) 11024kB (M) 02048kB 0*4096kB = 4120kB [ 82.774691] 17 total pagecache pages [ 82.778233] 0 pages in swap cache [ 82.781533] Swap cache stats: add 0, delete 0, find 0/0 [ 82.786752] Free swap = 0kB [ 82.789602] Total swap = 0kB [ 82.792469] 16384 pages RAM [ 82.795261] 0 pages HighMem/MovableOnly [ 82.799065] 1419 pages reserved [ 82.803356] netifd invoked oom-killer: gfp_mask=0x14201ca(GFP_HIGHUSER_MOVABLE|GFP_COLD), nodemask=(null), order=0, oom_score_adj=0 [ 82.814695] CPU: 0 PID: 918 Comm: netifd Not tainted 4.14.221 #0 [ 82.820486] Stack : 804c0000 8046e9dc 00000000 00000000 8044b090 82f29b84 83a37b1c 804952a7 [ 82.828638] 80447120 00000396 80503810 00200000 ffffffff 00000001 82f29b38 3bc48eee [ 82.837039] 00000000 00000000 80500000 00005d28 00000000 00000000 00000007 00000000 [ 82.845276] 0000012e 4ae00000 0000012d 00000000 80000000 83a37840 82f29d20 8044f2ac [ 82.853577] 00000002 00200000 ffffffff 0000000e 00000003 00000000 00000000 80500000 [ 82.861940] ... [ 82.864360] Call Trace: [ 82.866797] [<8006c75c>] show_stack+0x58/0x100 [ 82.871229] [<800f9c2c>] dump_header.isra.28+0x8c/0x1e0 [ 82.876441] [<800f8f04>] oom_kill_process+0xd0/0x460 [ 82.881367] [<800f9acc>] out_of_memory+0x3b0/0x420 [ 82.886174] [<800fe1fc>] alloc_pages_nodemask+0x888/0xc80 [ 82.891696] [<800f67dc>] filemap_fault+0x3ec/0x6c0 [ 82.896510] [<8011d5b0>] __do_fault+0x110/0x18c [ 82.900991] [<80121a2c>] handle_mm_fault+0x6f0/0xa98 [ 82.905975] [<80073a00>] do_page_fault+0x120/0x468 [ 82.910885] [<8007937c>] tlb_do_page_fault_0+0x10c/0x114 [ 82.916195] Mem-Info: [ 82.918456] active_anon:173 inactive_anon:4 isolated_anon:0 [ 82.918456] active_file:2 inactive_file:3 isolated_file:0 [ 82.918456] unevictable:0 dirty:0 writeback:0 unstable:0 [ 82.918456] slab_reclaimable:147 slab_unreclaimable:1030 [ 82.918456] mapped:2 shmem:12 pagetables:48 bounce:0 [ 82.918456] free:1369 free_pcp:16 free_cma:0 [ 82.949735] Node 0 active_anon:692kB inactive_anon:16kB active_file:8kB inactive_file:12kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:8kB dirty:0kB writeback:0kB shmem:48kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes [ 82.971282] Normal free:5444kB min:8192kB low:10240kB high:12288kB active_anon:692kB inactive_anon:16kB active_file:8kB inactive_file:12kB unevictable:0kB writepending:0kB present:65536kB managed:59860kB mlocked:0kB kernel_stack:320kB pagetables:192kB bounce:0kB free_pcp:64kB local_pcp:64kB free_cma:0kB [ 82.998038] lowmem_reserve[]: 0 0 [ 83.001322] Normal: 914kB (UM) 498kB (UM) 2316kB (UM) 932kB (UM) 1564kB (UM) 4128kB (UM) 2256kB (M) 2512kB (UM) 11024kB (M) 02048kB 0*4096kB = 5444kB [ 83.015576] 17 total pagecache pages [ 83.019119] 0 pages in swap cache [ 83.022419] Swap cache stats: add 0, delete 0, find 0/0 [ 83.027654] Free swap = 0kB [ 83.030488] Total swap = 0kB [ 83.033355] 16384 pages RAM [ 83.036149] 0 pages HighMem/MovableOnly [ 83.039951] 1419 pages reserved [ 83.043214] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name [ 83.051657] [ 501] 0 501 301 15 3 0 0 0 ubusd [ 83.060206] [ 503] 0 503 312 11 5 0 0 0 ash [ 83.068630] [ 918] 0 918 436 40 4 0 0 0 netifd [ 83.077319] [ 1025] 0 1025 503 33 4 0 0 0 wpa_supplicant [ 83.086682] [ 1039] 0 1039 312 12 5 0 0 0 sh [ 83.095015] [ 1070] 0 1070 311 12 3 0 0 0 ntpd [ 83.103508] [ 1080] 0 1080 311 11 4 0 0 0 syslogd [ 83.112290] [ 1085] 0 1085 310 10 4 0 0 0 sleep [ 83.120886] [ 1169] 0 1169 5103 0 8 0 0 0 ffmpeg [ 83.129557] Out of memory: Kill process 918 (netifd) score 2 or sacrifice child [ 83.136866] Killed process 918 (netifd) total-vm:1744kB, anon-rss:156kB, file-rss:4kB, shmem-rss:0kB [ 83.150874] oom_reaper: reaped process 918 (netifd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB Killed root@SLSVETAIE:/# [ 87.883582] random: crng init done [ 90.951702] wlan0: deauthenticating from ec:bd:1d:c3:90:b0 by local choice (Reason: 3=DEAUTH_LEAVING) [ 100.561747] wlan0: authenticate with ec:bd:1d:c3:90:b0 [ 100.577376] wlan0: send auth to ec:bd:1d:c3:90:b0 (try 1/3) [ 100.583537] wlan0: authenticated [ 100.591705] wlan0: associate with ec:bd:1d:c3:90:b0 (try 1/3) [ 100.598937] wlan0: RX AssocResp from ec:bd:1d:c3:90:b0 (capab=0x431 status=0 aid=108) [ 100.605775] wlan0: associated

root@SLSVETAIE:/# root@SLSVETAIE:/#  root@SLSVETAIE:/#  root@SLSVETAIE:/#


So what can we do to get more number of frames at resolution 1280*720 with mjpg-streamer in AR9331 module.

Thanks & Regards

jacksonliam commented 3 years ago

If ffmpeg captures frames at 640x480 at the same rate as mjpg-streamer then you know the user space software is not the issue. This is not an mjpg-streamer issue. It is likely an issue with your hardware/drivers/OS.

dhawal2611 commented 2 years ago

Ok, I am looking into it and If I get something I will get back to you Thanks for the support