[FFmpeg-devel] [PATCH] avformat: remove messages that are useful for ffmpeg.c only

wm4 nfxjfg at googlemail.com
Wed Oct 29 10:12:27 CET 2014

Other applications don't have this problem. The warning is useful for
ffmpeg.c only, so it should be in ffmpeg.c.

Note that the same problem exists for e.g. Matroska, which always uses
UTF-8 for subtitles. If anyone wants to solve this properly, something
somewhere else should check whether the packets are already in UTF-8,
or add a "this is UTF-8" flag to the demuxer. Another possibility would
be rejecting any conversion from UTF-16, since that can never happen.

For now, this message is annoying and useless for non-ffmpeg.c users,
and as I understand, libav* is supposed to serve these users too.

This partially reverts commit 19a6431ec247e4842236292cc5f8cfc8f87da11e.
 libavformat/subtitles.c | 3 ---
 libavformat/subtitles.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 7f4bdef..b796df3 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -45,9 +45,6 @@ void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
             r->buf_pos += 3;
-    if (s && (r->type == FF_UTF16LE || r->type == FF_UTF16BE))
-        av_log(s, AV_LOG_WARNING,
-               "UTF16 is automatically converted to UTF8, do not specify a character encoding\n");
 void ff_text_init_buf(FFTextReader *r, void *buf, size_t size)
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index eb719ea..f2279b6 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -49,7 +49,6 @@ typedef struct {
  * Initialize the FFTextReader from the given AVIOContext. This function will
  * read some bytes from pb, and test for UTF-8 or UTF-16 BOMs. Further accesses
  * to FFTextReader will read more data from pb.
- * If s is not NULL, the user will be warned if a UTF-16 conversion takes place.
  * The purpose of FFTextReader is to transparently convert read data to UTF-8
  * if the stream had a UTF-16 BOM.

More information about the ffmpeg-devel mailing list