MEncoder Custom Options at Renderer level

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

MEncoder Custom Options at Renderer level

Postby ExSport » Sat Oct 02, 2010 1:36 pm

Hello
Patch below will allow defining MEncoder Custom Options at renderer level so if somebody need interlacing, upscaler or adding black bars for fixing AR problems for specific renderer but not other, it is now possible 8-)
When "CustomMencoderOptions" is added to renderer.conf then it will have precedence(global settings will be ignored)

Example from TV.conf to fix Aspect Ratio problems(adding black bars when AR is not 16:9):
Code: Select all
CustomMencoderOptions=-vf softskip,expand=::::1:16\/9:2

And now the code itself (built on r410):
Code: Select all
Index: net/pms/configuration/RendererConfiguration.java
===================================================================
--- net/pms/configuration/RendererConfiguration.java   (revision 410)
+++ net/pms/configuration/RendererConfiguration.java   (working copy)
@@ -303,6 +303,27 @@
       return getBoolean(SHOW_DVD_TITLE_DURATION, false);
    }   
    
+   private static final String CUSTOM_MENCODER_OPTIONS="CustomMencoderOptions";
+
+   public String getCustomMencoderOptions() {
+      return getString(CUSTOM_MENCODER_OPTIONS, null);
+   }
+   
    private RendererConfiguration() throws ConfigurationException {
       this(null);
    }
Index: net/pms/encoders/MEncoderVideo.java
===================================================================
--- net/pms/encoders/MEncoderVideo.java   (revision 410)
+++ net/pms/encoders/MEncoderVideo.java   (working copy)
@@ -1080,9 +1080,11 @@
       }
       
       String add = ""; //$NON-NLS-1$
-      if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) { //$NON-NLS-1$
+      if (params.mediaRenderer.getCustomMencoderOptions() != null) {
+         if (params.mediaRenderer.getCustomMencoderOptions().indexOf("-lavdopts") == -1) //$NON-NLS-1$
+            add = " -lavdopts debug=0"; //$NON-NLS-1$
+      } else if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) //$NON-NLS-1$
          add = " -lavdopts debug=0"; //$NON-NLS-1$
-      }
       
       String alternativeCodec = "";//"-ac ffac3,ffdca, ";  //$NON-NLS-1$
       if (dvd)
@@ -1093,7 +1095,7 @@
          channels = wmv?2:CodecUtil.getRealChannelCount(configuration, params.aid);
       PMS.debug("channels=" + channels);
 
-      StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + configuration.getMencoderDecode() + add, " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+      StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + ((params.mediaRenderer.getCustomMencoderOptions()!=null)?(params.mediaRenderer.getCustomMencoderOptions()):configuration.getMencoderDecode()) + add, " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
       overridenMainArgs = new String [st.countTokens()];
       int i = 0;
       boolean next = false;
ExSport
 
Posts: 2167
Joined: Mon Jan 19, 2009 5:40 pm

Re: MEncoder Custom Options at Renderer level

Postby grolschie » Sat Oct 02, 2010 9:21 pm

Thanks for this. :-)
grolschie
 
Posts: 263
Joined: Thu Jun 10, 2010 7:05 am

Re: MEncoder Custom Options at Renderer level

Postby zozo221 » Tue Mar 15, 2011 11:27 pm

Hi, please I'm retard at this. What do I do to have black bars on the bottom and top of a video when I watch it on PS3, IM DESPERATE HELP ME SOMEONE
zozo221
 
Posts: 3
Joined: Mon Mar 14, 2011 8:49 pm

Re: MEncoder Custom Options at Renderer level

Postby ExSport » Wed Mar 16, 2011 10:40 pm

Nothing.
PS3 automatically computes borders and adds them to video so PS3 displays it in correct AR instead of some renderers which will squeze picture to max so no black bars are added ==> egg heads.
For this reason there is this patch which can define custom "filters" on renderer level so it can be used for specific renderer independently.
ExSport
 
Posts: 2167
Joined: Mon Jan 19, 2009 5:40 pm

Re: MEncoder Custom Options at Renderer level

Postby ExSport » Sun Apr 03, 2011 10:17 am

I made custom build with some addons so who wants test it, it is here: http://code.google.com/p/pms-exsport/
For now only Windows build is compiled, not linux one.
Add/edit these lines in renderer.conf for enabling some stuff(quality and special MEncoder options on renderer level):
Code: Select all
CustomMencoderQualitySettings=keyint=5:vqscale=1:vqmin=3:vqmax=5
CustomMencoderOptions=-vf softskip,expand=::::1:16\/9:4
ExSport
 
Posts: 2167
Joined: Mon Jan 19, 2009 5:40 pm

Re: MEncoder Custom Options at Renderer level

Postby taconaut » Thu Dec 15, 2011 12:18 pm

Hi ExSport,
I've been asked to apply your patch to pms-mlx (viewtopic.php?f=12&t=9775&start=160#p61925). As my only renderer is a ps3 I've never bothered to be able to customize mencoder options on renderer level. Do you know why this patch has never been applied to the trunk? Or if there are side effects? Seems like a good idea to me.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1065
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: MEncoder Custom Options at Renderer level

Postby ExSport » Thu Dec 15, 2011 3:13 pm

Hi. I don't know, maybe it lost with other requests or that there are so many undocummented config parameters so no will to make others 8-)
About the compatibility, there are no side effects. If you will check the code you will see that when it is not defined on renderer level, global settings is used.
When defined on renderer level, it loads this setting instead of global one so no side effect should arise.
Now fighting with GitHub....when I will be successful I will try to commit it to master trunk if they will accept it.
ExSport
 
Posts: 2167
Joined: Mon Jan 19, 2009 5:40 pm

Re: MEncoder Custom Options at Renderer level

Postby taconaut » Thu Dec 15, 2011 3:50 pm

It would be great if you could do a pull request on GitHub for it to be easily applicable to all forks; I think it would be a useful change.
I've been fighting with git as well and almost won mouhaha
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1065
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland


Return to Developers

Who is online

Users browsing this forum: Google [Bot] and 3 guests