This tool rewrites the video stream from a wi-fi borescope camera as described in my blog post Rewriting the video stream from a wi-fi borescope camera.
It fixes the borescope's intentional stream corruption and produces output
suitable for use in standard video tools such as ffmpeg
that read MJPEG
streams. Credit for identifying the method of intentional
corruption goes to Michael Karr et
al.
This tool runs on POSIX systems. So far, macOS is tested.
The ragel regular language parser generator must be installed.
On macOS, install ragel
with Homebrew:
brew install ragel
Build by running make borescope_stream
.
This program is designed to be used in a pipeline. It accepts a stream on stdin and writes raw or transformed data to stdout. It writes parsed headers and image information to stderr.
The following pipeline acquires video from the camera, logs the raw stream to a
file for later playback, rewrites the stream in real time, and displays video.
A named pipe is used because ffplay
only reads files and does not accept input
on stdin.
Note that ffplay
is only required if you want to watch the video with
ffplay
. Feel free to not watch the video, or to use replace ffplay
with
your preferred tool for viewing MJPEG streams.
mkfifo vid.fifo
nc 192.168.10.123 7060 \
| tee v.log \
| /path/to/borescope_stream --jpeg >vid.fifo & \
ffplay -hide_banner -loglevel error -f mjpeg vid.fifo
--jpeg
- write stripped JPEG stream to stdout.--write-files
- write stripped JPEG frames from the input stream to individually numbered files.