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

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

Re: New A/V Sync Plugin : How to detect used "Resource folder"?

Postby ExSport » Mon Aug 17, 2009 9:15 pm

Many thanks :)
And it is possible to automatically reset it back when folder is left(user will browse outside this folder)?
Thx
P.S.
Also bad that it is not possible to do it as standalone plugin I suppose because I need to modify MEncoderVideo.java, TSMuxerVideo.java and FileTranscodeVirtualFolder.java, right?
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : How to detect used "Resource folder"?

Postby ExSport » Mon Aug 17, 2009 10:34 pm

I got it working in way without external plugin and without reverting back temporal setting of forced 25fps.
So 50% happy because original code have to be modified = plugin version not possible.
Thanks 8-)
At the beginning I tried to do it as plugin and also in way:
- when "special" folder is left, temporal forced 25fps is reseted/reverted
- when forced 25fps is enabled by virtual file(for changing settings) in TRANSCODE subfolders, it will be reverted back when actual folder is left.
But better something than nothing :mrgreen:
Many thanks again for help ;)

New code without plugin support:
Code: Select all
Index: FileTranscodeVirtualFolder.java
===================================================================
--- FileTranscodeVirtualFolder.java   (revision 356)
+++ FileTranscodeVirtualFolder.java   (working copy)
@@ -20,6 +20,7 @@
 
 import net.pms.PMS;
 import net.pms.dlna.virtual.VirtualFolder;
+import net.pms.dlna.virtual.VirtualVideoAction;
 import net.pms.encoders.MEncoderVideo;
 import net.pms.encoders.Player;
 import net.pms.encoders.TSMuxerVideo;
@@ -41,6 +42,16 @@
          if (child.ext.getProfiles() != null) {
             DLNAResource ref = child;
             Player tsMuxer = null;
+            DLNAResource virtfix = child;
+            virtfix = new VirtualVideoAction(" !!-- FIX A/V Sync --!!", PMS.getConfiguration().isMencoderForceFps()) { //$NON-NLS-1$
+                   public boolean enable() {
+                       PMS.getConfiguration().setMencoderForceFps(!PMS.getConfiguration().isMencoderForceFps());
+                       PMS.getConfiguration().setTsmuxerForceFps(PMS.getConfiguration().isMencoderForceFps());
+                       return PMS.getConfiguration().isMencoderForceFps();
+                   }             
+            };
+            children.add(virtfix);
+            virtfix.parent = this;
             for(int i=0;i<child.ext.getProfiles().size();i++) {
                Player pl = PMS.get().getPlayer(child.ext.getProfiles().get(i), child.ext);
                if (pl !=null && !child.player.equals(pl)) {

Code: Select all
Index: net/pms/encoders/MEncoderVideo.java
===================================================================
--- net/pms/encoders/MEncoderVideo.java   (revision 356)
+++ net/pms/encoders/MEncoderVideo.java   (working copy)
@@ -1239,10 +1239,10 @@
      cmdArray[cmdArray.length-8] = "-quiet"; //$NON-NLS-1$
      cmdArray[cmdArray.length-7] = "-quiet"; //$NON-NLS-1$
     
-      if (configuration.isMencoderForceFps()) {
-         cmdArray[cmdArray.length-8] = "-fps"; //$NON-NLS-1$
-         cmdArray[cmdArray.length-7] = "24000/1001"; //$NON-NLS-1$
-      }
+//      if (configuration.isMencoderForceFps()) {
+//         cmdArray[cmdArray.length-8] = "-fps"; //$NON-NLS-1$
+//         cmdArray[cmdArray.length-7] = "24000/1001"; //$NON-NLS-1$
+//      }
      cmdArray[cmdArray.length-6] = "-ofps"; //$NON-NLS-1$
      cmdArray[cmdArray.length-5] = "24000/1001"; //$NON-NLS-1$
      String frameRate = null;
@@ -1252,7 +1252,7 @@
      if (frameRate != null) {
         cmdArray[cmdArray.length-5] = frameRate;
         if (configuration.isMencoderForceFps())
-            cmdArray[cmdArray.length-7] = cmdArray[cmdArray.length-5];
+            cmdArray[cmdArray.length-5] = "25";
      }
     
      if (subString != null && !configuration.isMencoderDisableSubs() && !avisynth()) {

Code: Select all
Index: net/pms/encoders/TSMuxerVideo.java
===================================================================
--- net/pms/encoders/TSMuxerVideo.java   (revision 356)
+++ 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.isTsmuxerForceFps()) {
+               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) {

EDIT:
Precompiled pms.jar file (used latest r356) (packed with http://www.7zip.org) : http://www.megaupload.com/?d=EHYXE5UL
Last edited by ExSport on Fri Oct 16, 2009 6:05 pm, edited 2 times in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby karine123 » Tue Aug 18, 2009 4:27 pm

great job my friend , this should be included in the next futures versions of pms by shagrath , that will help lot of users for a/v synchro issues , specially in france as more and more mkvs are badly remuxed by users (sound comes from dvds and not resampled in 23.97)

thx again
karine123
 
Posts: 91
Joined: Sat Apr 25, 2009 10:30 am

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby ExSport » Wed Aug 19, 2009 7:17 pm

jaqb please could you answer my question?
- Is it possible to do same as I did with modifying core PMS code as standalone plugin?
- Is it possible to revert temporal settings to force 25fps when current folder is left? It means forced 25fps will be disabled when other than current directory will be browsed?
Thx ;)
P.S.
But I suppose due to client caching of browsed tree it is not possible...
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby jaqb » Wed Aug 19, 2009 11:21 pm

I think Yes for both....but to be sure please post a sample video with this issue for me to test. I have an idea...
HD YouTube on PS3 -> PS3 Youtube :D Are you a F1 fan ? Check out F1Reader.com
jaqb
 
Posts: 163
Joined: Tue Jan 27, 2009 11:50 am

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby ExSport » Wed Aug 19, 2009 11:26 pm

:) Here it is: http://www.megaupload.com/?d=ZH2ZC0I1
23.976 fps is english DTS
25 fps is czech AC3
video is 23.976
With patch posted here czech audio is synced and also picture is not shuttering :mrgreen:
Also I disabled Alternate method of A/V sync which will add -mc 0 -noskip which sometimes leads to shuttering and when audio use delay it is not synced.
This behavior can be fixed by disabling this alternate method and adding -mc 0.005 instead of it 8-)
Thx
Last edited by ExSport on Sat Sep 12, 2009 7:52 am, edited 1 time in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby ExSport » Wed Aug 19, 2009 11:38 pm

Sorry for double post.
Link added and last post edited to be more clear 8-)
Update:
What you can hear/see without this patch?
When Alternate method is enabled, video is unsynced but not jerky with czech audio.
When Alternate method is disabled, video is synced but jerky with czech audio.
Last edited by ExSport on Wed Aug 19, 2009 11:45 pm, edited 1 time in total.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby jaqb » Wed Aug 19, 2009 11:40 pm

So the problem is that the video playing to quick, right ? To be sure we have the same issue ;)
EDIT: I tried it many times now...and the video is playing normally....hmm....weird.
EDIT2: So I need to change the audio ?
HD YouTube on PS3 -> PS3 Youtube :D Are you a F1 fan ? Check out F1Reader.com
jaqb
 
Posts: 163
Joined: Tue Jan 27, 2009 11:50 am

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby ExSport » Wed Aug 19, 2009 11:48 pm

Updated last post ;)
No, video is playing normally, no speedup or slowdowns....only shuttering present or not synced A/V.
Hope you have same behavior. I use MEncoder and tsMuxeR.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: New A/V Sync Plugin : working mod(no plugin support for now)

Postby ExSport » Wed Aug 19, 2009 11:50 pm

jaqb wrote:EDIT2: So I need to change the audio ?

Yes, you need to switch to czech audio in transcode folder. Also my settings is: Remux when audio is AC3 = no reencode
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

PreviousNext

Return to Developers

Who is online

Users browsing this forum: No registered users and 3 guests