Opened 4 years ago

Closed 4 years ago

#707 closed enhancement (fixed)

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 (5)

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

Download all attachments as: .zip

Change History (15)

Changed 4 years ago by ami_stuff

Changed 4 years ago by ami_stuff

comment:1 Changed 4 years ago by cehoyos

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

Patch attached.

comment:2 Changed 4 years 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 4 years ago by ami_stuff

comment:3 Changed 4 years 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 4 years 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 4 years 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 4 years 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 4 years ago by ami_stuff (previous) (diff)

Changed 4 years ago by ami_stuff

Changed 4 years ago by cehoyos

comment:7 Changed 4 years ago by cehoyos

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

comment:8 Changed 4 years ago by ami_stuff

the new check is ok

comment:9 Changed 4 years ago by ami_stuff

please apply this patch

comment:10 Changed 4 years ago by cehoyos

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