Kajan001
-
Content Count
14 -
Joined
-
Last visited
Posts posted by Kajan001
-
-
Thanks Tooz! This is what I needed. Cheers!
-
Has anyone figured out how to include hardware encoding in video recording? Especially in Gstreamer.
I have researched for weeks and found very little useful information. It seems tinker board and other rock chip based boards just do not have the support for it, but many of the posts are old.
Anything?
-
The problem is that like most other MD solutions it compares frames. That's a pretty CPU heavy operation. With picamera and mmal you could extract motion vectors directly (somehow) and use those = less CPU intensive.
See pikrellcam
Alas, this is not possible with v4l2.
-
Thanks, i have looked into that and gstreamer appears to have it's own motion detection addon. I will explore it further once i have figured out hw encoding so I can get decent framerate and resolution. Damn it, my old Pi gets 720p and 20 fps without laggy vids and dropped frames!
Gstreamer motion detection -
Thanks! After much research I have found that mmal is pretty much specific for raspberry pi and pi camera. Ffmpeg does not currently work with most rock boards, at least not with video encoding.
So Gstreamer it is. If anyone know how to extract motion vectors with gstream or other compatible program, please point me in the right direction.
I want to do motion detection, and not the CPU heavy way of comparing jpegs.
-
In short: ffmpeg can be used to capture audio but not video because the current libraries are not compatible with the setup.
-
Thanks! I'll do that!
-
Is am trying to get program working on tinker board r2 or s2 with recommended OS.
But I am having issues because I am used to raspberry pi and piOS
Is there any of the shared libraries that correspond to the following piOS libraries:
libbcm_host.so => not found
libvcos.so => not found
libmmal.so => not found
libmmal_core.so => not found
libmmal_util.so => not found
libmmal_vc_client.so => not found
these are libraries referring to the use of the pi camera.
-
Here is my version of python-gstreamer dvr. You need to install the python-gst bidnings though:
pythong dvr -records 60s video - I have to fix the pipeline though because the clips are really big. 2+ gigs per minute
Quoteimport gi
import sys
from time import sleep
from datetime import datetimegi.require_version('Gst', '1.0') #this may have to be adapted depending on your gst version.
from gi.repository import Gst, GObjectGst.init(sys.argv)
#this is just to get the date and time into the output filename
now = datetime.now()
date_time = now.strftime("%m-%d-%Y_%H-%M-%S")# the same pipeling you would use in gst-launch, starting from v4l2.... Note the ' #encompassing the whole pipeline, except the +str(date-time)+ which is excluded. Use #the plus to make python add a string with the date.
pipeline=Gst.parse_launch ('v4l2src ! video/x-raw,width=1280,height=720,framerate=12/1 ! queue ! mux. alsasrc ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=rec_'+str(date_time)+'.mp4 sync=false')
def main():
bus = pipeline.get_bus()
pipeline.set_state(Gst.State.PLAYING)
print('Recording Dashcam')
sleep(60)
print('Sending EOS')
pipeline.send_event(Gst.Event.new_eos())
print('Waiting for EOS')
bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)
pipeline.set_state(Gst.State.NULL)main()
-
I have a tinkerboars r2 (and a TB 2s) with recommended OS. I have attached a picamerav2 (8MP imx219) and it works with gstreamer but I have yet to learn that.
I cannot get ffmpeg working, I just get the message:
[video4linux2,v4l2 @ 0x810f7610] Not a video capture device.
/dev/video1: No such device
Using: ls /dev/video*
I get: /dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/video4 so clearly the camera is recognised by the system
Has anyone got ffmpeg working on TB os?
Additonal info below.
Using : v4l2-ctl --all
Driver Info:
Driver name : rkisp1_v0
Card type : rkisp1_mainpath
Bus info : platform:ff910000.rkisp1
Driver version : 4.4.194
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 : rkisp1
Model : rkisp1
Serial :
Bus info :
Media version : 0.1.0
Hardware revision: 0x00000000 (0)
Driver version : 0.0.0
Entity Info:
ID : 2
Name : rkisp1_mainpath
Type : V4L2 I/O
Pad : 0: Sink
Priority: 2
Format Video Capture Multiplanar:
Width/Height : 1280/720
Pixel Format : 'RGB3' (24-bit RGB 8-8-8)
Field : None
Number of planes : 1
Flags :
Colorspace : sRGB
Transfer Function : sRGB
YCbCr/HSV Encoding: Default
Quantization : Full Range
Plane 0 :
Bytes per Line : 3840
Size Image : 2764800
Crop: Left 0, Top 0, Width 1920, Height 1080
Selection: crop, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection: crop, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:User Controls
exposure 0x00980911 (int) : min=0 max=4095 step=1 default=1575 value=1457
gain 0x00980913 (int) : min=256 max=43663 step=1 default=256 value=256
horizontal_flip 0x00980914 (bool) : default=0 value=0
vertical_flip 0x00980915 (bool) : default=0 value=0Image Source Controls
vertical_blanking 0x009e0901 (int) : min=686 max=686 step=1 default=686 value=686
horizontal_blanking 0x009e0902 (int) : min=1524 max=1524 step=1 default=1524 value=1524
analogue_gain 0x009e0903 (int) : min=256 max=2816 step=1 default=512 value=932Image Processing Controls
link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0
pixel_rate 0x009f0902 (int64) : min=0 max=182463120 step=1 default=182463120 value=182463120 flags=read-only
test_pattern 0x009f0903 (menu) : min=0 max=13 default=0 value=0
Using:
gst-device-monitor-1.0 Video
Probing devices...
Device found:name : rkisp1_mainpath
class : Video/Source
caps : video/x-raw, format=(string)YUY2, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)Y42B, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)I420, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)RGB, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV12, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV21, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV12, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV21, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV61, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV16, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-bayer, format=(string)bggr, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-bayer, format=(string)gbrg, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-bayer, format=(string)grbg, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-bayer, format=(string)rggb, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
properties:
udev-probed = true
device.bus_path = platform-ff910000.rkisp1
sysfs.path = /sys/devices/platform/ff910000.rkisp1/video4linux/video0
device.subsystem = video4linux
device.product.name = rkisp1_mainpath
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = rkisp1_v0
v4l2.device.card = rkisp1_mainpath
v4l2.device.bus_info = platform:ff910000.rkisp1
v4l2.device.version = 263362 (0x000404c2)
v4l2.device.capabilities = 2216693760 (0x84201000)
v4l2.device.device_caps = 69210112 (0x04201000)
gst-launch-1.0 v4l2src ! ...
Device found:name : rkisp1_selfpath
class : Video/Source
caps : video/x-raw, format=(string)YUY2, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)Y42B, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)I420, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)BGRx, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV12, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV21, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV12, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV21, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV61, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)NV16, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)RGB16, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
video/x-raw, format=(string)GRAY8, width=(int)[ 32, 1920, 8 ], height=(int)[ 16, 1080, 8 ], framerate=(fraction)[ 1/1, 30/1 ];
properties:
udev-probed = true
device.bus_path = platform-ff910000.rkisp1
sysfs.path = /sys/devices/platform/ff910000.rkisp1/video4linux/video1
device.subsystem = video4linux
device.product.name = rkisp1_selfpath
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video1
v4l2.device.driver = rkisp1_v0
v4l2.device.card = rkisp1_selfpath
v4l2.device.bus_info = platform:ff910000.rkisp1
v4l2.device.version = 263362 (0x000404c2)
v4l2.device.capabilities = 2216693760 (0x84201000)
v4l2.device.device_caps = 69210112 (0x04201000)
gst-launch-1.0 v4l2src device=/dev/video1 ! ...
Device found:name : rkisp1_dmapath
class : Video/Sink
caps : video/x-raw, format=(string)YUY2, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], interlace-mode=(string)progressive, colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 };
video/x-raw, format=(string)UYVY, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], interlace-mode=(string)progressive, colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 };
video/x-bayer, format=(string)bggr, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 }, parsed=(boolean)true;
video/x-bayer, format=(string)gbrg, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 }, parsed=(boolean)true;
video/x-bayer, format=(string)grbg, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 }, parsed=(boolean)true;
video/x-bayer, format=(string)rggb, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 }, parsed=(boolean)true;
video/x-raw, format=(string)YVYU, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], interlace-mode=(string)progressive, colorimetry=(string){ 1:4:5:4, 1:5:6:5, 1:3:5:1, 1:4:5:2, 1:4:5:3, 1:4:7:1, 1:4:12:8, 1:6:11:7, 1:0:0:0 };
properties:
udev-probed = true
device.bus_path = platform-ff910000.rkisp1
sysfs.path = /sys/devices/platform/ff910000.rkisp1/video4linux/video2
device.subsystem = video4linux
device.product.name = rkisp1_dmapath
device.capabilities = :video_output:
device.api = v4l2
device.path = /dev/video2
v4l2.device.driver = rkisp1_v0
v4l2.device.card = rkisp1_dmapath
v4l2.device.bus_info = platform:ff910000.rkisp1
v4l2.device.version = 263362 (0x000404c2)
v4l2.device.capabilities = 2216697856 (0x84202000)
v4l2.device.device_caps = 69214208 (0x04202000)
gst-launch-1.0 ... ! v4l2sink device=/dev/video2 -
I think you can use gstreamer from python. I have just started exploring this myself so I am not sure yet.
https://brettviren.github.io/pygst-tutorial-org/pygst-tutorial.html
https://sahilchachra.medium.com/all-you-want-to-get-started-with-gstreamer-in-python-2276d9ed548e
-
Has anyone succesfully installed Pikrellcam ( https://github.com/billw2/pikrellcam) on a tinker board? You may have to revise the installation script a bit and change the php version. although I think the buster version for TB is still 7,3
-
Has anyone succesfully installed Pikrellcam ( https://github.com/billw2/pikrellcam) on a tinker board? You may have to revise the installation script a bit and change the php version. although I think the buster version for TB is still 7,3
Hardware encoding vpu/gpu
in General Discussion
Posted
Works like a charm!
This is the stream i tried with audio and video:
gst-launch-1.0 -e v4l2src num-buffers=512 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! mpph264enc ! queue ! h264parse ! mp4mux0. autoaudiosrc ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! mp4mux ! filesink location=/home/linaro/testh264-2.mp4
To give other newbies like myself a little more to work on here is the layout, as I understand it.
gst-launch-1.0 -e v4l2src num-buffers=512 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! // this sets the camera source as v4l2 and will stop after 512 buffers have been used (approx 4 minutes ) raw vidoe stream is NV12 1920x108 with 30 fps, pretty obvious, add queue to let the computer keep working the camera while it encodes //
mpph264enc ! queue ! // right !encode h.264 via hardware. Nice!
h264parse ! // parse for muxing
mp4mux0. autoaudiosrc ! // link the video and audio mux for intended parcel format, in this case mp4
audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse // add audio source and encoding
! mp4mux ! f// mux it together into one file
filesink location=/home/linaro/testh264-2.mp4 // sink file where your video will end up!
Presto!