UTF-8 characters in name of a subtitle tracks in AVI not sho
A unified display of relevant technical and tag data for A/V files
Brought to you by:
guillaumeroques,
zenitram
All the files I already saw are in local codepage, not in UTF-8.
And because AVI is created by English people, they didn't think to say wich codepage should be used!
I try to add UTF-8 support without breaking the old files in local code page.
The name of audio and video tracks are in local codepage, but the name of subtitles track (that was added later in the avi format) is in UTF-8.
I have just found a document that explain well how to handle subtitles in avi files: http://www.alexander-noe.com/video/documentation/avi.pdf
Taken from the pdf:
This section explains how to store subtitles in AVI les, so that VSFilter can be used to load and select subtitles.
One subtitle stream is stored in one single chunk. That chunk contains header data, followed by an entire SRT or SSA le. If that le is using UTF-8 encoding, the BOM should be included as well. The header is dened as follows:
char[4]; // 'GAB2'
BYTE 0x00;
WORD 0x02; // unicode
DWORD dwSize_name; // length of stream name in bytes
char name[dwSize_name]; // zero-terminated subtitle stream
name encoded in UTF-16
WORD 0x04;
DWORD dwSize; // size of SRT/SSA text file
char data[dwSize]; // entire SRT/SSA file
Stream header chunk
typedef struct {
FOURCC fccType; // "txts"
FOURCC fccHandler; // 00 00 00 00
DWORD dwFlags;
WORD wPriority;
WORD wLanguage;
DWORD dwInitialFrames;
DWORD dwScale;
DWORD dwRate; // dwRate / dwScale == duration in seconds
DWORD dwStart;
DWORD dwLength; // In units above..., should be 1
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize; // = 0 -> treated as VBR
RECT rcFrame; // 0, 0, 0, 0
} AVIStreamHeader;
I have checked the video file with a hexadecimal editor and it seems that the name is stored two times, one time using local codepage and one time in UCS-2 Little Endian.
Sorry, it isn't UCS-2 Little Endian but UTF-16 Little Endian.
Thanks for feedback.
I check it, and modify MediaInfo when I have a bit time (unfortuntly, not before 2 weeks :( )
Don't worry about the time :-D
It would be nice to see both ANSI and UTF-16LE name in MediaInfo
Here is the change to support it in VLC (maybe can help): http://git.videolan.org/?p=vlc.git;a=commitdiff;h=afaea620166c7d09f8c9a32c7e258e5d57a4c559