Cipher Log

Chronicles in Language, Technology, and Law

Using Walmart Security Videos (Updated!)

January 14, 2022

Walmart surveillance videos come in a weird codec made by a company called Verint. (A codec is a small piece of software that tells other software how to make sense of audio or video data.) This codec has had various trademark names attached to it, including the "Nextiva" codec, but it can safely be called SN40, which is really just a slight variation on H.263.

I previously posted about how to use and convert these files using the MPlayer software, but I no longer recommend that. The MPlayer project appears to be in a bit of disarray. In any case, the underlying software MPlayer relies on, ffmpeg, has gotten much easier to use directly, so I recommend doing that.

It should be easy to install ffmpeg with your Mac or Linux package manager (I recommend Homebrew for Mac). From a terminal window, issue brew install ffmpeg or apt install ffmpeg or whatever the package manager tells you, as appropriate.

After installation, use ffmpeg to convert the SN40/Verint file to a standard x264 MPEG-4 file. Make sure ffmpeg is in your current path (on Windows, it's easiest just to place the ffmpeg.exe file from a release build in the same place as your videos).

ffmpeg -vcodec h263 -i video.avi -aspect "16:10" video.mp4

If you're using bash or similar (zsh, fish, etc.), then you can use this to convert an entire directory full of Verint files.

for file in *.avi; do ffmpeg -vcodec h263 -i "${file}" -aspect "16:10" "${file}.mp4"; done

NOTE: You must explicitly tell ffmpeg to use the h263 input video codec.

FOR ADVANCED USERS ONLY: If you want to use the AVI files as-is without converting them to a different format (e.g., to preserve as much fidelity to the original file as possible), and you are on macOS, Linux, or another Unix-like system with xxd installed, you can simple fix the headers to specify the correct (H.263) codec, and the file will play in a video player that knows how to read H.263 AVI files (IINA, mpv, VLC, etc.). This does not modify the file at all, and does not fix the aspect ratio. From the directory where the videos are located, run this command:

for file in *.avi; do xxd -c 180 -p "${file}" | sed "s/00534e343000/004832363300/g" | xxd -r -p - "${file}.fixed.avi"; done

zsh URL quoting

January 02, 2022

A while back I couldn't figure out why URLs wouldn't work with curl or youtube-dl in zsh, and I found this discussion on Stack Overflow.

Better than the accepted answer, though, is the suggestion to place the following in your ~/.zshrc file:

autoload -Uz bracketed-paste-magic zle -N bracketed-paste bracketed-paste-magic autoload -Uz url-quote-magic zle -N self-insert url-quote-magic