{"id":2380,"date":"2026-11-26T01:45:36","date_gmt":"2026-11-25T23:45:36","guid":{"rendered":"https:\/\/cln.io\/blog\/?p=2380"},"modified":"2026-11-26T01:45:36","modified_gmt":"2026-11-25T23:45:36","slug":"recovering-imou-camera-footage-from-a-broken-sd-card","status":"publish","type":"post","link":"https:\/\/cln.io\/blog\/recovering-imou-camera-footage-from-a-broken-sd-card\/","title":{"rendered":"Recovering Imou camera footage from a broken SD card"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My Imou camera&#8217;s 64 GB exFAT card wouldn&#8217;t mount on my Mac. Not even read-only. After a few wrong turns I recovered 131 MP4 clips. &#x1f389;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Notes for future me (and anyone else staring at a card that macOS won&#8217;t mount). This was done locally on macOS. Check the disk and destination before running commands that touch a disk.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Give this to your agent<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Copy\/paste this and adjust the camera and operating system if needed:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Help me recover footage from an SD card used in an Imou camera. The card is attached to my Mac and doesn't mount.\n\nFirst identify the external card and check its size and mount state. Confirm the device and destination paths before imaging; never guess a disk number. Don't format, repair, or write to the card. Make a full image and a ddrescue mapfile on another drive with enough free space, then work from the image.\n\nTry filesystem-aware recovery and PhotoRec. If those don't find video, search the image for DHAV markers. A marker alone isn't proof: test candidate offsets with ffprobe, extract a small sample, and verify a decoded frame. Offsets are specific to each image.\n\nIf a sample works, extract the footage into a separate folder. Try recovering audio as well, and keep logs. Index the available recording timestamps and report the date ranges, gaps, errors, and whether clips play correctly. Explain what was actually verified and don't claim all files were recovered unless that can be established. Ask me for the camera model and important dates if that helps.<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">First, make a copy<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>diskutil list<\/code> showed the card as <code>\/dev\/disk6<\/code> with the volume on <code>disk6s1<\/code>. The partition type was reported as <code>Windows_NTFS<\/code>, but <code>diskutil info disk6s1<\/code> identified the filesystem as exFAT. Both the normal and read-only mount failed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Disk Utility&#8217;s First Aid reported a successful repair, but the card still wouldn&#8217;t mount. In my case I ran First Aid <strong>before<\/strong> imaging it, so the image below reflects the card <em>after<\/em> that repair. Next time I&#8217;d image it first: repair can change filesystem metadata, and an unmodified copy gives you more options if recovery gets messy. &#x1f643;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install <a href=\"https:\/\/www.gnu.org\/software\/ddrescue\/manual\/ddrescue_manual.html\" rel=\"noopener\">GNU ddrescue<\/a> and <a href=\"https:\/\/www.cgsecurity.org\/wiki\/TestDisk\" rel=\"noopener\">TestDisk\/PhotoRec<\/a> with Homebrew. FFmpeg was already installed:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">brew install ddrescue testdisk ffmpeg<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure you have at least the card&#8217;s full capacity free, plus space for recovered files. My 64 GB card produced a 64 GB image and another 54 GB of extracted video. The disk number can change after reconnecting the card; identify yours by its size and external\/removable status, and check it again before running this. The image and mapfile must be on a different drive.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">diskutil list\ndiskutil info disk6\nmkdir -p ~\/Desktop\/sd-card-recovery\nsudo ddrescue -n \/dev\/rdisk6 \\\n  ~\/Desktop\/sd-card-recovery\/card.img \\\n  ~\/Desktop\/sd-card-recovery\/card.map<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>\/dev\/rdisk6<\/code> with the <strong>whole card&#8217;s<\/strong> raw device, not a partition or your internal disk. The <code>-n<\/code> pass copies the easy-to-read areas first, and the mapfile keeps track of progress if it needs to be resumed. Mine finished with <code>read errors: 0<\/code>, <code>bad-sector: 0 B<\/code> and 63,864 MB rescued. The display also said <code>pct rescued: 0.00%<\/code>, so I looked at the rescued size and read-error count rather than trusting that percentage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A clean read only means the card could be copied. It doesn&#8217;t mean the filesystem or footage is intact. From here on, we worked on <code>card.img<\/code> rather than the card.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PhotoRec didn&#8217;t find the video<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run PhotoRec against the image and select the partition, <strong>Other<\/strong> for the filesystem and <strong>Whole<\/strong> for the scan:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir -p ~\/Desktop\/sd-card-recovery\/recovered\nphotorec \/d ~\/Desktop\/sd-card-recovery\/recovered \\\n  ~\/Desktop\/sd-card-recovery\/card.img<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It found 1,380 files, mostly identified as text, but no photos or video. TestDisk found the existing partition, but didn&#8217;t uncover another accessible partition. That didn&#8217;t mean the footage was gone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some Imou\/Dahua streams use DHAV packets. Searching the image for <code>DHAV<\/code> found millions of occurrences. The first marker I tried was at byte <strong>32563286<\/strong> in <em>my<\/em> image. This offset is specific to this card: don&#8217;t copy it blindly for yours.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Find and test a DHAV stream<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This small script finds the first <code>DHAV<\/code> marker without loading the whole image into memory. A marker alone isn&#8217;t proof of video; random data can contain the same bytes. Check the surrounding bytes and test the result with FFmpeg.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python3 - &lt;&lt;'PY'\nfrom pathlib import Path\n\nimage = Path.home() \/ 'Desktop\/sd-card-recovery\/card.img'\nwith image.open('rb') as f:\n    offset = 0\n    tail = b''\n    while chunk := f.read(16 * 1024 * 1024):\n        data = tail + chunk\n        i = data.find(b'DHAV')\n        if i &gt;= 0:\n            print('First DHAV marker at byte:', offset - len(tail) + i)\n            break\n        tail = data[-3:]\n        offset += len(chunk)\n    else:\n        print('No DHAV marker found')\nPY<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the offset you found to make a small sample and inspect it. This is the command I used for my card:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python3 - &lt;&lt;'PY'\nfrom pathlib import Path\n\nfolder = Path.home() \/ 'Desktop\/sd-card-recovery'\nwith (folder \/ 'card.img').open('rb') as src, (folder \/ 'imou-sample.dav').open('wb') as dst:\n    src.seek(32563286)  # my image only: replace with your candidate offset\n    dst.write(src.read(100 * 1024 * 1024))\nPY\n\nffprobe -v error -show_streams -show_format \\\n  ~\/Desktop\/sd-card-recovery\/imou-sample.dav<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">FFprobe identified H.264 video and AAC audio. I remuxed the video and extracted a frame; the frame showed the camera view. Actual footage! The first attempt to copy the audio hit an invalid AAC packet, so the first bulk extraction below is <strong>video only<\/strong>. A second pass managed to recover audio by decoding and re-encoding it.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ffmpeg -i ~\/Desktop\/sd-card-recovery\/imou-sample.dav \\\n  -map 0:v:0 -c copy ~\/Desktop\/sd-card-recovery\/imou-video-sample.mp4\n\nffmpeg -ss 30 -i ~\/Desktop\/sd-card-recovery\/imou-video-sample.mp4 \\\n  -frames:v 1 ~\/Desktop\/sd-card-recovery\/sample-frame.jpg<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the sample before processing the whole image. FFmpeg reported decoding errors, although the frame we checked was readable. A different marker or a different camera may need a different approach.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Extract the footage<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use FFmpeg&#8217;s DHAV demuxer to read from the candidate offset and copy the video into roughly 15-minute MP4 segments:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir -p ~\/Desktop\/sd-card-recovery\/imou-clips\nffmpeg -skip_initial_bytes 32563286 -f dhav \\\n  -i ~\/Desktop\/sd-card-recovery\/card.img \\\n  -map 0:v:0 -c copy -f segment -segment_time 900 \\\n  -reset_timestamps 1 \\\n  ~\/Desktop\/sd-card-recovery\/imou-clips\/clip-%04d.mp4<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Again: replace the offset with one verified for your own image. This reads forward through the image, so it doesn&#8217;t recreate the original file names or necessarily recover every recording. FFmpeg reported decoding and timestamp errors; clips can be damaged or out of order. We verified a sample frame, not all 131 clips. Keep the original image and check the footage you actually need.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Another pass: audio too<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Copying the AAC stream stopped at a bad packet. Decoding and re-encoding the audio with FFmpeg got past those errors in a sample, so I ran a second extraction into a separate folder:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir -p ~\/Desktop\/sd-card-recovery\/imou-clips-with-audio\nffmpeg -err_detect ignore_err -skip_initial_bytes 32563286 -f dhav \\\n  -i ~\/Desktop\/sd-card-recovery\/card.img \\\n  -map 0:v:0 -map '0:a:0?' -c:v copy -c:a aac \\\n  -f segment -segment_time 900 -reset_timestamps 1 \\\n  ~\/Desktop\/sd-card-recovery\/imou-clips-with-audio\/clip-%04d.mp4<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use your own verified offset here too. A sample and the first completed clip contained both video and audio, but damaged packets can mean missing sound, glitches, or sync problems. The full audio pass finished with 131 clips; I haven&#8217;t checked all of them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What dates did we find?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The filenames from the extraction are just numbered clips. To get a rough idea of what was on the card, index the video packets&#8217; timestamps:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ffprobe -v quiet -skip_initial_bytes 32563286 -f dhav \\\n  -select_streams v:0 -show_entries packet=pts_time,pos,flags \\\n  -of csv=p=0 ~\/Desktop\/sd-card-recovery\/card.img \\\n  &gt; ~\/Desktop\/sd-card-recovery\/video-packets.csv<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Again, use the offset from your image. I counted timestamps per day and hour. Most of the packets were dated November 18\u201320; only small numbers of fragments were dated November 15\u201317. It found none dated November 21 in the indexed stream, and the November 20 packets ran until about 05:08 camera time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s an index of <strong>packets<\/strong>, not a list of complete recordings. The camera clock or timezone can be wrong, there were gaps and jumps between dates, and a few timestamps looked implausible. It doesn&#8217;t prove that every file was recovered or that footage from another date never existed. Some clips may contain mixed fragments or play out of order. Check the actual footage you need.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The data initially looked almost random, but the DHAV test showed playable compressed footage in at least part of the image. &#x1f605;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-elements-1 wp-block-paragraph\" style=\"color:#9ca3af;font-size:14px\">This post was written with the help of Codex (GPT-6), OpenAI&#8217;s AI coding agent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My Imou camera&#8217;s 64 GB exFAT card wouldn&#8217;t mount on my Mac. Not even read-only. After a few wrong turns I recovered 131 MP4 clips. &#x1f389; Notes for future me (and anyone else staring at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2383,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,26],"tags":[],"class_list":["post-2380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cameras","category-it"],"_links":{"self":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/2380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/comments?post=2380"}],"version-history":[{"count":3,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/2380\/revisions"}],"predecessor-version":[{"id":2384,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/2380\/revisions\/2384"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/media\/2383"}],"wp:attachment":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/media?parent=2380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/categories?post=2380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/tags?post=2380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}