H264 Encoding with Audio

From BATC Wiki
Jump to navigation Jump to search


Software version 201810270 introduces the capability to add audio to H264 encoded video. This is achieved using a new version of avc2ts (written by F5OEO). This version has some limitations, but achieves much better picture quality from the Pi Camera at low SRs than the previous version.


The audio is encoded using an AAC encoder at 20 Kbit/second takes up very little of the available bandwidth. In some modes there is an occasional (once every 10 minutes or so) 5 second burst of noise on the audio. The cause of this is not yet known.

Pi Camera Mode

This mode works well from 125 KS 7/8 FEC up to 4 MS. For lower symbol rates, the Audio should be switched off, which will switch in the older avc2ts encoder without audio.

Note that on the Waveshare 3.5 inch screen, the viewfinder does not fill the screen. This is intended behaviour. Also, on the 7 inch screen, the viewfinder is off-centre.

Composite Video Input Mode

Composite Video Mode works well with PAL and audio input from 333 KS (7/8 FEC) up to 4 MS (7/8 FEC). NTSC has not yet been tested.

Animated Test card (TCAnim) Mode

The animated test card mode now transmits a smooth (not jerky) picture with bouncing balls. However, this is not displayed on the touchscreen (a static test card is displayed). It is not possible to encode H264 video with audio whilst also refreshing the picture on the Waveshare 3.5 inch display. If audio is switched off, the old H264 encoder is used and the animated test card is displayed.

There are some video drop-outs if TCAnim with audio is used above 2MS 7/8 FEC, or below 250 KS 7/8 FEC. At the lower SRs it is best to turn off the audio, which switches to the old H264 encoder.

Static Test Card and Contest Card

The Static Test Card (Test Card F) and the Contest numbers can only be transmitted reliably with audio at SRs of between 333 KS and 1000 KS (7/8 FEC). Select audio off to use the old (no-audio) encoder at other symbol rates.


Initial testing with a Logitech C190 webcam has given poor results, both for video (poor motion handling) and audio (intermittent). Other webcams have not yet been tested.

Further Testing

It is difficult to test all aspects of such a major change to the software before release. Please reports any problems that you find on the BATC Forum.