{"id":6824,"date":"2021-12-03T16:45:12","date_gmt":"2021-12-03T14:45:12","guid":{"rendered":"https:\/\/mummila.net\/kommentit\/?p=6824"},"modified":"2021-12-03T16:45:12","modified_gmt":"2021-12-03T14:45:12","slug":"4-4-0-snapshots-broken-when-netcam_high_url-used-with-recommended-width-and-height-values","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2021\/12\/03\/4-4-0-snapshots-broken-when-netcam_high_url-used-with-recommended-width-and-height-values\/","title":{"rendered":"4.4.0: snapshots broken when netcam_high_url used with recommended width and height values"},"content":{"rendered":"<ol start=\"0\">\n<li>Reviewed guide and contributing documents? Yes<\/li>\n<li>version 4.4.0<\/li>\n<li>installed as a package or compiled from sources: deb<\/li>\n<li>standalone or part of third party: standalone<\/li>\n<li>video stream source: net cam<\/li>\n<li>hardware: x86 (amd64)<\/li>\n<li>operating system: Ubuntu 20.04<\/li>\n<\/ol>\n<h1>Short description<\/h1>\n<p>In Motion 4.4.0, using recommended values of <code>width<\/code> and <code>height<\/code> results in broken snapshots, when <code>netcam_high_url<\/code> is used. Either the warning about using a different resolution is incorrect, or the creation of snapshots breaks when <code>width<\/code> and <code>height<\/code> are set so as to not cause a warning on startup.<\/p>\n<h1>Background<\/h1>\n<p>I have a 1080p camera (a TP-Link Tapo C100) with a 360p substream, so I&#8217;ve specied both URLs as follows:<\/p>\n<pre><code>netcam_url \"rtsp:\/\/192.168.1.206\/stream2\"                                        \r\nnetcam_high_url \"rtsp:\/\/192.168.1.206\/stream1\"\r\n<\/code><\/pre>\n<p>I&#8217;ve set up snapshots to occur with <code>snapshot_interval<\/code> = 60.<\/p>\n<p>If I set <code>width<\/code> and <code>height<\/code> based on the main stream (1920&#215;1080), Motion starts up with a warning:<\/p>\n<pre><code>netcam_rtsp_ntc: The network camera is sending pictures in a different\r\nnetcam_rtsp_ntc: size than specified in the configuration file.\r\nnetcam_rtsp_ntc: The picture is being transcoded into the size \r\nnetcam_rtsp_ntc: requested in the configuration.  If possible change\r\nnetcam_rtsp_ntc: netcam or configuration to indicate the same size\r\nnetcam_rtsp_ntc: to possibly lower CPU usage.\r\nnetcam_rtsp_ntc: Netcam: 640 x 360 =&gt; Config: 1920 x 1080\r\n<\/code><\/pre>\n<p>This implies I should set <code>width<\/code> and <code>height<\/code> based on the lower resolution stream, so I&#8217;ve done that, and the warning goes away.<\/p>\n<p>With Motion 4.3.2, the snapshots were saved as I would expect, albeit of course now in the lower resolution (360p), whereas I&#8217;d prefer them in the full 1080p.<\/p>\n<p>After upgrading to 4.4.0, the snapshots are still 360p, but now their content is garbled and green:<\/p>\n<p><a href=\"https:\/\/user-images.githubusercontent.com\/4244772\/144619525-6ce5bab6-cd71-487b-bf09-922e36c8a1ac.jpg\"><img decoding=\"async\" src=\"http:\/\/mummila.net\/kommentit\/files\/2021\/12\/01-20211203161040-snapshot.jpg\" alt=\"01-20211203161040-snapshot\" \/><\/a><\/p>\n<p>I haven&#8217;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 <code>width<\/code> and <code>height<\/code> based on the full stream (i.e. back to 1920&#215;1080), the snapshots now appear the full resolution and without corruption.<\/p>\n<p>Pictures from detected motion (<code>picture_output<\/code>) do not appear to be affected, i.e. they are saved in the correct 1080p resolution and look fine, regardless of the values of <code>width<\/code> and <code>height<\/code>. Video output likewise appears in the higher resolution, as I would expect.<\/p>\n<p>Here&#8217;s a minimal configuration that reproduces this issue for me, minus <code>netcam_userpass<\/code>.<\/p>\n<pre><code>log_level 8\r\n\r\ntarget_dir \"\/home\/jani\/tmp\"\r\n\r\nnetcam_url \"rtsp:\/\/192.168.1.206\/stream2\"\r\nnetcam_high_url \"rtsp:\/\/192.168.1.206\/stream1\"\r\n\r\nnetcam_params rtsp_transport=tcp\r\nnetcam_high_params rtsp_transport=tcp\r\n\r\nwidth 640\r\nheight 360\r\n\r\nsnapshot_interval 10<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Either the warning about using a different resolution is incorrect, or the creation of snapshots breaks when width and height are set accordingly.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[22908,2679],"class_list":["post-6824","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","tag-motion","tag-ubuntu","sijainti-github"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/6824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=6824"}],"version-history":[{"count":1,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/6824\/revisions"}],"predecessor-version":[{"id":6826,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/6824\/revisions\/6826"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=6824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=6824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=6824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}