Ticket #707 (closed enhancement: fixed)

Opened 18 months ago

Last modified 17 months ago

iff: support transparency

Reported by: ami_stuff Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: iff alpha
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

C:\>ffmpeg -i DpaintTitle.brush
ffmpeg version N-35295-gb55dd10, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 30 2011 00:52:52 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil    51. 29. 1 / 51. 29. 1
  libavcodec   53. 39. 1 / 53. 39. 1
  libavformat  53. 22. 0 / 53. 22. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 50. 0 /  2. 50. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[iff_byterun1 @ 020B90E0] Transparency not supported
    Last message repeated 1 times
[IFF @ 020B2320] Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from 'DpaintTitle.brush':
  Metadata:
    title           : DPaint 5 Title
    artist          : Geoffrey Rantala
    copyright       : 1994, Electronic Arts
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: iff_byterun1 (ILBM / 0x4D424C49), pal8, 275x84, SAR 44:5
2 DAR 3025:1092, 90k tbr, 90k tbn, 90k tbc
At least one output file must be specified
C:\>ffmpeg -i 1.lbm
ffmpeg version N-35295-gb55dd10, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 30 2011 00:52:52 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil    51. 29. 1 / 51. 29. 1
  libavcodec   53. 39. 1 / 53. 39. 1
  libavformat  53. 22. 0 / 53. 22. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 50. 0 /  2. 50. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[iff_ilbm @ 020B90E0] Transparency not supported
    Last message repeated 1 times
[IFF @ 020B2320] Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '1.lbm':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: iff_ilbm (PBM  / 0x204D4250), pal8, 21x21, SAR 5:6 DAR 5
:6, 90k tbr, 90k tbn, 90k tbc
At least one output file must be specified

Attachments

1.lbm Download (2.0 KB) - added by ami_stuff 18 months ago.
DpaintTitle.brush Download (6.8 KB) - added by ami_stuff 18 months ago.
test.rar Download (14.2 KB) - added by ami_stuff 18 months ago.
brown_ham8.brush Download (7.1 KB) - added by ami_stuff 18 months ago.
patchifftransparency.diff Download (1.1 KB) - added by cehoyos 18 months ago.

Change History

Changed 18 months ago by ami_stuff

Changed 18 months ago by ami_stuff

comment:1 Changed 18 months ago by cehoyos

  • Status changed from new to open
  • Reproduced by developer set
  • Component changed from undetermined to avcodec
  • Priority changed from normal to wish
  • Version changed from unspecified to git-master
  • Keywords iff alpha added
  • Type changed from defect to enhancement

Patch attached.

comment:2 Changed 18 months ago by ami_stuff

The attached patch seems to work correctly with "DpaintTitle?.brush" file, hoever it fails with iff ilbm files which I created with different background colors selected as transparent.

maybe this info will be useful:

 http://home.comcast.net/~erniew/lwsdk/docs/filefmts/ilbm.html

Changed 18 months ago by ami_stuff

comment:3 Changed 18 months ago by cehoyos

Works fine here with my patch:
ffmpeg -i brown.brush -pix_fmt rgb32 out.png
(out.png has transparent background)

comment:4 Changed 18 months ago by ami_stuff

Right, it works with -pix_fmt rgb32. I tested without it and only "dpainttitle.brush" converted with transparency.

ffmpeg -i *.brush out.png

comment:5 Changed 18 months ago by cehoyos

I fixed ffmpeg -i brown.brush out.png earlier today (unrelated to iff).

Please try to always add a failing command line (ffmpeg -i brown.brush out.png) and complete, uncut output, it makes understanding a problem much easier.

comment:6 Changed 18 months ago by ami_stuff

if (s->masking & !MASK_HAS_TRANSPARENT_COLOR != MASK_NONE) { 
av_log(avctx, AV_LOG_ERROR, "Masking not supported\n"); 
return AVERROR_PATCHWELCOME; 
} 

This check seems to fail (allow decoding) file from ticket #705, so maybe something like this:

if (s->masking && s->masking != MASK_HAS_TRANSPARENT_COLOR) {
av_log(avctx, AV_LOG_ERROR, "Masking not supported\n");
return AVERROR_PATCHWELCOME;
}

Also I have created HAM8 file with transparency (and this seems to set automaticly masking as well), but maybe it would be ok to apply this patch and experiment with HAM8 sample when masking will be supported?

Last edited 18 months ago by ami_stuff (previous) (diff)

Changed 18 months ago by ami_stuff

Changed 18 months ago by cehoyos

comment:7 Changed 18 months ago by cehoyos

Thank you for testing and suggesting a fix, new patch attached!

comment:8 Changed 18 months ago by ami_stuff

the new check is ok

comment:9 Changed 17 months ago by ami_stuff

please apply this patch

comment:10 Changed 17 months ago by cehoyos

  • Status changed from open to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.