Opened 13 years ago
Last modified 13 years ago
#946 open defect
ffplay: almost unreadable dvd subtitles due to wrong colors
Reported by: | ami_stuff | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | dvdsub |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
http://www.datafilehost.com/download-76a1c6a8.html
related to:
commit cf16104ad13f6c558ea386e5fa55a67e2b378f5e Author: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Date: Sat Apr 30 23:00:17 2011 +0200 Change guess_palette so its output matches the most common palette. This means it uses full brightness range and brightness increasing instead of decreasing with index of non-opaque color. Based on patch by Alexandre Colucci [alexandre elgato com] diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index bb3e124..6d5973c 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -120,6 +120,14 @@ static void guess_palette(uint32_t *rgba_palette, uint8_t *alpha, uint32_t subtitle_color) { + static const uint8_t level_map[4][4] = { + // this configuration (full range, lowest to highest) in tests + // seemed most common, so assume this + {0xff}, + {0x00, 0xff}, + {0x00, 0x80, 0xff}, + {0x00, 0x55, 0xaa, 0xff}, + }; uint8_t color_used[16]; int nb_opaque_colors, i, level, j, r, g, b; @@ -138,18 +146,18 @@ static void guess_palette(uint32_t *rgba_palette, if (nb_opaque_colors == 0) return; - j = nb_opaque_colors; + j = 0; memset(color_used, 0, 16); for(i = 0; i < 4; i++) { if (alpha[i] != 0) { if (!color_used[colormap[i]]) { - level = (0xff * j) / nb_opaque_colors; + level = level_map[nb_opaque_colors][j]; r = (((subtitle_color >> 16) & 0xff) * level) >> 8; g = (((subtitle_color >> 8) & 0xff) * level) >> 8; b = (((subtitle_color >> 0) & 0xff) * level) >> 8; rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17) << 24); color_used[colormap[i]] = (i + 1); - j--; + j++; } else { rgba_palette[i] = (rgba_palette[color_used[colormap[i]] - 1] & 0x00ffffff) | ((alpha[i] * 17) << 24);
C:\>ffmpeg -i dvdsub.vob ffmpeg version N-36890-g67f5650 Copyright (c) 2000-2012 the FFmpeg developers built on Jan 16 2012 21:57:13 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. 34.100 / 51. 34.100 libavcodec 53. 56.105 / 53. 56.105 libavformat 53. 30.100 / 53. 30.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 59.100 / 2. 59.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 libpostproc 51. 2.100 / 51. 2.100 [mpeg @ 020F2320] max_analyze_duration 5000000 reached at 5000000 Input #0, mpeg, from 'dvdsub.vob': Duration: 00:00:07.96, start: 1556.319267, bitrate: 5263 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DA R 16:9], 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0:2[0x20]: Subtitle: dvd_subtitle Stream #0:3[0x22]: Subtitle: dvd_subtitle Stream #0:4[0x24]: Subtitle: dvd_subtitle Stream #0:5[0x25]: Subtitle: dvd_subtitle Stream #0:6[0x26]: Subtitle: dvd_subtitle Stream #0:7[0x28]: Subtitle: dvd_subtitle Stream #0:8[0x29]: Subtitle: dvd_subtitle Stream #0:9[0x21]: Subtitle: dvd_subtitle Stream #0:10[0x23]: Subtitle: dvd_subtitle Stream #0:11[0x27]: Subtitle: dvd_subtitle Stream #0:12[0x2a]: Subtitle: dvd_subtitle At least one output file must be specified
Change History (2)
comment:1 by , 13 years ago
Component: | undetermined → avcodec |
---|---|
Keywords: | dvdsub added |
Status: | new → open |
Version: | unspecified → git-master |
comment:2 by , 13 years ago
Note:
See TracTickets
for help on using tickets.
To decode DVD subtitles correctly you need to provide the palette.
For DVDs the palette is in the IFO file.
FFmpeg the application does not support making use of IFO files currently.
The patch was checked against my DVD collection to generate better looking subtitles than the previous code for almost all.
It would be possible to make the code do more elaborate guessing, but it will always be guessing and there will be cases where it gets it wrong.