{"id":22289751,"url":"https://github.com/cfryanr/hikvision-download-assistant","last_synced_at":"2025-07-28T23:30:40.566Z","repository":{"id":56053032,"uuid":"268378447","full_name":"cfryanr/hikvision-download-assistant","owner":"cfryanr","description":"A command-line tool to make searching and downloading photos and videos from your Hikvision cameras easy... without requiring installation of any Hikvision software on your computer!","archived":false,"fork":false,"pushed_at":"2020-11-28T22:53:47.000Z","size":76,"stargazers_count":12,"open_issues_count":5,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-06T01:38:07.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cfryanr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-31T22:57:27.000Z","updated_at":"2022-07-25T22:07:14.000Z","dependencies_parsed_at":"2022-08-15T12:20:10.471Z","dependency_job_id":null,"html_url":"https://github.com/cfryanr/hikvision-download-assistant","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfryanr%2Fhikvision-download-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfryanr%2Fhikvision-download-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfryanr%2Fhikvision-download-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfryanr%2Fhikvision-download-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfryanr","download_url":"https://codeload.github.com/cfryanr/hikvision-download-assistant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227962279,"owners_count":17847912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T17:09:58.530Z","updated_at":"2024-12-03T17:09:59.714Z","avatar_url":"https://github.com/cfryanr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hikvision Download Assistant\n\nA command-line tool to make searching and downloading photos and videos from your Hikvision cameras easy... \nwithout requiring installation of any Hikvision software on your computer!\n\n## Usage\n\nHikvision Download Assistant is simple command line tool that connects to your Hikvision camera or NVR\nusing the ISAPI web API to perform searches for videos and photos. It writes `curl` commands to the screen\nthat you can then use to download each photo or video from the ISAPI API.\n\nLike most command-line tools, it is designed to be easily composed with other command-line tools.\nThe list of search results goes to `stdout`.\nAll other helpful header and footer text is sent to `stderr` so it can be easily excluded from pipes and redirects.\n\nRun using `java -jar hikvision-download-assistant.jar \u003coptions\u003e`.\n\n### Usage statement\n\n```\nUsage: java -jar hikvision-download-assistant.jar [-hqV] [-d=\u003ctableDelimiter\u003e] [-f=\u003cfromTime\u003e] [-o=\u003coutputFormat\u003e] [-p=\u003coutputPassword\u003e] [-t=\u003ctoTime\u003e] [-u=\u003coutputUsername\u003e] HOST USERNAME PASSWORD\n      HOST                 Connect to this host or IP address to perform search.\n      USERNAME             Use this username when connecting to perform search.\n      PASSWORD             Use this password when connecting to perform search.\n  -d, --table-delimiter=\u003ctableDelimiter\u003e\n                           The column delimiter for table output. Defaults to '|'.\n  -f, --from-time=\u003cfromTime\u003e\n                           Search starting from this time, entered using English natural language. Defaults to '24 hours ago'.\n  -h, --help               Show this help message and exit.\n  -o, --output=\u003coutputFormat\u003e\n                           Output format. Can be 'table' or 'json'. Defaults to 'table'.\n  -p, --output-password=\u003coutputPassword\u003e\n                           Output a different password in the printed curl commands, e.g. '$PASSWORD'.\n  -q, --quiet              Suppress header and footer.\n  -t, --to-time=\u003ctoTime\u003e   Search up to this time, entered using English natural language. Defaults to 'now'.\n  -u, --output-username=\u003coutputUsername\u003e\n                           Output a different username in the printed curl commands, e.g. '$USERNAME'.\n  -V, --version            Print version information and exit.\n```\n\n### Examples\n\nWith default options:\n\n```bash\n$ java -jar hikvision-download-assistant.jar 192.168.1.64 admin passsword123\nGetting photos and videos from \"Saturday May 30, 2020 at 7:43:52 PM PDT\" to \"Sunday May 31, 2020 at 7:43:53 PM PDT\"\n\nType|EventType|Start|End|Curl\n-----------------------------\nVIDEO|ALLEVENT|2020-05-31T19:01:06-0700|2020-05-31T19:01:22-0700|curl -f --anyauth --user admin:password123 -X GET -d '\u003cdownloadRequest\u003e\u003cplaybackURI\u003ertsp://192.168.1.64/Streaming/tracks/101/?starttime=20200601T020106Z\u0026amp;endtime=20200601T020122Z\u0026amp;name=ch01_00000000008001213\u0026amp;size=6836476\u003c/playbackURI\u003e\u003c/downloadRequest\u003e' 'http://192.168.1.64/ISAPI/ContentMgmt/download' --output 2020-05-31T19-01-06.mp4\nPHOTO|MOTION|2020-05-31T19:01:09-0700|2020-05-31T19:01:09-0700|curl -f --anyauth --user admin:password123 'http://192.168.1.64/ISAPI/Streaming/tracks/103/?starttime=20200601T020109Z\u0026endtime=20200601T020109Z\u0026name=ch01_00000000005030201\u0026size=574906' --output 2020-05-31T19-01-09.jpeg\nPHOTO|MOTION|2020-05-31T19:01:10-0700|2020-05-31T19:01:10-0700|curl -f --anyauth --user admin:password123 'http://192.168.1.64/ISAPI/Streaming/tracks/103/?starttime=20200601T020110Z\u0026endtime=20200601T020110Z\u0026name=ch01_00000000005030301\u0026size=710770' --output 2020-05-31T19-01-10.jpeg\nVIDEO|ALLEVENT|2020-05-31T19:35:29-0700|2020-05-31T19:35:47-0700|curl -f --anyauth --user admin:password123 -X GET -d '\u003cdownloadRequest\u003e\u003cplaybackURI\u003ertsp://192.168.1.64/Streaming/tracks/101/?starttime=20200601T023529Z\u0026amp;endtime=20200601T023547Z\u0026amp;name=ch01_00000000008001313\u0026amp;size=2933900\u003c/playbackURI\u003e\u003c/downloadRequest\u003e' 'http://192.168.1.64/ISAPI/ContentMgmt/download' --output 2020-05-31T19-35-29.mp4\nPHOTO|MOTION|2020-05-31T19:35:34-0700|2020-05-31T19:35:34-0700|curl -f --anyauth --user admin:password123 'http://192.168.1.64/ISAPI/Streaming/tracks/103/?starttime=20200601T023534Z\u0026endtime=20200601T023534Z\u0026name=ch01_00000000005031401\u0026size=537158' --output 2020-05-31T19-35-34.jpeg\n\nFound 2 videos and 4 photos\n```\n\nWith `--output json`:\n\n```bash\n$ java -jar hikvision-download-assistant.jar 192.168.1.64 admin passsword123 --output json\nGetting photos and videos from \"Friday Jun 5, 2020 at 12:14:53 PM PDT\" to \"Saturday Jun 6, 2020 at 12:14:54 PM PDT\"\n\n{\n  \"metadata\" : {\n    \"host\" : \"192.168.1.64\",\n    \"fromHumanReadableTime\" : \"Friday Jun 5, 2020 at 12:14:57 PM PDT\",\n    \"toHumanReadableTime\" : \"Saturday Jun 6, 2020 at 12:14:57 PM PDT\",\n    \"fromTime\" : \"2020-06-05T12-14-57\",\n    \"toTime\" : \"2020-06-06T12-14-57\"\n  },\n  \"results\" : [ {\n    \"mediaType\" : \"VIDEO\",\n    \"startTime\" : 1591456673000,\n    \"endTime\" : 1591456710000,\n    \"eventType\" : \"ALLEVENT\",\n    \"curlCommand\" : \"curl -f --anyauth --user admin:password123 -X GET -d '\u003cdownloadRequest\u003e\u003cplaybackURI\u003ertsp://192.168.1.64/Streaming/tracks/101/?starttime=20200606T151753Z\u0026amp;endtime=20200606T151830Z\u0026amp;name=ch01_00000000021000213\u0026amp;size=4938980\u003c/playbackURI\u003e\u003c/downloadRequest\u003e' 'http://192.168.1.64/ISAPI/ContentMgmt/download' --output 2020-06-06T08-17-53.mp4\"\n  }, {\n    \"mediaType\" : \"PHOTO\",\n    \"startTime\" : 1591456677000,\n    \"endTime\" : 1591456677000,\n    \"eventType\" : \"MOTION\",\n    \"curlCommand\" : \"curl -f --anyauth --user admin:password123 'http://192.168.1.64/ISAPI/Streaming/tracks/103/?starttime=20200606T151757Z\u0026endtime=20200606T151757Z\u0026name=ch01_00000000020004001\u0026size=469186' --output 2020-06-06T08-17-57.jpeg\"\n  }, {\n    \"mediaType\" : \"VIDEO\",\n    \"startTime\" : 1591456962000,\n    \"endTime\" : 1591456977000,\n    \"eventType\" : \"ALLEVENT\",\n    \"curlCommand\" : \"curl -f --anyauth --user admin:password123 -X GET -d '\u003cdownloadRequest\u003e\u003cplaybackURI\u003ertsp://192.168.1.64/Streaming/tracks/101/?starttime=20200606T152242Z\u0026amp;endtime=20200606T152257Z\u0026amp;name=ch01_00000000021000713\u0026amp;size=1814988\u003c/playbackURI\u003e\u003c/downloadRequest\u003e' 'http://192.168.1.64/ISAPI/ContentMgmt/download' --output 2020-06-06T08-22-42.mp4\"\n  }, {\n    \"mediaType\" : \"PHOTO\",\n    \"startTime\" : 1591456967000,\n    \"endTime\" : 1591456967000,\n    \"eventType\" : \"MOTION\",\n    \"curlCommand\" : \"curl -f --anyauth --user admin:password123 'http://192.168.1.64/ISAPI/Streaming/tracks/103/?starttime=20200606T152247Z\u0026endtime=20200606T152247Z\u0026name=ch01_00000000020013201\u0026size=404225' --output 2020-06-06T08-22-47.jpeg\"\n  } ]\n}\n\nFound 2 videos and 2 photos\n```\n\n### Unix/MacOS pipeline examples\n\nFiltering and choosing a column using `jq`:\n\n```bash\njava -jar hikvision-download-assistant.jar 192.168.1.64 admin $PASSWORD --quiet --output json | jq '.results[] | select(.eventType==\"MOTION\") | .startTime'\n```\n\nFiltering and choosing a column using `grep` and `cut`:\n\n```bash\njava -jar hikvision-download-assistant.jar 192.168.1.64 admin $PASSWORD --quiet | grep MOTION | cut -d '|' -f 3\n```\n\nExecuting all of the returned curl commands to download all of the results to the current \nworking directory (assuming `bash` is your shell):\n\n```bash\njava -jar hikvision-download-assistant.jar 192.168.1.64 admin $PASSWORD --quiet | cut -d '|' -f 5 | while read curl_cmd; do eval $curl_cmd; done\n```\n\n### Using `--from-time` and `--to-time`\n\nThese options take English natural language and try their best to understand what you mean.\n\nExamples:\n\n- `now`\n- `10 pm yesterday`\n- `noon yesterday`\n- `5 pm` - 5 pm today\n- `6:50 today` - caution, this is 6:50 AM, no matter what current time\n- `6:50 am today` or `6:50 pm today` - safer alternative so you don't get AM by accident\n- `last thursday` - at the current time of day, but different date\n- `1 week ago` - at the current time of day, but different date\n- `oct 3rd` - at the current time of day, but different date\n- `2/14/20 at 2 am`\n- ...[and many more](http://natty.joestelmach.com/doc.jsp)\n\nIt will not always guess correctly, so the first line of output will always print what it guessed so you can confirm.\n\nYour `--to-time` can be a date/time in the future. This may be helpful if your camera's system time is wrong.\n\n### The `download_days.sh` script\n\nThe [`download_days.sh`](download_days.sh) script is an example of using this app in a shell script.\nIt downloads all of the photos and videos for the requested number of days and then \ngenerates a simple web-based UI for browsing all of the downloaded photos and videos.\n\n### Other useful command-line tips for manipulating the downloaded photos and videos\n\nMake a playlist out of all the videos in the current directory, and then open it with VLC:\n\n```bash\nfind $(pwd) -maxdepth 1 -name '*.mp4' | sort \u003e playlist.m3u\nvlc --play-and-exit --no-video-title-show playlist.m3u\n```\n\nConvert all the video files in the current directory into a format that is playable by web browsers,\nassuming that you have `ffmpeg` installed:\n\n```bash\nfor file in $(find $(pwd) -maxdepth 1 -name '*.mp4'); do ffmpeg -err_detect ignore_err -i \"$file\" -c copy $(dirname \"$file\")/$(basename \"$file\" .mp4).fixed.mp4; done\n```\n\n## Why would I need this?\n\nWhy, you ask? Several reasons!\n\n- The Hikvision in-browser web UI software for browsing and downloading videos and photos is *no\n  longer compatible with MacOS at all*. When you open their web UI, the \"Live View\" \n  and \"Configuration\" tabs will appear, but the \"Picture\" and \"Playback\" tabs will not appear.\n- The Hikvision in-browser web UI software for browsing and downloading videos and photos for\n  MS Windows works but still requires installing Hikvision software on your computer.\n  Some people may not want to install this software.\n- Hikvision offers a free application called\n  [iVMS-4200](https://www.hikvision.com/en/products/software/ivms-4200/)\n  which does offer these capabilities, which does work on both MacOS and Windows.\n  However, some people might wish to avoid installing it.\n  Some users have complained in online forums about the design and usability of the application.\n  Also, installing this software on a Mac requires entering your admin password several times,\n  indicating that it is making some kind of changes to your OS, and it's not clear how to uninstall\n  all of its side effects.\n- There doesn't seem to be a linux version of iVMS-4200, so there is no obvious way to download\n  photos and videos on a linux computer.\n- Both the Hikvision web UI and the iVMS-4200 only allow you to download one \n  page of video or photo search results at a time, so it is not clear how to easily download\n  large numbers of photos and videos.\n- You can still configure your camera using the Hikvision in-browser web UI software, so if\n  there were another tool to help you download videos and photos, then you wouldn't need to\n  install any software from Hikvision. Well, now there is!\n\n## Prerequisites\n\n### Prerequisites on your computer\n\nThis application is written in Java, and therefore can run on pretty much any platform.\n\nYou'll need a Java Runtime Environment on your computer. It must be Java version 11 or higher.\n\nGood news, you might already have one! Open your command terminal and type `java -version` to check.\n\nDon't have one? You could install any JRE that you like, for example you could\nchoose to install [OpenJDK](https://openjdk.java.net/install/index.html), \ne.g. `brew install openjdk` on a Mac.\n\n### Prerequisites on your Hikvision device(s)\n\nThere are no prerequisites on your camera. Here are some helpful tips for configuring your camera.\n\nNote that this app uses digest authentication, which is the default setting on Hikvision cameras, so you do *not* need\nto enable basic authentication to use this app. You also do *not* need to enable Hikvision-CGI to use this app.\n\nYou'll want to make sure that your camera's system clock is correct. You can check this in the camera's web UI\nunder System -\u003e System Settings -\u003e Time Settings. You'll probably also want to set the correct time zone on that\nsame web page.\n\nYou may wish to enable the Daylight Savings Time feature to avoid having your computer's\ntime and your camera's time differ by one hour in the summer. This can be enabled in the camera's web UI\nunder System -\u003e System Settings -\u003e DST. Be sure to also change the DST start time, end time, and bias\nto match your local DST schedule.\nFor the US you would check the `Enable DST box`, start on `Mar Second Sun 02`, end on `Nov First Sun 02`, \nand set a bias of `60minutes`. Don't forget to click \"Save\".\n\nIf you are formatting an sdcard in the Hikvision camera's web UI, you can choose the\nphoto to video ratio for setting quotas on the same web page. These settings only apply during formatting, so be\nsure to set these to your preferred values before you format the sdcard.\n\nYou may wish to set up [motion-activated recording](https://www.vueville.com/home-security/cctv/ip-cameras/hikvision-motion-detection-setup).\n\nYou may also wish to set up [event-triggered photos](http://hikvision.com/UploadFile/File/2014331155115857.pdf)\nto automatically take a series of photos for every motion event, in addition to the video.\n\n### Related tools (not required)\n\n- You'll probably want [`curl`](https://ec.haxx.se), but you already have that.\n- You might like to install [VLC](https://www.videolan.org/vlc/) to view\n  the downloaded videos, e.g. `brew cask install vlc` on a Mac.\n- You might like [`ffmpeg`](https://ffmpeg.org) to convert the downloaded videos, \n  e.g. `brew install ffmpeg` on a Mac.\n\n## Compatible cameras and DVR/NVRs\n\nThis was developed and tested using my Hikvision model DS-2CD2185FWD-I IP camera\nusing Firmware version `V5.6.3 build 190923`.\n\nTheoretically, it should work with any Hikvision camera.\n\nI believe that the Hikvision NVRs offer the same ISAPI endpoint (`POST /ISAPI/ContentMgmt/search`) so\nit should theoretically work with those too.\n\nYou mileage may vary. Github issues and PRs are welcome.\n\n## Installing hikvision-download-assistant\n\nDownload the latest release jar file from \nhttps://github.com/cfryanr/hikvision-download-assistant/releases/latest\nin your browser.\n\nOr download with `curl`, assuming you're using `bash` as your shell and that want to keep the file in `/usr/local/bin`:\n\n```bash\ncd /usr/local/bin \u0026\u0026 { curl -fLO https://github.com/cfryanr/hikvision-download-assistant/releases/download/v1.1.0/hikvision-download-assistant.jar; cd -; }\n```\n\nIf you would like to use `download_days.sh`, then download it to the same directory as the jar file:\n\n```bash\ncd /usr/local/bin \u0026\u0026 { curl -fLO https://raw.githubusercontent.com/cfryanr/hikvision-download-assistant/v1.1.0/download_days.sh; chmod 755 download_days.sh; cd -; }\n```\n\n## Building\n\nIf you would prefer to compile the source code yourself, you'll need to install a Java JDK, \ne.g. `brew install openjdk` on a Mac.\n\nTo build, run `./mvnw clean package` from the top-level directory of the project.\n\nThe compiler will output a file called `target/hikvision-download-assistant-1.0-SNAPSHOT-jar-with-dependencies.jar`.\nIf you'd like, you can copy this to whatever directory and filename you like.\n\nRun it with `java -jar target/hikvision-download-assistant-1.0-SNAPSHOT-jar-with-dependencies.jar \u003coptions\u003e`\n\n## Copyright and Licence\n\n`Copyright (c) 2020 Ryan Richard`\n\nLicensed under MIT. See [LICENSE](LICENSE) file for license.\n\nThe author of this software is not affiliated with Hikvision Digital Technology Co., the maker of Hikvision cameras, \nand this software is not endorsed by Hikvision Digital Technology Co.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfryanr%2Fhikvision-download-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfryanr%2Fhikvision-download-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfryanr%2Fhikvision-download-assistant/lists"}