How to convert audio file of fax transmission to image in Linux?

I have a number of uncompressed audio files recorded from an analog (POTS) telephone line of fax transmissions. Is there a way to convert these files into images of the fax they contain (in Linux)?

I'm not looking to send/receive a fax via a modem, but just to "replay" the communications tones and parse out the fax message. I understand there are duplex issues and not knowing which end of the conversation is sending what.


Solution 1:

Most faxes from the past decade are CCITT Group 3 or 4, containing image/g3fax or image/g4fax data which is encapsulated, or rather modulated, in one of V.27, V.29, V.17, V.34, or V.34bis.

Note that the fax transmission is not so-much a transmission, as a 2-way communication. Thus, you cannot simply play this audio back into a fax machine and expect it to work. However, luckily, the fax image data transmission itself is uninterrupted, so it is possible to filter out the unnecessary data.

What you will need to do is demodulate the content to retrieve the binary fax session and to filter out and extract the image/g3fax or image/g4fax data.

The late Tony Fischer wrote a software fax demodulator for V.34. It only works on Irix, so you'll need to port it. There was a Linux port at some time, but I couldn't find any valid links. http://www-users.cs.york.ac.uk/~fisher/software/modem/current/

There is also the Linmodem project.

Between these resources and some C programming, you should be able to extract the faxes... this isn't for the faint of heart, but possible, if the data is that important to you.

Solution 2:

There is a test tool called fax_decode which takes one channel audio wave file and decodes from it fax bitmap into tiff image file. So exactly for what you have asked.

This tool is part of the SpanDSP library from soft-switch project. You can download it from https://www.soft-switch.org/downloads/spandsp/ and configure it with --enable-tests. Source code is in tests/fax_decode.c file.

I tested it on right channel of fax recordings from http://goughlui.com/2013/02/13/sounds-of-fax-modes-and-ecm/ and it is working fine.

Solution 3:

The recordings you have probably contain enough information to reassemble the information. However I do not know of any off-the-shelf way to do this in linux or any other operating system.

You might like to look at the soft modems or the amateur radio software modems - you might be able to play it back through a loopback or something.

Alternatively - look at the standards and implement it yourself. Better warm up your DSP programming skills. :)