VIM3 1080p Video Encode from USB (UVC) Camera

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