[FFmpeg-devel] DVR MPEG4 variant (AS-3024)

Ivo Andonov ivo.andonov at gmail.com
Fri Feb 3 15:46:20 EET 2017

Hi Everyone,

This is my first post here. Actually my first post to a mailing list.
Excuse me if this is the wrong place to write or if my mailing-list culture
is not complete!

I've got some old Pinetron DVRs that are supposed to produce a MPEG4
bitstream. Indeed they are but no non-Pinetron software can decode it.
While changing the realtime clock battery on one of these I saw they are
using the AS-3024 SoC. Any information about it is quite rare and hard to
find. What I found in a kind of a brochure is the "Modified ISO/IEC
14496/2" statement.

I successfully used a modified Pinetron library on Windows to use my own
software for decoding the stream. While fiddling with the modification I
saw they are using the statically linked FFmpeg API.

Out of curiosity and wanting to have this codec implementation on the Linux
platform to automate some tasks I digged deeper in order to understand the
decoder difference in respect to the standards. The codec name they use is

Finally there's the result and I wanted to share it with the comunity in
case someone is interested or if one wants to use it for its own project.

In short, what I did is modify libavcodec/mpeg4video.h, ff_mpeg4_pred_dc
function and add the lines of code below right after the a, b, c vars being
initialized and instead of the block of code that sets the pred var.

      if (n == 0 || n == 4 || n == 5) pred = 1024; else
      if (n == 1) pred = a; else
      if (n == 2) pred = c; else
      if (n == 3) {
        if (abs(a - b) < abs(b - c)) {
          pred     = c;
        } else {
          pred     = a;

I do now know what is the best approach for registering this as a new
decoder and then having the above block within a condition. What I came up
with is adding a new AVCodec to the mpeg4videodec.c file and modifying the
decode_init to set a flag in AVCodecContext.workaround_bugs field that can
later be used to condition the above block.


More information about the ffmpeg-devel mailing list