MPEG4 Encoder (i.MX31)

Aus BECOM Systems Support
Version vom 31. Oktober 2023, 09:03 Uhr von Peter (Diskussion | Beiträge) (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Create an example application

To be able to successfully compile an example MPEG4 Video retrieving application you need to perform the following steps:

  * Get the files basetype.h, cam2mpeg4_vga.c and mp4encapi.h and memalloc.h from Christian Dumhart.
  * Get the file libmpeg4enc.a from the package hantro-binary which can be found after an ltib installation in ltib/pkgs/hantro-binary. This is the main library which accesses all the functions of the MPEG4Encoder and so provides a layer of abstraction.
  * Place all these files into the same directory
  * run the following command to create a binary named cam2mpeg4
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc -static cam2mpeg4_vga.c -L. -lmpeg4enc -lpthread -o cam2mpeg4

The MPEG4 Format

A MP4 file basically is a container. It is built from so called Atoms. Whereas some of them are optional, some others are mandatory. Atoms can have other atoms as children. By using this structure a tree is built from these atoms. Some normal MP4 file contains about 20-30 atoms. It usually has the ending .MP4.

The Hantro MPEG4Encoder API returns a stream of frames which are basically separated through the VOP_START Marker (Hex: 00 00 01 B6). The MPEG4 Encoder Api in MPEG4_SIMPLE_PROFILE mode also returns some sort of header which appears to be incorrect (or at least it is not a standard MPEG4 Header).

A tool which can create a correct MPEG4 header for a specific file is named MP4Creater (https://www.mpeg4id.com). This tool simply reads the available frames and creates a header with the correct atoms. Both, the file which is created by this tool and the original file can be read by using MPlayer with gstreamer as backend (xine will not work) in a normal linux installation.

When setting the H.263 compliant mode of the encoder API the Encoder generates a .263 file, which can directly be played in windows using VLC (https://www.videolan.org).

Depending on your requirements you might want to choose one way or the other. Of course you could also directly implement your MP4 Atom tree.

Documentation for the Hantro MPEG4 Encoder can be found in the hantro-binary package mentioned above.