Log in

View Full Version : Serving an MPEG2


neo squidward
15th December 2005, 23:16
When I serve my MPEG2 [fps 29.976 ripped from a DVD] all the players I've tried using [media player classic and vdub] play the video really fast so the audio is off sync. It plays just fine and on sync when I open the MPG with media player classic but this problem only happens when I use a avisynth script. This is the script I'm using

DirectShowSource("C:\video\source-mpeg2.mpg")
ConvertToYUY2()

Am I missing something in my script? Can someone help?

Anonymouses
15th December 2005, 23:19
Use DGIndex/DGDecode to serve mpeg2 files in Avisynth. You can get the latest version here (http://www.neuron2.net/dgmpgdec/dgmpgdec146b2.zip). Secondly, why are you converting your files to YUY2?

Haze_NZ
15th December 2005, 23:56
As stated above, load the MPEG2 video into DGIndex. Now click 'Save Project As' and now save the d2v file in the same directory as the video (not compulsory, just recommended). Now your AVS should look like this:

MPEG2Source("C:\video\source-mpeg2.d2v")

neo squidward
16th December 2005, 01:01
This worked perfect, thank you guys.

To answer anonymouses question: I think that ConvertToYUY2 is needed to work with CCE . Please correct me if I'm wrong.

Mug Funky
16th December 2005, 01:50
yes it is, and add (interlaced=true) to it if you need to.

Anonymouses
16th December 2005, 04:04
To answer anonymouses question: I think that ConvertToYUY2 is needed to work with CCE . Please correct me if I'm wrong.

Okay, I figured you must be doing something like that. It's just that sometimes people seem to add unnecessary colorspace conversions into their scripts so I was just checking. :)

derevo
14th January 2007, 19:33
MPEG2Source("C:\video\source-mpeg2.d2v")

i did this, but converted to xvid file has no audio.
why?

Pookie
14th January 2007, 23:30
You'll have to process your audio seperately with mpeg2source()

Dgindex lets you demux the audio tracks. You can then re-mux the audio to your new XVID file in VirtualDubMod or AviMuxGUI

Guest
15th January 2007, 03:06
i did this, but converted to xvid file has no audio.
why? Because you didn't read the Quick Start guide that comes with DGMPGDec, specifically, the section labeled "Sure, Sure, But What About My Audio?"

http://neuron2.net/dgmpgdec/QuickStart.html

derevo
17th January 2007, 11:09
You'll have to process your audio seperately

I thought it can take audio directly from mpeg2 file.
but why virtualdubmpeg2 has audio synchronisation bug?
when a open mpeg2 files with virtualdub mpeg2 it always has incorrect audio/video sync.
some files has correct sync when i watch them with anything codec (elecard, cyberlink, MainConcept) and with anything player (windows media player, zoomplayer).
how i can have correct sync with virtualdubmpeg2?

foxyshadis
17th January 2007, 11:20
You'll have to ask fcchandler, vdmpeg2 doesn't use neuron2's code. I think it's because it ignores RFF flags, but I'm not certain, which would make it unsuitable for many NTSC movies.

Guest
17th January 2007, 15:27
The latest version of VirtualDub MPEG2 allows you to honor RFF flags. You have to enable it in Options/Preferences/MPEG and then load your input file (has to be set when the file is parsed, don't turn it on after loading your file). This will then preserve audio sync for sources with irregular RFF flags.

The downside of course is that you will be limited to VirtualDub's IVTC, which can't be previewed, doesn't have postprocessing, has limited flexibility, no hybrid capabilities, etc. For 720P with frame repeats, you will be unable to decimate back to film rate, as you can easily do if you use the DGMPGDec/Avisynth route.

derevo
1st July 2007, 19:42
why i have audio/sync problem when i encode my mpeg2 video to xvid through dgindex and avisynth?

first i demux audio from my mpeg file to mpa using dgindex.
it creates file 12 T01 DELAY -276ms.mpa
it also creates .d2v file.

then i use this avisynth script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
video=mpeg2source("c:\12.d2v")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mpasource.dll")
audio=mpasource("c:\12 T01 DELAY -276ms.mpa")
audiodub(video,audio)

then i open it by virtualdub, set audiointerleaving delay audio track to -276 ms and decode to xvid.
converted xvid file has correct audio/video sync only in began of video.
in the middle and in the of video it has big audio/video desynchronisation.
if i set delay audio to 0 ms it has desynchronisation in all of file.
when i open mpeg2 video by virtualdub-mpeg2 it has desynchronisation too.
when i watch this mpeg2 video file on my main and on my second computer by many different videoplayers it has always correct audio/video sync.
he i can convert mpeg2 video to xvid without audio/video sync problems?

foxyshadis
1st July 2007, 20:18
Did you follow this?

The latest version of VirtualDub MPEG2 allows you to honor RFF flags. You have to enable it in Options/Preferences/MPEG and then load your input file (has to be set when the file is parsed, don't turn it on after loading your file). This will then preserve audio sync for sources with irregular RFF flags.

As noted in the caveats, you may wish to switch to dgindex+avisynth for other reasons, or just let AGK handle it for you.

derevo
1st July 2007, 20:46
Did you follow this?


yes.
i went to this page http://sourceforge.net/project/showfiles.php?group_id=64317
and downloaded 2 archives:
1. Needed DLLs unmodified version October 8, 2002
2. VirtualDubMpg2 binary alpha0.31 October 15, 2002

and unzipped they to some folder.
but virtualdub reports some error, when i try to open a file.
"MPEG2 Import Filter: pack synchronization error"

foxyshadis
1st July 2007, 21:14
Whoa, no, that project is abandoned. VirtualDubMpg2 and VirtualDub-Mpeg2 are different projects. Use this instead: http://fcchandler.home.comcast.net/stable/

Guest
2nd July 2007, 00:25
You didn't tell us about your source material. If it came from a DVD, then there should be no such problem. If it came from a live TS capture, then it may have a PTS discontinuity, or it may have a section of audio at a different sample rate. Tell us about your source material.

derevo
2nd July 2007, 18:10
i downloaded it this http://fcchandler.home.comcast.net/stable/ link from and it has sync problem too.
i tried it as enabled option honor "repeat first field" flags and as disabled this option.
in both variants it has big desynchronisation.
You didn't tell us about your source material.

it is standard digital mpeg2 dvb-t television.
recorded by dvb-viewer pro by hauppauge dvb-t usb receiver.

Guest
2nd July 2007, 20:27
It's probably a PTS discontinuity. You'll have to resync it manually or clean it up with ProjectX first.

derevo
2nd July 2007, 22:10
It's probably a PTS discontinuity.

my files are not corrupted.
all players play them without desynchronization on my both computers.

You'll have to resync it manually or clean it up with ProjectX first.

i processed my mpg file through projectx with default settings,
but it did not help to solve sync problem.

what soft is without sync bugs?

Guest
2nd July 2007, 22:15
my files are not corrupted.
all players play them without desynchronization on my both computers. I didn't say your file was corrupted. Players can play them because they use the PTS stamps throughout the stream. When you convert away from MPEG2 you lose the stamps. DGIndex reads the stamps once at the beginning and assumes everything is continuous thereafter. It is not unusual for discontinuities to be present in broadcast transport (stream splicing, wraparound, etc.).

If you would lke to post a fragment of the transport stream that contains the point where the sync goes out I will look at it for you.

derevo
3rd July 2007, 19:02
Players can play them because they use the PTS stamps throughout the stream.

i don't understand these technical terms, but i know, that all players opens files correctly, but virtualdub-mpeg2 incorrectly

When you convert away from MPEG2 you lose the stamps.

not me, but buggy virtualdub-mpeg2.

If you would lke to post a fragment of the transport stream that contains the point where the sync goes out

sync goes out in all dvb-s and dvb-t recordings, when i open them in virtualdub-mpeg2.

here is links to my files:

http://rapidshare.com/files/40819667/13.mpg.html
http://rapidshare.com/files/40821090/14.mpg.html

Guest
3rd July 2007, 21:53
I loaded your 13.mpg into DGIndex 1.4.9. I did save project with honor pulldown flags. I then used this script and got good sync.

vid=MPEG2Source("E:\tmp\derevo\13.d2v")
aud=nicmpasource("13 T01 DELAY -459ms.mpa").delayaudio(-0.459)
audiodub(vid,aud) It actually works a little better to skip a GOP at the beginning because your stream has a wrong first video PTS.

I also tried VirtualDub MPEG2 with an audio delay of -459ms and everything was fine. Are you maybe putting the wrong value in the delay box? If the delay in the file name is -459, then you enter -459 (not 459).

Tell us what you do to see a failure with your 13.mpg.

(Finally, you should show a little more respect to developers than you've displayed here. Otherwise, they might decide that there's no reason to help you.)

derevo
3rd July 2007, 22:41
I loaded your 13.mpg into DGIndex 1.4.9. I did save project with honor pulldown flags. I then used this script and got good sync.


yes, it has correct sync, but it is suitable only for short videos (under 10 minutes)

if video is long, then it has correct sync only about first 10 min.

here is my quote:

then i open it by virtualdub, set audiointerleaving delay audio track to -276 ms and decode to xvid.
converted xvid file has correct audio/video sync only in began of video.
in the middle and in the of video it has big audio/video desynchronisation.


it was about 1 hour long video.

i want to find soft, which opens video completely correct.
like players:
Players can play them because they use the PTS stamps throughout the stream.

DGIndex reads the stamps once at the beginning and assumes everything is continuous thereafter.


this method is correct only for shot videos, if DGIndex reads the stamps only at the beginning of video.

Guest
3rd July 2007, 23:04
I asked you:

"If you would like to post a fragment of the transport stream that contains the point where the sync goes out I will look at it for you."

So you've wasted my time by giving me a stream that is useless for demonstrating your problem. Thanks a lot!

I don't see how I can help you if you won't follow simple instructions.

this method is correct only for short videos, if DGIndex reads the stamps only at the beginning of video. The method is fine as long as the timestamps are continuous (and there are no audio segments with different bitrates, etc.), which is what I was trying to tell you in the first place. If not, then there are workarounds. But since you won't give me a stream that shows the problem, it's all pointless speculation.

derevo
4th July 2007, 17:29
I asked you:

"If you would like to post a fragment of the transport stream that contains the point where the sync goes out I will look at it for you."


did you meen video which has correct sync in the beginning of the video (if i set in virtualdubmpeg2 audio delay from dgindex), but which has wrong sync in the middle and in the of video?

videos which has correct in the beginnig, but wrong in the middle are big, over 1 gb.

The method is fine as long as the timestamps are continuous (and there are no audio segments with different bitrates, etc.), which is what I was trying to tell you in the first place.

i don't know about audio, but aspect ratio changes in the finnish tv very frequently.
over 20 times in 1 hour.

But since you won't give me a stream that shows the problem

it is over 1 gb, and upload of it takes over 2 hours on my 1 mb upload channel.
and i must cut it to 11 parts if i will upload it to rapidshare.

i am looking for programm which opens correctly all files, even 3 hours long little corrupted satellite files.
satellite files are not infrequently little corrupted, if it is raining outside.

Guest
4th July 2007, 17:44
videos which has correct in the beginnig, but wrong in the middle are big, over 1 gb. Do I have to spoon feed you? Just make a 50MB section with the place where the sync goes off in the middle. It's not rocket science.

i am looking for program which opens correctly all files, even 3 hours long little corrupted satellite files.
satellite files are not infrequently little corrupted, if it is raining outside. Sure, so is everyone else. But I don't see people lining up to tell you about one. I can help you with workarounds, but to do that I have to know the exact nature of the problem. That's why I need your stream.

Leak
4th July 2007, 18:29
did you meen video which has correct sync in the beginning of the video (if i set in virtualdubmpeg2 audio delay from dgindex), but which has wrong sync in the middle and in the of video?
How about you tell us whether the video suddenly snaps and goes from totally in sync to hugely out of sync from one frame to the next, or whether it slowly drifts out of sync, i.e. it gets worse over time?

If it's the latter, you probably just need to adjust the length of the audio itself (or adjust the samplerate a bit) to fit the video.

np: The Orb - From A Distance (Blaster Master vs. The Corpral) (Bicycles & Tricycles)

derevo
4th July 2007, 18:32
Just make a 50MB section with the place where the sync goes off in the middle.

apparently desynchronization accumulates during whole video.
i could not to find the point where the sync goes out.
apparently such points are many during the video.

here is 60 mb of stream where aspect ratio changes many times during the video:

http://rapidshare.com/files/41004925/013.mpg.html

derevo
4th July 2007, 18:47
or whether it slowly drifts out of sync, i.e. it gets worse over time?

in some videos it is like this way, other video has little (hardly appreciable) desynchronization even in the end, other corrupted satellite video (if it is raining outside) has very big desonchronization.
but all videos has correct sync, when i watch them by different players.

Guest
5th July 2007, 05:12
but all videos has correct sync, when i watch them by different players.

I've already explained why the players can handle it while conversion away from MPEG2 causes problems.

derevo
5th July 2007, 11:51
what program opens mpeg2 videos correctly like players?

derevo
5th July 2007, 12:18
or clean it up with ProjectX first.

what settings i must set in ProjectX to clean it up?
i tried with default setting, but this did not solve sync problems.