Cipher Log

Chronicles in Language, Technology, and Law

Using Walmart Security Videos

May 14, 2014

UPDATE 14 JANUARY 2022: 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

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.

An open-source suite of video software called MPlayer is famous for being able to play a wide variety of video formats. It can be obtained here: http://www.mplayerhq.hu/design7/dload.html

MPlayer comes with a large number of core or "essential" codecs. The SN40 codec required to play Walmart surveillance footage is not included in this default core set. You must download the "all codecs" package for MPlayer, for Linux or for Windows, as appropriate.

Once you have done that and installed the codecs in the right place (/usr/lib/codecs/ on Linux; the "codecs" folder in the MPlayer install folder on Windows), MPlayer and its video converter, MEncoder, should be able to play (and convert) the Walmart surveillance videos. I recommend setting up a folder with two sub-folders - "avi" and "264" - and placing the surveillance clips in the "avi" subfolder. Then you can use MEncoder to convert them to the H.264 format in the 264 folder.

If you are using Linux with bash as your shell, you can do this:

cd ~/my-working-folder/avi/

and then this

find *.avi | while read file; do mencoder "$file" -ovc x264 -o "../264/$file.mp4"; done

Lastly, you might want to use Handbrake to clean up the files, saving them in a third "mp4" folder (MEncoder sometimes makes files that other players have difficulty opening; Handbrake creates files that play more nicely).