泰山派调试常用命令
ubuntu下使用命令行连接wifi
1 2 3 4 5 6
| sudo iwlist scan nmcli device wifi list nmcli device wifi connect {ESSID} password {PASSWORD} nmcli device wifi connect 404_2.4g password "@404@404" nmcli device wifi connect "404_5g" password "@404@404@404" ifname wlan0 make modules_install INSTALL_MOD_PATH=<rootfs_path>
|

image-20250305184435807
image-20250305184444185
备忘录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| v4l2-ctl --list-devices v4l2-ctl --list-formats-ext --device=/dev/video0 v4l2-ctl -d /dev/video0 -L v4l2-ctl --set-ctrl analogue_gain=80
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='UYVY' --stream-mmap=20 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --set-ctrl analogue_gain=80 --stream-to=/tmp/out.yuv
v4l2-ctl --verbose -d /dev/video1 --set-fmt-video=width=1920,height=1080,pixelformat='UYVY' --stream-mmap=20 --stream-to=/tmp/out.yuv
ffmpeg -f v4l2 -input_format nv12 -video_size 1920x1080 -i /dev/video0 -c:v libx264 -preset ultrafast output.mp4
ffmpeg -f v4l2 -i /dev/video0 -pixel_format yuv422p -framerate 15 -video_size 800x600 -c:v copy -f mpegts udp://@:1234
ffmpeg -f v4l2 -input_format nv12 -video_size 1920x1080 -i /dev/video8 -t 10 output.yuv
ffmpeg -f rawvideo -pixel_format yuv422p -video_size 3840x2160 -framerate 24 -i out.yuv -c:v libx264 output.mp4
scp lsc@192.168.115.129:/home/lsc/project/Release/kernel/boot.img ./
|
硬件编码测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| import cv2 import socket import numpy as np import time
TARGET_IP = "192.168.3.71" TARGET_PORT = 1234 CAMERA_INDEX = 0 JPEG_QUALITY = 70 SEND_RESOLUTION = (640, 480)
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
cap = cv2.VideoCapture(CAMERA_INDEX)
if not cap.isOpened(): print(f"错误:无法打开摄像头索引 {CAMERA_INDEX}") exit()
print(f"摄像头已打开。将推流到 UDP {TARGET_IP}:{TARGET_PORT}") print(f"发送分辨率: {SEND_RESOLUTION}, JPEG 质量: {JPEG_QUALITY}") print("按 Ctrl+C 停止推流。")
try: while True: ret, frame = cap.read() if not ret: print("错误:无法读取摄像头帧。") time.sleep(0.5) continue
frame_resized = cv2.resize(frame, SEND_RESOLUTION)
encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), JPEG_QUALITY] result, encoded_frame = cv2.imencode('.jpg', frame_resized, encode_param)
if not result: print("错误:JPEG 编码失败。") continue
data = encoded_frame.tobytes()
if len(data) > 65000: print(f"警告:帧数据过大 ({len(data)} 字节),可能无法完整发送。尝试降低分辨率或 JPEG 质量。")
try: udp_socket.sendto(data, (TARGET_IP, TARGET_PORT)) except socket.error as e: print(f"发送错误: {e}") time.sleep(1)
except KeyboardInterrupt: print("\n停止推流...")
finally: print("正在释放资源...") cap.release() udp_socket.close() cv2.destroyAllWindows() print("资源已释放。")
|
1 2 3 4 5
| -> Device Drivers │ │ -> Multimedia support (MEDIA_SUPPORT [=y]) │ │ -> Media drivers │ │ (1) -> V4L platform devices (V4L_PLATFORM_DRIVERS [=y])
|
pip install opencv-python numpy
sudo apt install -y libgl1