[FFmpeg-devel] [PATCH] lavc: make invalid UTF-8 in subtitle output a non-fatal error

wm4 nfxjfg at googlemail.com
Wed Jun 26 01:20:34 CEST 2013


The intention of this error was preventing the generation of broken
files. But in practice, dropping the output is not very helpful.

Consider a subtitle file that contains mostly ASCII, but has some
lines that use special characters (like umlauts or accents) encoded
in a legacy codepage. Then most lines will be intact in the output
file, but lines with broken encoding will be missing. The user might
not even see the error, and it will appear as if the subtitle line
was missing in the original subtitle file. Surely it's better to
keep these broken lines, and most of the subtitle text will probably
still be readable.

Keeping the broken output will also make it easier for the user to
locate the error, such as by knowing the subtitle event time.
---
 libavcodec/utils.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 97d066f..14a3b5f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2288,8 +2288,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
                     av_log(avctx, AV_LOG_ERROR,
                            "Invalid UTF-8 in decoded subtitles text; "
                            "maybe missing -sub_charenc option\n");
-                    avsubtitle_free(sub);
-                    return AVERROR_INVALIDDATA;
                 }
             }
 
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list