Enabling VOBSUB subtitles from MKV files with MEncoder

Discuss issues related to PS3 Media Server development (only for programmers)

Enabling VOBSUB subtitles from MKV files with MEncoder

Postby mlo » Mon Aug 02, 2010 10:36 pm

Since mencoder handles VOBSUB subtitles correctly, it can be enabled in PS3 Media Server with the following patch:

Code: Select all
Index: net/pms/encoders/MEncoderVideo.java
===================================================================
--- net/pms/encoders/MEncoderVideo.java   (revision 410)
+++ net/pms/encoders/MEncoderVideo.java   (working copy)
@@ -1324,10 +1324,10 @@
       if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth()) {

          if (params.sid.type == DLNAMediaSubtitle.VOBSUB) {

             // vobsub not supported in MEncoder :\

-            //cmdArray[cmdArray.length-4] = "-vobsub";

-            //cmdArray[cmdArray.length-3] = subString.substring(0, subString.length()-4);

-            cmdArray[cmdArray.length-4] = "-quiet"; //$NON-NLS-1$

-            cmdArray[cmdArray.length-3] = "-quiet"; //$NON-NLS-1$

+            cmdArray[cmdArray.length-4] = "-vobsub";

+            cmdArray[cmdArray.length-3] = subString.substring(0, subString.length()-4);

+            //cmdArray[cmdArray.length-4] = "-quiet"; //$NON-NLS-1$

+            //cmdArray[cmdArray.length-3] = "-quiet"; //$NON-NLS-1$

          } else {

             cmdArray[cmdArray.length-4] = "-sub"; //$NON-NLS-1$

             cmdArray[cmdArray.length-3] = subString.replace(",", "\\,"); // comas in mencoder separates multiple subtitles files //$NON-NLS-1$ //$NON-NLS-2$

Index: net/pms/dlna/DLNAMediaInfo.java
===================================================================
--- net/pms/dlna/DLNAMediaInfo.java   (revision 410)
+++ net/pms/dlna/DLNAMediaInfo.java   (working copy)
@@ -548,6 +548,17 @@
                            lang.lang = DLNAMediaLang.UND;

                         lang.id = subId++;

                         subtitlesCodes.add(lang);

+                     } else if (line.indexOf("Subtitle:") > -1 && line.contains("dvdsub")) {

+                        DLNAMediaSubtitle lang = new DLNAMediaSubtitle();

+                        lang.type = DLNAMediaSubtitle.VOBSUB;

+                        int a = line.indexOf("(");

+                        int b = line.indexOf("):", a);

+                        if (a > -1 && b > a) {

+                           lang.lang = line.substring(a+1, b);

+                        } else

+                           lang.lang = DLNAMediaLang.UND;

+                        lang.id = subId++;

+                        subtitlesCodes.add(lang);

                      }

                   }

                }

mlo
 
Posts: 1
Joined: Mon Aug 02, 2010 10:25 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby toxaris » Mon Aug 16, 2010 1:51 pm

How can I apply this patch to windows?
toxaris
 
Posts: 2
Joined: Sat May 15, 2010 10:23 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby toxaris » Wed Aug 18, 2010 9:45 pm

Works like a charm. :D

I just recompiled the SVN (found it in another link). Now, how do we get this patch into the svn and in the new release when it comes?
toxaris
 
Posts: 2
Joined: Sat May 15, 2010 10:23 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby ExSport » Sun Sep 12, 2010 4:38 pm

This one adds support for external .IDX/.SUB (VOBSUB) subtitles (not only embeded ones in MKV)
Files need to be in this format:
movie_name.avi
movie_name.en.idx
movie_name.en.sub

Language tag have to be in 2char format!
For now it doesn't support loading lang tag directly from .IDX. It is needed to be defined in file name directly.
Code: Select all
Index: net/pms/dlna/DLNAMediaInfo.java
===================================================================
--- net/pms/dlna/DLNAMediaInfo.java   (revision 410)
+++ net/pms/dlna/DLNAMediaInfo.java   (working copy)
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.ListIterator;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
@@ -62,6 +63,7 @@
 import org.jaudiotagger.tag.FieldKey;
 import org.jaudiotagger.tag.Tag;
 
+import com.sun.jna.Platform;
 
 
 public class DLNAMediaInfo implements Cloneable {
@@ -502,8 +506,21 @@
                               audio.bitsperSample = 32;
                            } else if (token.equals("s24")) {
                               audio.bitsperSample = 24;
+                           } else if (token.equals("s16")) {
+                              audio.bitsperSample = 16;
                            }
                         }
                      } else if (line.indexOf("Video:") > -1) {
@@ -537,9 +554,9 @@
                               } catch (NumberFormatException nfe) {}
                            }
                         }
-                     } else if (line.indexOf("Subtitle:") > -1 && !line.contains("tx3g") && !line.contains("dvdsub")) {
+                     } else if (line.indexOf("Subtitle:") > -1 && !line.contains("tx3g")) {
                         DLNAMediaSubtitle lang = new DLNAMediaSubtitle();
-                        lang.type = DLNAMediaSubtitle.EMBEDDED;
+                        lang.type = (line.contains("dvdsub")&&Platform.isWindows()?DLNAMediaSubtitle.VOBSUB:DLNAMediaSubtitle.EMBEDDED);
                         int a = line.indexOf("(");
                         int b = line.indexOf("):", a);
                         if (a > -1 && b > a) {
Index: MEncoderVideo.java
===================================================================
--- MEncoderVideo.java   (revision 410)
+++ MEncoderVideo.java   (working copy)
@@ -1323,11 +1323,17 @@
       
       if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth()) {
          if (params.sid.type == DLNAMediaSubtitle.VOBSUB) {
-            // vobsub not supported in MEncoder :\
-            //cmdArray[cmdArray.length-4] = "-vobsub";
-            //cmdArray[cmdArray.length-3] = subString.substring(0, subString.length()-4);
-            cmdArray[cmdArray.length-4] = "-quiet"; //$NON-NLS-1$
-            cmdArray[cmdArray.length-3] = "-quiet"; //$NON-NLS-1$
+            // vobsub newly supported in MEncoder from Sherpya (Windows builds only)
+            if (Platform.isWindows()) {
+               cmdArray[cmdArray.length-4] = "-vobsub";
+               cmdArray[cmdArray.length-3] = subString.substring(0, subString.length()-4);
+               cmdArray = Arrays.copyOf(cmdArray, cmdArray.length +2);
+               cmdArray[cmdArray.length-4] = "-slang"; //$NON-NLS-1$
+               cmdArray[cmdArray.length-3] = "" + params.sid.lang; //$NON-NLS-1$
+            } else {
+               cmdArray[cmdArray.length-4] = "-quiet"; //$NON-NLS-1$
+               cmdArray[cmdArray.length-3] = "-quiet"; //$NON-NLS-1$
+            }
          } else {
             cmdArray[cmdArray.length-4] = "-sub"; //$NON-NLS-1$
             cmdArray[cmdArray.length-3] = subString.replace(",", "\\,"); // comas in mencoder separates multiple subtitles files //$NON-NLS-1$ //$NON-NLS-2$
Last edited by ExSport on Thu Sep 16, 2010 4:20 pm, edited 1 time in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby drem » Tue Sep 14, 2010 10:40 pm

I don't understand. Can someone please explain "in lay-mans terms" ;) how to apply this patch? I need vobsub subs from my .mkvs. Thanks.
drem
 
Posts: 22
Joined: Wed Nov 11, 2009 10:40 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby ExSport » Thu Sep 16, 2010 4:25 pm

Patch above updated to support "long file names".
It supports embedded VOBSUB and also external ones. 8-)
@drem:
You need to recompile source code or wait if somebody will not do it for others.
But as I can see, almost nobody is interrested in this patch so it is low priority for all to do it.
Last thing to say. Support is for Windows only. What I know only Sherpya's MEncoder supports VOBSUB...
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby ExSport » Tue Jan 04, 2011 2:01 pm

Who is interested in 3D:
Use http://84.27.10.123/3DSubtitler with this patch and you can play 3D movies directly in your TV/PS3 with 3D subtitles. ;)
You only need to recompile new build with attached patch, using community build or asking for update.jar file to be built by someone 8-)
EDIT:
Working link: http://www.videohelp.com/tools/3DSubtitler
Last edited by ExSport on Fri Mar 30, 2012 8:43 pm, edited 1 time in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby dp86 » Sun Mar 13, 2011 4:58 pm

can anyone help me?

i dont know how to recompile this new build :(
dp86
 
Posts: 2
Joined: Sun Mar 13, 2011 4:54 pm

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby SubJunk » Sun Apr 24, 2011 5:11 am

dp86 wrote:can anyone help me?

i dont know how to recompile this new build :(
VOBSUB is supported in the new versions anyway so just use them :)
SubJunk
 
Posts: 1212
Joined: Fri Mar 27, 2009 5:25 am

Re: Enabling VOBSUB subtitles from MKV files with MEncoder

Postby psxgamer » Sat Mar 31, 2012 4:17 pm

ExSport wrote:Who is interested in 3D:
Use http://84.27.10.123/3DSubtitler with this patch and you can play 3D movies directly in your TV/PS3 with 3D subtitles. ;)
You only need to recompile new build with attached patch, using community build or asking for update.jar file to be built by someone 8-)
EDIT:
Working link: http://www.videohelp.com/tools/3DSubtitler


How do I use this application? The 3DSubtitler only creates two files, .sub and .xml. Neither works as subtitles, so what is the function of this program?
psxgamer
 
Posts: 24
Joined: Fri Oct 01, 2010 8:27 am

Next

Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests