Some srt comments disable subtitles

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Some srt comments disable subtitles

Postby rataime » 02 Feb 2007 00:28

Hi,

I recently downloaded an mkv file (h264) which included an srt file. It usually works, except this time VLC didn't show any subtitles, only video. Here's a extract from the srt file :

Code: Select all

Dialogue: 0,0:00:00.88,0:00:04.68,Default,Narration,0000,0000,0000,,In this world, there is malice born from kindness. {FiZofqaZM73bxitGOGaBiuz41Gk4WcmqEHVIgit3Dd6da3h6r97eCMGU8AcBUiF4G2GiQ4ENB20EEkof1Fz73Zcs8k3DAe4844a0S3nEjTndsX3rbAVma0S7KgB7Z1lQTsY (broken for presentation sake) wk5t6GAo6P4yqsjOa7y0G2CrL008Aqb6S0Ij8s4Z6acZvm3bgptEJ826atKyhRgcXwSpc1BPAf8if7SSn3g0kaMj01pfCJ8484eDxoNKJ5TF9lP1czS9C7Q9SUydqn}
VLC kept throwing the error "freetype warning: unbreakable string", both on windows and OSX. People who released this video kept saying "VLC is broken, use CCCP", which is easy on OSX :roll:
As a possible fix, shouldn't VLC just ignore whatever is inside the brackets , which would be comments anyway ? Or maybe provide an option to do that ?

cnet128
New Cone
New Cone
Posts: 1
Joined: 02 Feb 2007 00:45

Postby cnet128 » 02 Feb 2007 00:52

To elaborate on this, the creators of the subtitles specifically inserted the useless comments into each line for the purpose of breaking VLC's subtitles whilst allowing other players to function correctly. It seems that they are unhappy with VLC's inability to handle formatted subtitles or comments in this format.

Why exactly VLC does not support this, I'm not sure, of course. Perhaps some people on these forums could give more of an insight, because this mini-vendetta that the creators of the subtitles have seems a little silly to me.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 02 Feb 2007 01:22

Well, because VLC subtitles handling is not so great... but everyone can fix it, the source code is open:

http://trac.videolan.org/vlc/browser/tr ... subtitle.c
is the file to modify. Start from line 753.

Developers are very busy, so give it a try.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Postby rataime » 02 Feb 2007 12:18

If it comes with a free pass to Centrale Paris, I may give it a try :D

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 02 Feb 2007 13:49

VLC is now detached from Centrale Paris... SO sorry :D
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 02 Feb 2007 23:35


rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Postby rataime » 03 Feb 2007 03:07

Okay, I've finished the patch. I just need to tweak a few thing in order to be more efficient, but my build reads correctly gg's release's subtitles.

By the way, bad idea to have 2 completely different files/functions, based on whether the sub come from an external or internal (mkv) file :?
It's quite confusing, even for you (the file j-b pointed to was for external subs, it took me some time to notice it :P )

Defiant00
New Cone
New Cone
Posts: 5
Joined: 03 Feb 2007 03:42
Contact:

Postby Defiant00 » 03 Feb 2007 03:50

Well, I've also decided to finally take the plunge and get into helping out with VLC's subtitles, so it looks like I've also fixed the same thing.

It does make me wonder, however, how you went about doing it rataime. All I did was add a couple other conditions within the main parsing so there isn't any noticeable performance hit (it compares two more characters and sets a flag whether it's within a comment)...

Anyways, I intend to submit my rendition as well. Did test it out and it handles gg's releases quite nicely though. And I agree, pointing to the file that handles external subs led me down the wrong path for a good bit there as well...was having the hardest time figuring out why my changes were having no effect.

Aaron

rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Postby rataime » 03 Feb 2007 16:04

Here's the patch I've submitted, don't hesitate to compare it to yours (I didn't see it in the mailing list)

Code: Select all

--- subsdec.c 2007-02-03 15:32:39.000000000 +0100 +++ subsdec-modif.c 2007-02-03 15:39:19.000000000 +0100 @@ -487,16 +487,19 @@ i_text++; psz_buffer_sub += 2; } - else if( psz_buffer_sub[0] == '{' && - psz_buffer_sub[1] == '\\' ) + else if( psz_buffer_sub[1] == '{' && + psz_buffer_sub[0] != '\\' ) { - /* SSA control code */ - while( psz_buffer_sub[0] != '\0' && - psz_buffer_sub[0] != '}' ) + /* We don't need to show SSA comments, so we strip them */ + psz_new_subtitle[i_text] = psz_buffer_sub[0]; + psz_buffer_sub++; + while( psz_buffer_sub[1] != '\0' && + (psz_buffer_sub[1] != '}' || + psz_buffer_sub[0] == '\\' )) { psz_buffer_sub++; } - psz_buffer_sub++; + psz_buffer_sub+=2; } else {

Defiant00
New Cone
New Cone
Posts: 5
Joined: 03 Feb 2007 03:42
Contact:

Postby Defiant00 » 03 Feb 2007 19:17

Here's mine:

Code: Select all

$ svn diff Index: modules/codec/subsdec.c =================================================================== --- modules/codec/subsdec.c (revision 18691) +++ modules/codec/subsdec.c (working copy) @@ -473,6 +473,7 @@ psz_new_subtitle = malloc( strlen( psz_buffer_sub ) + 1); i_text = 0; + vlc_bool_t b_within_comment = VLC_FALSE; while( psz_buffer_sub[0] != '\0' ) { if( psz_buffer_sub[0] == '\\' && psz_buffer_sub[1] == 'n' ) @@ -498,12 +499,28 @@ } psz_buffer_sub++; } - else + else if ( psz_buffer_sub[0] == '{' ) + { + b_within_comment = VLC_TRUE; + psz_buffer_sub++; + msg_Dbg( p_dec, "started a comment" ); + } + else if ( psz_buffer_sub[0] == '}' ) + { + b_within_comment = VLC_FALSE; + psz_buffer_sub++; + msg_Dbg( p_dec, "ended a comment" ); + } + else if ( b_within_comment == VLC_FALSE ) { psz_new_subtitle[i_text] = psz_buffer_sub[0]; i_text++; psz_buffer_sub++; } + else + { + psz_buffer_sub++; + } } psz_new_subtitle[i_text] = '\0';
I emailed the mailing list as well...but I haven't received it through the mailing list either...

Aaron

Defiant00
New Cone
New Cone
Posts: 5
Joined: 03 Feb 2007 03:42
Contact:

Postby Defiant00 » 03 Feb 2007 20:21

Just submitted it again and it worked that time...curious, but there's my patch...

rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Postby rataime » 03 Feb 2007 20:54

Actually, I recieved twice the mail. I'll wait to see if mine comes, if it doesn't i'll reply to your message.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 04 Feb 2007 19:39

Mailing-lists are moderated.
We will incorporate the patches soon. If you don't see anything coming, mail me.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 05 Feb 2007 10:57

OK. guys, both patch seems correct.
However, just a few remarks:
I think that VLC is not able to do any style (italic, color... etc..) using its freetype module (I may mistake...), so we need to discard {foo} and now also {\foo}, so to me rataime's patch is not correct, but I am not sure...
However, that would be great to support it in a near future... It needs to be watched with freetype capabilities...

http://moodub.free.fr/video/ass-specs.doc

Then, Defiant00 is easier to read...

Edit: AFAIK, freetype's module can support font size, relative front-size, color, outlining, but not sure about italic and bold...
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

rataime
New Cone
New Cone
Posts: 8
Joined: 02 Feb 2007 00:15

Postby rataime » 05 Feb 2007 13:59

Actually, my patch strips :

{foo}
{\foo}
but not
\{foo\}

The ayeses-specs says :
The text can include \n codes which is a line break, and can include Style Override control codes, which appear between braces { }.
but say nothing about using \{ as a character, so I guess Defiant00 is more correct. He uses an additionnal flag (1 byte ! We're doomed !), which could be useful if we implemented styles.
Just one thing : I think checking for a \n, and checking for a comment should be switched in his code : there should be no line break inside comments, but there could be commands starting with n (I don't know, \no-color or whatever. Better safe than sorry)


EDIT : Note that the devs of Mplayer use something called libass, which is quite advanced, and according to them quasi-independent (Avidemux2 uses it as well). I've looked through the code, and it appears that it is Freetype-based too. A lead ?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 05 Feb 2007 14:51

Yes, I have seen that too... Can we use it ? Good question...
It is in mplayer trunk, and difficult to read...
http://svn.mplayerhq.hu/mplayer/trunk/libass/

mmm... Good remark about \n

And we should implement the missing styles in the future...
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

cma
Blank Cone
Blank Cone
Posts: 11
Joined: 06 Feb 2007 06:24
Location: Vancouver, BC, Canada

Postby cma » 06 Feb 2007 06:38

hey rataime and defiant00

please conitnue help j-b as developer.... we are very grateful you.


viewtopic.php?p=9872 - my rant about mkv and ogm
sorry about my bad english

orenji-kun
New Cone
New Cone
Posts: 1
Joined: 05 Feb 2007 07:19

Postby orenji-kun » 07 Feb 2007 15:07

Glad to see that after preaching "softsubs + VLC = no" for so long that a practical example in releases seemed to help development. To our knowledge, as well as various people we have asked to test with mplayer on mac and nix before release, libass included with mplayer supports the typesetting stuff we use to break VLC. So libass is certainly a step in the right direction. May I also introduce you to ASA? It too uses Free Type.

PrometheusG
New Cone
New Cone
Posts: 7
Joined: 15 Jan 2007 09:24

html tags, too

Postby PrometheusG » 09 Feb 2007 03:17

How about stripping out html tags, too? subrip files can contain lots of <i> and <font color=#ffffff> type tags that VLC just renders as plain text right now. Stripping them out could be a little tricky, but I've got faith in you guys.

I don't know much about the internal workings of VLC, but it sounds like you use freetype to render the subtitles? I guess getting the html tags to render would require converting all the various subtitle formats to some common internal format that freetype would use to render them. Sounds like a lot of work.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 09 Feb 2007 08:35

PrometheusG, please come and code. this should not be too difficult either.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 20 guests