Last active
April 6, 2022 19:36
-
-
Save borisisok/1083bc3a30dca023e13f6a224a60f00a to your computer and use it in GitHub Desktop.
Mirabox - Record via ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The Linux version | |
VDEV=$(v4l2-ctl --list-devices | grep -A1 -i mirabo | grep /dev | sed 's/\s//g') | |
ADEV=$(grep "Capture.*Mira" /proc/asound/cards | cut -f2 -d" ") | |
TS=$(date +%Y%m%d_%H%M%S) | |
nohup ffmpeg -f alsa -ac 2 -i hw:${ADEV=},0 -f video4linux2 -i ${VDEV} -acodec ac3 -ab 128k -f matroska -movflags frag_keyframe -s 1920x1080 -vcodec libx264 -preset ultrafast -qp 16 ${TS}.mkv & | |
sleep 5; | |
vlc ${TS}.mkv | |
killall ffmpeg | |
echo ${TS}.mkv |
pi@raspicam2:~ $ v4l2-ctl -D -d /dev/video0
Driver Info:
Driver name : sonixj
Card type : USB camera
Bus info : usb-20980000.usb-1.4
Driver version : 5.10.17
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find and select rec format via v4l2-ctl
root@mediapi:~# v4l2-ctl --list-formats-ext -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
root@mediapi:~# v4l2-ctl -d /dev/video0 --set-parm=15
Frame rate set to 15.000 fps
v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=JPEG --stream-mmap --stream-count=100 --stream-to=[email protected]