Reference: https://cs231n.github.io/python-numpy-tutorial/
Goku Coding Experience
Saturday, 27 December 2025
Monday, 12 May 2025
How to read a mp4 video with h265 codec using python opencv gstreamer in jetson?
import cv2
import numpy as np
# Replace with your H.265 video file
gst_pipeline = (
"filesrc location=/home/ninja/test1.mp4 ! "
"qtdemux ! h265parse ! nvv4l2decoder ! "
"nvvidconv ! video/x-raw,width=1920,height=1080,format=NV12 ! "
"appsink"
)
cap = cv2.VideoCapture(gst_pipeline, cv2.CAP_GSTREAMER)
h = 1080
w = 1920
if not cap.isOpened():
print("Failed to open video")
exit()
while True:
ret, frame = cap.read()
if not ret:
break
frame = np.fromstring(frame, dtype=np.uint8).reshape((int(h*3/2),w,1))
frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_NV12)
print(frame.shape)
#cv2.imshow("Jetson H.265 Video", frame)
#if cv2.waitKey(1) & 0xFF == ord("q"):
# break
cap.release()
cv2.destroyAllWindows()
Tuesday, 29 April 2025
Failed to initialize NVML: Unknown Error
RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at ../aten/src/THC/THCGeneral.cpp:47
root@ninja:/data#
root@ninja:/data# nvidia-smi
Failed to initialize NVML: Unknown Error
root@ninja:/data# exit
Thursday, 3 April 2025
How to check which process is using the external harddisk / pendrive / thumb drive
sudo fuser -m /mnt
(it will list out the processid)
sudo kill -9 processid
Tuesday, 11 February 2025
Best image viewer - https://nomacs.org/
https://nomacs.org/
Thursday, 16 January 2025
How to mount and umount the device in ubuntu?
to mount the device:
sudo lsblk
sudo mkdir /mnt
sudo mount /dev/sdc1 /mnt
to umount the device
sudo umount /mnt
or
sudo umount /dev/sdc1
sudo udisksctl power-off -b /dev/sdc1
Tuesday, 17 December 2024
How to setup NTP server in ubuntu20?
Reference: https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-20-04
First, run apt update to refresh your local package index:
- sudo apt update
Then, run apt install ntp to install this package:
- sudo apt install ntp
ntpd will begin automatically after your installation completes. You can verify that everything is working correctly by querying ntpd for status information:
- ntpq -p
If you want to setup a local server:
- sudo vim /etc/ntp.conf
- ---
# Point to our network's master time server
server 192.168.1.234 iburst
restrict default
driftfile /var/lib/ntp/ntp.drift
minpoll 4
maxpoll 5
Then, you can create a drift file as following:
- sudo vim /var/lib/ntp/ntp.drift
- ---
- 0.000
Finally you can restart the service:
- sudo service ntp restart
- sudo service ntp status