Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

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

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby shagrath » Thu Oct 22, 2009 11:01 pm

something like this:

Code: Select all
### Eclipse Workspace Patch 1.0
#P ps3mediaserver
Index: net/pms/PMS.java
===================================================================
--- net/pms/PMS.java   (revision 363)
+++ net/pms/PMS.java   (working copy)
@@ -694,6 +694,15 @@
             }
          });
          
+         vf.addChild(new VirtualVideoAction("  !!-- Fix 23.976/25fps A/V Mismatch --!!", PMS.getConfiguration().isFix25FPSAvMismatch()) { //$NON-NLS-1$
+            public boolean enable() {
+               PMS.getConfiguration().setMencoderForceFps(!PMS.getConfiguration().isFix25FPSAvMismatch());
+               PMS.getConfiguration().setFix25FPSAvMismatch(!PMS.getConfiguration().isFix25FPSAvMismatch());
+               return PMS.getConfiguration().isFix25FPSAvMismatch();
+            }             
+         });
+         
+         
          vf.addChild(new VirtualVideoAction(Messages.getString("PMS.4"), configuration.isMencoderYadif()) { //$NON-NLS-1$
             public boolean enable() {
                configuration.setMencoderYadif(!configuration.isMencoderYadif());
Index: net/pms/configuration/PmsConfiguration.java
===================================================================
--- net/pms/configuration/PmsConfiguration.java   (revision 362)
+++ net/pms/configuration/PmsConfiguration.java   (working copy)
@@ -115,6 +115,7 @@
    private static final String KEY_CHAPTER_SUPPORT = "chapter_support";
    private static final String KEY_CHAPTER_INTERVAL = "chapter_interval";
    private static final String KEY_SUBS_COLOR = "subs_color";
+   private static final String KEY_FIX_25FPS_AV_MISMATCH = "fix_25fps_av_mismatch";
    private static final int DEFAULT_SERVER_PORT = 5001;
    private static final int DEFAULT_PROXY_SERVER_PORT = -1;
    private static final String UNLIMITED_BITRATE = "0";
@@ -1078,4 +1079,12 @@
    public void setSubsColor(int value) {
       configuration.setProperty(KEY_SUBS_COLOR, value);
    }
+   
+   public boolean isFix25FPSAvMismatch() {
+      return getBoolean(KEY_FIX_25FPS_AV_MISMATCH, false);
+   }
+   
+   public void setFix25FPSAvMismatch(boolean value) {
+      configuration.setProperty(KEY_FIX_25FPS_AV_MISMATCH, value);
+   }
 }
Index: net/pms/encoders/TSMuxerVideo.java
===================================================================
--- net/pms/encoders/TSMuxerVideo.java   (revision 361)
+++ net/pms/encoders/TSMuxerVideo.java   (working copy)
@@ -392,6 +392,9 @@
             String videoparams = "level=4.1, insertSEI, contSPS, track=1"; //$NON-NLS-1$
             if (this instanceof TsMuxerAudio)
                videoparams = "track=224"; //$NON-NLS-1$
+            if (configuration.isFix25FPSAvMismatch()) {
+               fps = "25";
+            }
             pw.println(videoType + ", \"" + ffVideoPipe.getOutputPipe() + "\", "  + (fps!=null?("fps=" +fps + ", "):"") + videoparams); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
          }
          if (ffAudioPipe != null && ffAudioPipe.length == 1) {
Index: net/pms/encoders/MEncoderVideo.java
===================================================================
--- net/pms/encoders/MEncoderVideo.java   (revision 361)
+++ net/pms/encoders/MEncoderVideo.java   (working copy)
@@ -1266,7 +1266,7 @@
       cmdArray[cmdArray.length-8] = "-quiet"; //$NON-NLS-1$
       cmdArray[cmdArray.length-7] = "-quiet"; //$NON-NLS-1$
       
-      if (configuration.isMencoderForceFps()) {
+      if (configuration.isMencoderForceFps() && !configuration.isFix25FPSAvMismatch()) {
          cmdArray[cmdArray.length-8] = "-fps"; //$NON-NLS-1$
          cmdArray[cmdArray.length-7] = "24000/1001"; //$NON-NLS-1$
       }
@@ -1278,8 +1278,15 @@
       }
       if (frameRate != null) {
          cmdArray[cmdArray.length-5] = frameRate;
-         if (configuration.isMencoderForceFps())
-            cmdArray[cmdArray.length-7] = cmdArray[cmdArray.length-5];
+         if (configuration.isMencoderForceFps()) {
+            if (configuration.isFix25FPSAvMismatch()) {
+               cmdArray[cmdArray.length-8] = "-mc";
+               cmdArray[cmdArray.length-7] = "0.005";
+               cmdArray[cmdArray.length-5] = "25";
+            } else {
+               cmdArray[cmdArray.length-7] = cmdArray[cmdArray.length-5];
+            }
+         }
       }
       
       if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth()) {
@@ -1448,6 +1455,10 @@
          cmdArray[cmdArray.length-5] = "-mc"; //$NON-NLS-1$
          cmdArray[cmdArray.length-4] = "0"; //$NON-NLS-1$
          cmdArray[cmdArray.length-3] = "-noskip"; //$NON-NLS-1$
+         if (configuration.isFix25FPSAvMismatch()) {
+            cmdArray[cmdArray.length-4] = "0.005"; //$NON-NLS-1$
+            cmdArray[cmdArray.length-3] = "-quiet"; //$NON-NLS-1$
+         }
       }
       
       if (params.timeend > 0) {


and yes, it's working fine with the czech sample you sent me months ago :)
the Fix A/V interactive setting is also better placed among others in #video settings#
shagrath
Project Lead
 
Posts: 2668
Joined: Wed Jan 14, 2009 1:39 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby ExSport » Thu Oct 22, 2009 11:21 pm

Hi Shagrath :)
Yes at the top it is best to be placed but didn't found solution how to do it. Because when you will play first track (tsMuxer), after end it will enable this feature because it is in a row as next video :?
About tsMuxeR_ForceFPS, it is disabled in latest betas in default or not? Anyway first usage of this feature will disable it so no side effect will be visible :mrgreen:
Also why to enable forceFPS for tsMuxeR? My code do auto detection of framerate(your part of code) and use this detected fps(23.976/25/29.997) but in case the feature is enabled it will force 25fps. When disabled, again it will use autodetection.
So I suppose no side effect for anybody :)
But thanks for your MOD, I will check your changes what they do exactly :mrgreen:
Many thanks for great work!!!
P.S.
I tried to do it as separate plugin but too hard for my java knowledge :mrgreen:
I had working plugin code but any change in PMS code itself will need new plugin version so it is useless so I discarded this solution for now...
Last edited by ExSport on Thu Oct 22, 2009 11:25 pm, edited 1 time in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby shagrath » Thu Oct 22, 2009 11:25 pm

yes actually the tsmuxer_forcefps parameter is not used anymore, that's why I choosed not to keep this part of your patch... I will remove it definitely
thanks for the help :p
shagrath
Project Lead
 
Posts: 2668
Joined: Wed Jan 14, 2009 1:39 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby ExSport » Thu Oct 22, 2009 11:26 pm

Yes, because that I used it and also disabled its configuration via GUI 8-)
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby saigax » Wed Dec 30, 2009 5:09 am

I installed this, but now my media server doesn't recognize my PS3, as a ps3 instead it recognizes it as an unknown renderer. Another note it did however completely fix my syncing problem. I'm fairly new to this program, so are there any downsides to replacing the files in the pms directory with those linked, other than the fact It recognizes my ps3 as unknown?
saigax
 
Posts: 2
Joined: Wed Dec 30, 2009 5:06 am

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby escobar090 » Thu Dec 31, 2009 11:05 pm

whats FixAVSync.patch needed for???

I just replaced pms.jar, thats all i need to do??
escobar090
 
Posts: 4
Joined: Tue Dec 29, 2009 11:07 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby Vanshy » Fri Jan 01, 2010 4:11 pm

Like "saigax" i got the same... but i'm trying this with a xbox360 'coz the rmvb files are a total video/audio - mess.
My device it's not recogniced but the program said "..something's there, give it a try"; then the console found the PS3MS but when I tried the videos I just got "no videos found" message.
I'm with the original pms.jar and things are back to normal, just... out of sync.
Happy New Year everybody!!!
Vanshy
 
Posts: 4
Joined: Fri Jan 01, 2010 4:05 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby ExSport » Fri Jan 01, 2010 5:50 pm

I never had problems you described as unknown renderer 8-)
Always my PS3 was detected correctly.
Also never had problems with "no video found".
I will create updated version from latest r369 or r372 but if you want A/V fix only, it is already in official version under #VIDEO SETTINGS# folder ;)
But I think it will not fix you your problem because this patch is intended to fix different fps ;)
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby ExSport » Sun Jan 03, 2010 1:02 am

Put update.jar file next to pms.jar and download latest mplayer+mencoder+mencoder_mt+ffmpeg and copy it to win32 dir (don't know where it is on Linux)
In win32 dir there is mplayer.exe file. Put some video file on it so mplayer will start to create font cache(it is needed to be done only once for every new mplayer version)
Start pms.exe or in command line with this:
Code: Select all
start javaw -Xmx1300M -Djava.net.preferIPv4Stack=true -Djava.encoding=UTF-8 -classpath update.jar;pms.jar;plugins/*;plugins net.pms.PMS

Latest mplayer/mencoder/mencoder_mt/ffmpeg versions:
MENCODER_MT.EXE (Use mencoder.exe only from this pack and rename it to mencoder_mt.exe)
ffmpeg-mt based MPlayer/MEncoder svn rev 29319 - 05/25/2009
MENCODER.EXE + MPLAYER.EXE:
MPlayer/MEncoder svn rev 30075 - 12/20/2009
FFMPEG.EXE:
FFmpeg svn rev 20900 - 12/20/2009

What is new from latest r372 (you need to install this version before using update.jar: viewtopic.php?f=2&t=919&start=620#p22044 - also test new installation alone before applying my patch to eliminate problems not related to this patch ;)
Code: Select all
- forced subtitle support
- additional subtitle info (displayed in TRANSCODE folder) [latest ffmpeg.exe needed!!!]
- fix for streaming to 2 ?same? renderers at the same time(removed PINGing which generated shuttering)
- !!-- Fix 23.976/25fps A/V Mismatch --!! option directly in TRANSCODE folder
- automatic sync/audio delay fix (added -mc 0.005 and removed -noskip option)

How to set forced subs loading? Check: viewtopic.php?f=2&t=4140&hilit=forced&start=10#p19221

And finally UPDATE.JAR file included in attached .ZIP + added .PATCH file (file which describes what was changed)
Attachments
update.jar.zip
Update.jar file built from r372
(154.84 KiB) Downloaded 251 times
Last edited by ExSport on Mon Jan 04, 2010 12:33 pm, edited 6 times in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: Fix A/V Sync code : Fix 23.976/25fps A/V Mismatch

Postby escobar090 » Sun Jan 03, 2010 4:13 am

@ ExSport

I did everything you said right there but mencoder_mt still crashes, I just dont know what could it be.

Regarding to update.jar? what do i do with it???? I entered in cmd.exe the following

Code: Select all
start javaw -Xmx1300M -Djava.net.preferIPv4Stack=true -Djava.encoding=UTF-8 -classpath update.jar;pms.jar;plugins/*;plugins net.pms.PMS


and then PSM opened. I then checked multicore support.... and along with it, mencoder_mt crashes
The only way to make it work is to keep uncheked multicore support for H264 content but the problem is everytime i watch a movie i need to load the buffer for about 15 minutes then the buffer "drains" then load it again, its kinda annoying for a 8gb movie it can take you up to 3 hours to watch an 1:30 hour movie.


I hope there is a solution for my problem
thanks in advance
escobar090
 
Posts: 4
Joined: Tue Dec 29, 2009 11:07 pm

PreviousNext

Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests