-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I'm hoping to get this working with a V4L (loopback) device fed by ffmpeg. If not for testing (since only a few trains a day at my location) but also so that I can eventually feed it from a networked camera via a go2rtc RTSP feed. But for now just with a sample recording of a train going past to see it work.
So in one terminal I do:
sudo modprobe v4l2loopback
export FEED_URL=~/sample.mp4
export OUTPUT=/dev/video0
ffmpeg -i "$FEED_URL" -f v4l2 -pix_fmt yuyv422 "$OUTPUT"
And then in another terminal I do:
export DATA_DIR=~/trains
export INPUT=/dev/video0
export CAMERA_W=2304
export CAMERA_H=1296
export RECT_X=1152
export RECT_Y=818
export RECT_W=473
export RECT_H=242
export PX_PER_M=19 # e.g. 430 px, 23 m
# see https://github.com/jo-m/trainbot/blob/43ad8c9716f385ef0714a5057dfe751360844e8d/pkg/vid/cam.go#L213
# and `V4L2_PIX_FMT_…` in https://www.kernel.org/doc/html/v4.10/media/uapi/v4l/videodev.html#videodev2-h
#export CAMERA_FORMAT_FOURCC=422P
#export CAMERA_FORMAT_FOURCC=mjpg
export CAMERA_FORMAT_FOURCC=YUYV
./trainbot
This combination gets me the farthest without general opening/format errors but then I am left with an error:
{"level":"panic","error":"img does not implement SubImage()","time":"2023-11-22T02:18:16.864Z","caller":"/src/cmd/trainbot/main.go:162","message":"failed to crop frame"}
Any advice?
Metadata
Metadata
Assignees
Labels
No labels