[FFmpeg-trac] #2431(avcodec:new): Detect if subtitle streams do not contain valid utf-8

FFmpeg trac at avcodec.org
Tue Apr 9 23:39:56 CEST 2013


#2431: Detect if subtitle streams do not contain valid utf-8
-------------------------------------+-----------------------------------
             Reporter:  Nick         |                    Owner:
                 Type:  enhancement  |                   Status:  new
             Priority:  wish         |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  sub srt      |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-----------------------------------

Comment (by Nick):

 The subtitles character encoding conversion works now correctly with the
 bug fix of the "''last char''" problem. I tested the last Windows build of
 FFmpeg and "'''-sub_charenc'''" works now as expected! (without the UTF-8
 auto detection!)

 Windows build version tested:
 http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20130408-git-9dc88ac-
 win32-static.7z

 [[BR]]
 == Short summary for other users: ==


 If you want to import a plaintext subtitle file including special
 characters with ffmpeg/avcodec, then...
 - ffmpeg/avcodec must be built with "'''--enable-iconv'''"
 - option "'''-sub_charenc [''code page'']'''" is needed to enable the
 subtitles character encoding conversion for subtitle source files
 - libavcodec version should be at least libavcodec 55.2.100 of 8th April
 2013 or newer

 (e.g. import of Windows ANSI *.srt/*.ass/*.ssa subtitle files with German,
 French or other special characters)

 '''Command line examples'''

 Import a subtitle file (copy video/audio streams, without re-encoding):
 {{{
 ffmpeg -i input.mp4 -sub_charenc ISO8859-1 -i subtitle.srt -map 0:v -map
 0:a -c copy -map 1 -c:s:0 mov_text -metadata:s:s:0 language=ger output.mp4

 ffmpeg -i input.mkv -sub_charenc ISO-8859-1 -i subtitle.srt -map 0:v -map
 0:a -c copy -map 1 -c:s:0 srt -metadata:s:s:0 language=fre output.mkv

 }}}

 Import subtitle and re-encode video/audio streams:
 {{{
 ffmpeg -i input.avi -sub_charenc CP1252 -i subtitle.srt -vcodec h264
 -acodec ac3 -scodec ass -metadata:s:s:0 language=ita output2.mkv

 ffmpeg -i input.mov -sub_charenc WINDOWS-1252 -i subtitle.srt -vcodec
 mpeg4 -acodec mp3 -scodec mov_text -metadata:s:s:0 language=spa
 output2.mp4

 }}}

 (''code page'' parameters for option '''-sub_charenc''' see
 [https://ffmpeg.org/trac/ffmpeg/attachment/ticket/2431/sub_charenc_parameters.txt
 attachment])

 Additional notice:
 Different Philips stand-alone Blue-Ray players and Samsung TV's can read
 "'''SRT'''" subtitle streams in "'''mkv'''" files.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2431#comment:23>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list