4.4.0: snapshots broken when netcam_high_url used with recommended width and height values
- Reviewed guide and contributing documents? Yes
- version 4.4.0
- installed as a package or compiled from sources: deb
- standalone or part of third party: standalone
- video stream source: net cam
- hardware: x86 (amd64)
- operating system: Ubuntu 20.04
Short description
In Motion 4.4.0, using recommended values of width
and height
results in broken snapshots, when netcam_high_url
is used. Either the warning about using a different resolution is incorrect, or the creation of snapshots breaks when width
and height
are set so as to not cause a warning on startup.
Background
I have a 1080p camera (a TP-Link Tapo C100) with a 360p substream, so I’ve specied both URLs as follows:
netcam_url "rtsp://192.168.1.206/stream2"
netcam_high_url "rtsp://192.168.1.206/stream1"
I’ve set up snapshots to occur with snapshot_interval
= 60.
If I set width
and height
based on the main stream (1920×1080), Motion starts up with a warning:
netcam_rtsp_ntc: The network camera is sending pictures in a different
netcam_rtsp_ntc: size than specified in the configuration file.
netcam_rtsp_ntc: The picture is being transcoded into the size
netcam_rtsp_ntc: requested in the configuration. If possible change
netcam_rtsp_ntc: netcam or configuration to indicate the same size
netcam_rtsp_ntc: to possibly lower CPU usage.
netcam_rtsp_ntc: Netcam: 640 x 360 => Config: 1920 x 1080
This implies I should set width
and height
based on the lower resolution stream, so I’ve done that, and the warning goes away.
With Motion 4.3.2, the snapshots were saved as I would expect, albeit of course now in the lower resolution (360p), whereas I’d prefer them in the full 1080p.
After upgrading to 4.4.0, the snapshots are still 360p, but now their content is garbled and green:
I haven’t looked at the code, but what this looks like to me is as if Motion is now using the high resolution URL for the image data, but the lower resolution dimensions, and the resulting file is a (broken) crop of the full resolution image. Indeed, if I set width
and height
based on the full stream (i.e. back to 1920×1080), the snapshots now appear the full resolution and without corruption.
Pictures from detected motion (picture_output
) do not appear to be affected, i.e. they are saved in the correct 1080p resolution and look fine, regardless of the values of width
and height
. Video output likewise appears in the higher resolution, as I would expect.
Here’s a minimal configuration that reproduces this issue for me, minus netcam_userpass
.
log_level 8
target_dir "/home/jani/tmp"
netcam_url "rtsp://192.168.1.206/stream2"
netcam_high_url "rtsp://192.168.1.206/stream1"
netcam_params rtsp_transport=tcp
netcam_high_params rtsp_transport=tcp
width 640
height 360
snapshot_interval 10