VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member
    Join Date
    May 2011
    Location
    Paris (France)
    Search Comp PM
    I had to reinstall Windows 10 and started from scratch to organize the avisynth plugins. Fortunately my avs scripts were safe on a backup.

    Unfortunately I am confronted with an unexpected behavior for a basic script to process .ts videos.
    Code:
    v = LWLibAVVideoSource("clip.ts")
    a = LWLibAVAudioSource("clip.ts")
    AudioDub(v,a)
    An audio offset makes the encoding unintelligible. I tried to add a correction to compensate for the offset but on an 18-minute clip, the audio is only synchronized for 2 minutes.
    Code:
    DelayAudio([<"Avance audio", -2.9, 2.9, 2.7>])
    Audio and video definitely do not play at the same speed.

    I must of course specify that there is no audio offset before encoding. The attachment contains a 39-second clip, which is very little to observe the desynchronization. ~0.4 sec

    Why what used to work so well before has become a real pain now?
    Image Attached Files
    Quote Quote  
  2. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    One problem is that your source seems to be corrupted midway through, and if you are having trouble with your full source then I'm going to guess there were more errors that happened during recording. Errors in a recording can cause sync issues if the timing is not corrected by something like VideoRedo. Another issue is that your provided .TS sample has the audio starting a second before the video and having the video play a second longer than the video. What do you use to cut your .TS if anything?

    I have sort of fixed your issue but it's not great. First take your .TS file and mux it to .MKV with MKVToolNix. Next take that new .MKV file and in avisynth, decode it with Directshow(), instead of LWLibAVAudioSource(). This is how I got the sample I provided. Directshow will tend to have the weird error at the beginning when decoding H.264.

    Edit: Looks like the sample I uploaded claims ~80FPS. Which is not right, as it should have been exactly 50. Looks like Directshowsource() assumed an FPS of ~40, which I believe is because of the errors. So to fix that you just have to make sure it says 25fps, like "DirectShowSource("clip1.mkv", fps=25, audio=false, convertfps=true)"
    Image Attached Files
    Last edited by KarMa; 25th Jan 2019 at 07:03.
    Quote Quote  
  3. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I had some luck using dss2 for the video, with LAV filters installed and active (you can check with Graphstudio).
    Possibly the file corruption and/or the MBAFF scan type makes this clip more troublesome.

    But if you just encode it as progressive you're going to get a lot of combing. Best to use Yadif (or QTGMC but it takes much longer) to bob the source
    then encode as progressive
    Here's my sample script, I resized the file for convenience

    Load_Stdcall_plugin("J:\StaxRip_1.1.7.2\Applicatio ns\AviSynth plugins\Yadif\Yadif.dll")
    vid=dss2("C:\Users\davex\Desktop\avs_test\clip1.ts ")
    aud=directshowsource("C:\Users\davex\Desktop\avs_t est\clip1.ts",video=no)
    vid=vid.yadif(mode=1,order=1)
    vid=vid.blackmanresize(720,408)
    Audiodub(vid,aud)
    Image Attached Files
    Last edited by davexnet; 25th Jan 2019 at 13:29.
    Quote Quote  
  4. Member
    Join Date
    May 2011
    Location
    Paris (France)
    Search Comp PM
    Unfortunately, I have to admit that both of you have had the same difficulty using L-smash as I have. The problem comes from the quality of my source which now seems incompatible since my reinstallation from scratch (I secretly hoped to discover that a tool was flawed in my plugins)

    @Karma
    I am well aware that the original quality is not optimal (including the audio offset from the beginning): many audio cracks and small artefacts etc....
    Nevertheless, apart from the very beginning, the playback of the original source is done with a completely correct sync from the beginning to the end of my recordings (sometimes more than 2 hours).

    I suppose there is no direct solution to force the fps=25 command by avoiding the prior conversion to mkv...

    EDIT :
    Originally Posted by KarMa View Post
    What do you use to cut your .TS if anything?
    well, that kind of stuff :
    Code:
    trim(855,28856) ++ BlankClip(last, length=10)++ trim(33862,51054)
    @davexnet
    Your solution (dss2) is the one I used for a long time before I discovered L-smash. It is perfectly functional as a workaround solution, I must admit.

    Since it is established that the problem comes from my source, and that this problem cannot be fixed with avisynth if I use L-smash, it is reasonable to make sure that nothing can be done to fix the problem at the time of capture.

    I use DV Scheduler to schedule my recordings. And maybe I can change a internal setting? Could you shed some light on "file corruption and/or the MBAFF scan type"? It's pretty confusing for me.

    Thank you both for your assistance.
    Last edited by kaskaï; 31st Jan 2019 at 12:45.
    Quote Quote  
  5. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    See this:
    https://www.afterdawn.com/glossary/term.cfm/macroblock-adaptive_frame-field_coding

    I've found dss2 to work OK on this type of source; whether Lsmash or FFMpeg source filters have some operands
    that make it work, I've never really looked into it.
    These filters used as-is result in out of sync audio and frame rate errors.

    You'll notice in my sample, good frame rate, no interlacing artifacts, in-sync audio.

    I don't really understand what you're trying to achieve.
    For example, you have not mentioned whether you want to retain interlaced footage or not
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!