[x264-devel] Evaluating x264 -- first steps encoding greylevel images

Eeri Kask Eeri.Kask at inf.tu-dresden.de
Fri Mar 12 14:20:06 CET 2010


Hello,

being new to x264 and just a moment ago subscribed to this list let
me describe some issues I got stuck with while starting learning
x264 (and h264 in general).

I have a task to encode some intermediate numerical simulation image
data for efficient storage and later review. ("Efficient" storage in
the sense of replacing thousands of PNG frame files by a single,
preferrably lossless, or at least a "high-quality" video file.)
Having completed the simulation, in order to avoid manually recoding
these PNG files into a H264 file it would be purposeful to put some
x264-interface glue code to into that above simulation program in
order to create the H264 file on the fly.

So I investigated x264 a little and undertook some experimentation;
in particular, taking the x264.c source file as a learning sample I
tried to spot and extract the essential core parts in order to
achieve the following.  Given a file of stored raw 8-bit greylevel
data (the raw-file size is the number-of-frames times frame width
times frame height in bytes), then read this file from stdin and
output h264 stream into stdout.  The frame rate and frame size are
expected on the command line.  Let me attach the 90-line C source of
this tiny first application here as "Grey8_to_H264.c" which should
do exactly that.

Having compiled, the simplest use case for that small tool is
probably this:

    dd if=/dev/random count=100 bs=15000  \
            |  grey8_to_h264 10 150 100  >  random.h264

The first part creates 100 frames sized 150x100 of greylevel
random-noise, and the resulting h264 stream is stored in random.h264
as a 10 fps raw-video.

The problem with the above tool is, it either crashes x264, or sends
it into a possibly never-ending loop; depending if the only '#if 1'
in the above source is '1' or '0'.  I am using the latest git-source
of x264.

May I kindly ask anybody knowledgeable to give a quick look at this
source code to point out if there is some obvious problem with it;
and how it should be changed in order to complete the posed task...


Huge thanks in advance for any comments and suggestions,

    Eeri Kask


P.S. Compiling the above source against some considerably older x264
of 2009, it completes as expected but if then creating mp4 container
around random.h264 by

    MP4Box -add random.h264 -fps 10 -keep-sys -flat random.h264.mp4

then a mp4-stream with an interesting frame-size (probably due to
crf = 0 above) is created:

  AVC-H264 import - frame size 90 x -52 at 10.000 FPS
  Import results: 85 samples - Slices: 30 I 71 P 0 B - 2 SEI - 4 IDR
  Saving random.h264.mp4: Flat storage

but this is probably a completely different issue, unrelated to x264.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Grey8_to_H264.c
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20100312/04c64494/attachment.txt>


More information about the x264-devel mailing list