Michel Bardiaux mbardiaux
Tue Jun 19 14:59:43 CEST 2007

Michael Niedermayer wrote:
> Hi
> On Thu, May 03, 2007 at 02:42:57PM +0200, Michel Bardiaux wrote:
>> avutil.h says:
>>      PIX_FMT_MONOWHITE, ///<        Y        ,  1bpp, 1 is white
>>      PIX_FMT_MONOBLACK, ///<        Y        ,  1bpp, 0 is black
>> That cant be right. Its probably "1 is black" as in MONOBACK(ONWHITE), 
>> but I would like independent confirmation before a patch.
> i think the comment for PIX_FMT_MONOWHITE is wrong but i could be wrong
> i didnt check
> only thing certain is that one of them is wrong ...
According to my experiments, Michael is correct, hence the patch.

What I did was to create a white JPEG with a screen capture tool, then:

ffmpeg -i white.jpg -f rawvideo -pix_fmt monowhite -y out.raw
FFmpeg version SVN-r9368, Copyright (c) 2000-2007 Fabrice Bellard, et al.
   configuration: --enable-libmp3lame
   libavutil version: 49.4.0
   libavcodec version: 51.40.4
   libavformat version: 51.12.1
   built on Jun 19 2007 14:53:12, gcc: 4.1.2 20061115 (prerelease) 
(Debian 4.1.1-21)
Input #0, image2, from 'white.jpg':
   Duration: 00:00:00.0, start: 0.000000, bitrate: N/A
   Stream #0.0: Video: mjpeg, yuvj420p, 406x274, 25.00 fps(r)
Output #0, rawvideo, to 'out.raw':
   Stream #0.0: Video: rawvideo, monob, 406x274, q=2-31, 200 kb/s, 25.00

(monob, yes, I know, see below)

Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=    1 fps=  0 q=0.0 Lsize=      14kB time=0.0 bitrate=2794.8kbits/s
video:14kB audio:0kB global headers:0kB muxing overhead 0.000000%

Actually, for the purpose of the experiment I had to hack ffmpeg.c, 
because otherwise it has codec->pix_fmt=(an illegal value) in the output 
context, apparently -pix_fmt is not honored when output is raw, that is 
a bug but another matter. (and q is irrelevant and bitrate is wrong in 
the output line, too).

So in ffmpeg.c I forced codec->pix_fmt = PIX_FMT_MONOWHITE (first) then 
BLACK before the call to avpicture_alloc near line 1608 (the one that 
triggers "Cannot allocate temp picture" if it fails.

The output file is mostly zeroes for MONOWHITE, mostly 0377 for MONOBLACK.

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: monowhite.pat
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070619/bd6cd25d/attachment.asc>

More information about the ffmpeg-devel mailing list