欢迎光临散文网 会员登陆 & 注册

Klipper摄像Crowsnest插件安装及Timelapse延时摄影保姆级。

2023-03-30 10:36 作者:玩泥巴的小屁孩V  | 我要投稿

本文参考:https://www.bilibili.com/read/cv20924273/

一、要点:

新版kiauh  脚本中已包含crowsnest插件,安装更加便携!


1、一般免驱即插即用摄像头,均可以在linux、armbian等系统下的klipper支持使用,无需另外安装驱动。

1.1可以使用以下命令查看摄像头是否驱动上:

    ls /dev/v4l/by-id/*

如果驱动上了就可以看到,请记录下摄像头硬件地址后面要用到:

 /dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera-video-index0 

2、摄像头支持的分辨率及刷新率等参数可以通过 Crowsnest.log查看。


二、Crowsnest的安装

1、安装

方法一:kiauh  脚本安装

git clone https://gitee.com/miroky/kiauh.git

./kiauh/kiauh.sh

选择install 11,即可自动安装


方法二:手动安装,我还是喜欢手动安装的。

cd ~

git clone https://github.com/mainsail-crew/crowsnest.git

cd ~/crowsnest

sudo make install

安装成功后可在moonraker.conf添加以下代码:

[update_manager crowsnest]

type: git_repo

path: ~/crowsnest

origin: https://github.com/mainsail-crew/crowsnest.git

install_script: tools/install.sh

2、配置:

在同目录中找到crowsnest.conf

在crowsnest.conf 简单设置如下

[crowsnest]

log_path: ~/printer_data/logs/crowsnest.log

log_level: verbose                      # Valid Options are quiet/verbose/debug

delete_log: false                       # Deletes log on every restart, if set to true

[cam 1]

mode: mjpg                              # mjpg/rtsp

port: 8080                              # Port

#device: /dev/video0                     # See Log for available ...

device:/dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera-video-index0

#device这里是填写上面我们查到的摄像头硬件地址。

resolution: 640x480                     # widthxheight format

max_fps: 15                             # If Hardware Supports this it will be forced, otherwise ignored/coerced.

#custom_flags:                          # You can run the Stream Services with custom flags.

#v4l2ctl:                               # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.


改好设定后就保存重启。

三、安装Moonraker-timelapse

项目地址:https://github.com/mainsail-crew/moonraker-timelapse

英文安装参考:https://www.obico.io/blog/klipper-timelapse/

1.开始安装:

 cd ~/ 

git clone https://github.com/mainsail-crew/moonraker-timelapse.git 

cd ~/moonraker-timelapse 

make install

在monraker.conf 中最后面加入以下配置:

[update_manager timelapse]

type: git_repo

primary_branch: main

path: ~/moonraker-timelapse

origin: https://github.com/mainsail-crew/moonraker-timelapse.git managed_services: klipper moonraker

2.配置Moonraker-timelapse

配置参考:https://github.com/mainsail-crew/moonraker-timelapse/blob/main/docs/configuration.md

2.1 在printer.cfg中引用timelapse.cfg文件。

2.2打开printer.cfg文件在文件开始的地方加入以下代码:

     [include timelapse.cfg]

3.设定切片软件:(这里只拿Prusa Slicer演示,其它的切片软件请参看配置参考)

打印机设定->自定义G-code -> 图层更改后 G-Code,框中加入:TIMELAPSE_TAKE_FRAME

(Printer Settings -> Custom G-code -> Before layer change Gcode -> TIMELAPSE_TAKE_FRAME)

如图:

3.moonraker.conf文件中配置:

 3.1 打开moonraker.conf文件中添加:

[timelapse]

##   Following basic configuration is default to most images and don't need

##   to be changed in most scenarios. Only uncomment and change it if your

##   Image differ from standart installations. In most common scenarios

##   a User only need [timelapse] in there configuration.

#output_path: ~/timelapse/      #文件输出路径 

##   Directory where the generated video will be saved

#frame_path: /tmp/timelapse/   #项目临时存放路径 

##   Directory where the temporary frames are saved

#ffmpeg_binary_path: /usr/bin/ffmpeg

##   Directory where ffmpeg is installed #编译器路径 

########配置选项说明########

#enabled: True #是否启用时间延时摄影

#mode: layermacro #此模式使用宏来触发抓取帧,但需要设置切片器才能在图层更改时添加GCODE

#snapshoturl: http://localhost:8080/?action=snapshot #摄像头调用地址

#gcode_verbose: True #‎“true”启用或“false”禁用宏的详细程度‎

#parkhead: False #‎“true”启用或“false”禁用在拍摄帧之前移动打印头。‎

#parkpos: back_left ‎#这定义了在拍摄相框之前将打印头停放的位置。可能的配置是[center, front_left, front_right, back_left, back_right, custom]

#如果选择了custom想要自定义打印头驻留的位置可以设置下面的参数

#park_custom_pos_x: 0.0 ‎#自定义打印头驻留的绝对 X 坐标(单位 mm)‎

#park_custom_pos_y: 0.0 #自定义打印头驻留的绝对 Y 坐标(单位 mm)

#park_custom_pos_dz: 0.0 #‎自定义打印头驻留的相对 Y 坐标(单位 mm)‎

#park_travel_speed: 100 #驻留时打印头移动速度(单位毫米/秒

#park_retract_speed: 15 ‎#驻留时缩回速度(单位毫米/秒)‎

#park_extrude_speed: 15 #‎恢复打印时挤出的速度(单位毫米/秒)‎

#park_retract_distance: 1.0 #‎回抽来以防止渗出的距离(单位毫米)‎

#park_extrude_distance: 1.0 #‎恢复打印之前挤出以填充喷嘴的距离(单位 mm)‎

#hyperlapse_cycle: 30 #定义在超延时模式下拍摄帧的时间间隔

#autorender: True #‎“true”启用或“false”禁用打印结束时渲染过程的自动触发。或者,您可以使用最终 gcode 中的“TIMELAPSE_RENDER”或渲染 http 终端节点(可能集成到前端)来触发渲染过程。‎

#constant_rate_factor: 23 #‎这将配置渲染视频的质量与文件大小。CRF 刻度的范围是 0–51,其中 0 表示无损,23 表示默认值,51 表示质量最差。较低的值通常会导致较高的质量,主观上合理的范围为17-28。将 17 或 18 视为视觉上无损。更多信息:‎‎https://trac.ffmpeg.org/wiki/Encode/H.264‎F

#output_framerate: 30 #‎定义视频的帧速率。(每秒单位帧数)注意:如果启用了variable_fps,这将被忽略。‎

#pixelformat: yuv420p #‎定义输出视频的像素格式。一些较旧的h264设备,如手机和其他设备需要“ yuv420p”,这是默认的延时组件。要获取哪些像素格式可用的更多信息,请在系统控制台中运行“ffmpeg -pix_fmts”或参考 ffmpeg 文档:‎‎https://ffmpeg.org/ffmpeg.html‎

#time_format_code: %Y%m%d_%H%M #‎这定义了应如何命名呈现的视频。它使用 python 日期时间格式。默认值为“%Y%m%d_%H%M”。有关日期时间格式的更多信息,请参阅‎‎此处 https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes‎

#extraoutputparams:  ‎定义FFMPEG的额外输出参数 更多信息: ‎‎https://ffmpeg.org/ffmpeg.html‎‎ 注意:在这里指定任何内容可能会禁用其他功能!(ffmpeg 限制)‎

#variable_fps: False #‎“true”启用或“false”禁用输出帧速率的变量计算。这使用拍摄的帧数和“目标长度”,但受“variable_fps_min”和“variable_fps_max”设置的限制。

#targetlength: 10 定义视频的目标长度(单位秒)

#variable_fps_min: 5 ‎variable_fps的最小 fps(每秒帧数)。‎

#variable_fps_max: 60 variable_fps的最大 fps(每秒帧数)。‎

#flip_x: False

#flip_y: False

#duplicatelastframe: 0 #‎将最后一帧复制到输出视频的末尾。‎

#previewimage: True #‎“true”启用或“false”禁用最后一帧来生成预览缩略图‎

#saveframes: False ‎“True”启用或“False”禁用将帧打包到 zip 文件以供外部使用或呈现。


以下为英文原版说明:


# moonraker.conf

# [timelapse] section


#enabled: True

#mode: layermacro

#snapshoturl: http://localhost:8080/?action=snapshot

#gcode_verbose: True

#parkhead: False

#parkpos: back_left

#park_custom_pos_x: 0.0

#park_custom_pos_y: 0.0

#park_custom_pos_dz: 0.0

#park_travel_speed: 100

#park_retract_speed: 15

#park_extrude_speed: 15

#park_retract_distance: 1.0

#park_extrude_distance: 1.0

#hyperlapse_cycle: 30

#autorender: True

#constant_rate_factor: 23

#output_framerate: 30

#pixelformat: yuv420p

#time_format_code: %Y%m%d_%H%M

#extraoutputparams: 

#variable_fps: False

#targetlength: 10

#variable_fps_min: 5

#variable_fps_max: 60

#flip_x: False

#flip_y: False

#duplicatelastframe: 0

#previewimage: True

#saveframes: False

#wget_skip_cert_check: False


3.2现在你就可以在界面中看到延时图标了。

好了你可以自己设定开搞:



Klipper摄像Crowsnest插件安装及Timelapse延时摄影保姆级。的评论 (共 条)

分享到微博请遵守国家法律