VIM3 1080p Video Encode from USB (UVC) Camera

Hello,

I try find a way to can record a video (for surth time: 30sec …1min) with 1920x1080 and 20…25fps. But unfortunly not find nothing to worck on this VIM3 board.

I see Gstreames is avaible for “VIM3_Ubuntu-xfce-bionic_Linux-4.9_arm64_EMMC_V20191231.iso” , i try to use but wichout succes.

I read in some topics on forum some like GPU or VPU video encoding is not avaible yet. In this last image “V20191231” is avaible?

I have any chances to use this board for my project?
Until now i use NanoPI boards but only for 1280x720 rezolution and around 18fps. I tinck VIM3 board have more powerfoull resurces for can use 1080p at 20…25fps.

I have and Edge V, i macke some test but board is realy to hot to use for my aplication. So last chances is VIM3 :slight_smile:

Last question: IMX 214 Camera is avaible only for Edge. When is avaible MIPI camera and for VIM3? Or maybe similar small CMOS camera?

GPU only support fbdev mode.
VPU is support for Kodi.

Yes, IMX214 is for Edge. There is already a camera for VIM3. Will release in the future,

some UVC camera can stream MJPEG or h264 u can write it ! this solution have ZERO cpu usage !!!

if u use yuv422p or yuv420p or rgb u still store it without reencode but its will be very big size

EXAMPLE

ffmpeg -i /dev/video0 -vcodec copy /tmp/1.mkv - just grub video stream as is without reencode - it every time very close to ZERO cpu usage

if u OS have video hwencode support its same easy

OK! i will check bionic_Linux-4.9 later !

First of all i want to thancks for your quiqly answers :slight_smile:

I read all post from Forum about VIM3. Khadas tell about relase a camera for VIM3 from more 6 month back. My application need around 70…100 boards each month, so i’m force to find another board if not find a quiqly solution. Now i use NanoPI but i want to macke nest step to use 1920x1080, so need new board.

Is very sad to see this board have so powerfull hardware: 4x2.2 and 2x1.8 Very important 12nm tehnology: low power consumption and lower heat. But unfortunly not have yet cmos camera and hardware video encoding is unavaible :frowning:

ffmpeg worck for VIM3? i try install (sudo apt-get install ffmpeg) but i have some error. I read on forum for VIM3 can worck Gstreamer. i try many combination with gstreamer what i found on forums but not worcks.

this is my camera:
9.Sensor Type: OV5640 (1/4” )
10.Active Array Size: 2592*1944
11.Pixel Size: 1.4µm x1.4µm
12.Maximum Image Transfer Rate :15 fps for QSXGA;
13.Lens Construction :4P+IR
14.F/No: 2.8
15.EFL: 3.2 mm
16.BFL(Optical) :2.7mm
17.FOV: 60°-65°
18.TV Distortion :<0.24%
19.IR Filter :650 ± 10nm
20.Output Format:USB suspend out

i have check ubuntu on my VIM3

  1. apt-get remove libplayer-aml
  2. apt-get install ffmpeg

NOW! we can check usb uvc camera capture speed

i have FULLHD 1920x1080 60/30 fps usb3 camera

ffmpeg -hide_banner -f v4l2 -pix_fmt mjpeg -r 30 -i /dev/video0 -an -vcodec copy -y -f avi /dev/null
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 2173.905544, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Output #0, avi, to '/dev/null':
  Metadata:
    ISFT            : Lavf57.83.100
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  632 fps= 30 q=-1.0 Lsize=  102577kB time=00:00:21.06 bitrate=39888.0kbits/s speed=   1x    

60 FPS to mp4

ffmpeg -hide_banner -f v4l2  -r 60 -i /dev/video0 -an -vcodec copy -y -f mp4 /dev/null
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 2538.534157, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 60 fps, 60 tbr, 1000k tbn, 1000k tbc
Output #0, mp4, to '/dev/null':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: mjpeg (mp4v / 0x7634706D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 60 fps, 60 tbr, 15360 tbn, 60 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  800 fps= 60 q=-1.0 Lsize=  130248kB time=00:00:13.31 bitrate=80128.1kbits/s speed=0.998x

u can see i dont have any speed problem for capture

root@Khadas:~# cat /etc/lsb-release && uname -a
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
Linux Khadas 4.9.206 #13 SMP PREEMPT Tue Dec 31 00:37:47 CST 2019 aarch64 aarch64 aarch64 GNU/Linux

PS: but if u need reencode on a fly u still need use hw accelerate encoders

PSS: plz clarify you problem may be i can recommend other distos for our task (for example for headless usage openwrt its my chouse - maybe debian - armbian … )

PSSS: we can encode mpeg4 via simple sofware encoders, but fullhd h264 - only by hardware :wink:

2 Likes

Hello and thancks for your answer :slight_smile:

root@Khadas:~# cat /etc/lsb-release && uname -a
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION=“Ubuntu 18.04.3 LTS”
Linux Khadas 4.9.206 #13 SMP PREEMPT Tue Dec 31 00:37:47 CST 2019 aarch64 aarch6 4 aarch64 GNU/Linux

I try this:
ffmpeg -hide_banner -f v4l2 -pix_fmt mjpeg -r 30 -i /dev/video0 -an -vcodec copy -y -f avi /dev/null

and result this eror:
[video4linux2,v4l2 @ 0x558b3f06c0] The driver changed the time per frame from 1/30 to 1/20
[video4linux2,v4l2 @ 0x558b3f06c0] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown), 3264x2448): unspecified pixel format
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options
Input #0, video4linux2,v4l2, from ‘/dev/video0’:
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 3264x2448, 20 fps, 20 tbr, 1000k tbn, 1000k tbc
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
Exiting normally, received signal 2.

i try and this:
ffmpeg -t 30 -vn -vcodec rawvideo -pix_fmt rgb32 -s 800x600 -r 30 -f v4l2 -i /dev/video0 -b:v 8M -maxrate 12M -bufsize 5M -preset ultrafast -f mp4 /uploads/tst1.mp4 -y

i set 30 sec recording but real time is more. When i play video file stored with this line code video have 30 seconds but image is like in time laps video (quiqly played - or fast forword playng).

This i have in code:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright © 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu/Linaro 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable- gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enabl e-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enabl e-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enabl e-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml 2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --e nable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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
libpostproc 54. 7.100 / 54. 7.100
[video4linux2,v4l2 @ 0x5585b546d0] The driver changed the time per frame from 1/30 to 1/20
Input #0, video4linux2,v4l2, from ‘/dev/video0’:
Duration: N/A, start: 318.098342, bitrate: 153600 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 800x600, 153600 kb/s, 20 fps, 20 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x5585b58130] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x5585b58130] profile High 4:2:2, level 3.1, 4:2:2 8-bit
[libx264 @ 0x5585b58130] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0 :0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads =9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_ref resh=0 rc_lookahead=0 rc=abr mbtree=0 bitrate=8000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12000 vbv_bufsize=5000 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, mp4, to ‘/uploads/tst1.mp4’:
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv422p, 800x600, q=-1–1, 8000 kb/s, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 12000000/0/8000000 buffer size: 5000000 vbv_delay: -1
Past duration 0.999992 too large
Last message repeated 9 times
Past duration 0.999992 too large 0kB time=00:00:00.03 bitrate= 11.5kbits/s dup=1 drop=0 speed=0.0664x
Last message repeated 9 times
Past duration 0.999992 too large 256kB time=00:00:00.36 bitrate=5719.5kbits/s dup=1 drop=0 speed=0.364x
Last message repeated 9 times
Past duration 0.999992 too large 768kB time=00:00:00.70 bitrate=8987.5kbits/s dup=1 drop=0 speed=0.464x
Last message repeated 9 times
Past duration 0.999992 too large 1024kB time=00:00:01.03 bitrate=8117.9kbits/s dup=1 drop=0 speed=0.513x
Last message repeated 9 times

hey its totaly wrong params :wink: -vn - disable video

try minimal command without input format rate size

ffmpeg -f v4l2 -i /dev/video0 -b:v 8M -preset ultrafast -f mp4 /uploads/$(date +%s).mp4

or v4l2-ctl --all

PS:: looks like you camera not have mjpeg format

PSS: check formats for camera

ffplay -f video4linux2 -list_formats all /dev/video0 2>&1 | grep v4l2
[video4linux2,v4l2 @ 0x7f7a64000b80] Compressed:       mjpeg :          Motion-JPEG : 1280x720 640x480 640x360
[video4linux2,v4l2 @ 0x7f7a64000b80] Raw       :     yuyv422 :           YUYV 4:2:2 : 1280x720 640x480 640x360

frame= 14 fps=1.3 q=0.0 size= 7424kB time=00:00:03.00 bitrate=20272.2kbits
frame= 15 fps=1.3 q=4.0 size= 7680kB time=00:00:04.00 bitrate=15728.5kbits
frame= 15 fps=1.3 q=4.0 size= 7680kB time=00:00:04.00 bitrate=15728.5kbits
frame= 15 fps=1.2 q=-1.0 Lsize= 36588kB time=00:00:14.00 bitrate=21409.1kbit

i have 1…2 fps. I don’t know what is wrong…
-vn i tinck is disable audio