VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 32
  1. Hi. I've only ever used avisynth as part of MeGUI but, due to a video that's giving me no end of A/V sync problems when I encode it, I want to see if I'd get better results using avisynth in its raw form. Unfortunately, I'm getting very little help from google. Can someone give me some pointers? Many thanks if so.
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by pooksahib View Post
    Hi. I've only ever used avisynth as part of MeGUI but, due to a video that's giving me no end of A/V sync problems when I encode it, I want to see if I'd get better results using avisynth in its raw form. Unfortunately, I'm getting very little help from google. Can someone give me some pointers? Many thanks if so.
    Most of us create the script and test it in something like Virtualdub. But this seems so basic, I'm not sure if I misunderstood you
    Quote Quote  
  3. Instal Avisynth, preferably 32bit, you can choose avisynth 2.6 or Avisynth+. After installing Avisynth, Windows associates any file with avs extension as avisynth script. But otherwise nothing happens. You will not see any new icons on desktop. Any new software that you can run.

    Click empty area (on desktop or in windows file browser) and choose new - avisynth script. Then you should create empty avs file. You write a script in notepad to it.
    Or you just open something.txt and save it as something.avs

    First you need to load your video in that script, there is many ways to do it depending what extension your file has. For example for avi extension:
    AviSource("C:\ ....your path.....\video.avi")

    You save the script, make sure it has avs extension. You just created avisynth script. Drop that file onto VirtualDub or MPC-HC and those aplication will treat that script as if it was video file.
    Quote Quote  
  4. Thank you, davexnet and _Al_. Creating a script and then previewing it seems fairly straightforward. But to create a new file, you need to choose a container, a codec, a quality factor, conversion speed, audio format etc etc. Would you need some sort of app with a GUI to do that?

    The reason I'm asking about using avisynth without the likes of MeGUI is because of comments I've seen in this forum from people who say they simply use 'command line' or 'batch files'.
    Quote Quote  
  5. Yes you can use ffmpeg for example , which is often compiled with avisynth support. It's nice in that it can encode audio/video/mux at the same time, you can use commandline and batch. Or many GUI's accept avs input . But none of that necessarily deals with your A/V sync issue

    I would try to be methodical and systematic when assessing A/V sync issues

    If you include audio in the script, and it's in sync in MPCHC, then it's something wrong with megui or how you have it configured

    If you describe the sync issues, that would help too .

    Is source in sync ? What kind of source ? Is it VFR ?
    Is sync progressively worsening, or a constant offset ?
    Are you re-encoding the audio ?
    Post your script
    Quote Quote  
  6. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    It is also possible to feed manually a separate video encoder and a separate audio encoder with AviSynth output, and then multiplex the resulting streams manually into a new container. In this case you will control speed, quality, and sync with each of their separate command line parameter sets. Doing everything in ffmpeg may be slightly more convenient. There are only few differences left in special features between native multiplexers and ffmpeg.
    Quote Quote  
  7. Thanks, guys. The source file is a 1280x720 mp4 (AVC). I've used MeGUI on many such files with no problem (until now...). The source file plays in perfect sync on my PC (MPCHC). The same goes for my MeGUI encode of it. The problem comes when I transfer the new video to my Dune media player for viewing on the TV – it's out of sync by 0.1. I've transferred the source vid to the Dune and it plays fine which suggests to me that, although the MeGUI encode was successful, there's something about it the Dune doesn't like. And that's why I was wondering about doing an encode without MeGUI.

    I've tried various Indexers with MeGUI, I've put the source file through toolnix and then encoded the toolnix file but there's always the same sync problem.

    An edit and conversion to h265 using avidemux works fine but, ideally, I'd like to have some avisynth effects in the final vid.

    Here's one of my scripts:
    Code:
    LoadPlugin("E:\MeGUI\tools\ffms\ffms2.dll")
    a=FFVideoSource("E:\August.mp4", fpsnum=30000, fpsden=1001, threads=1)
    b=FFAudioSource("E:\August.mp4")
    audiodub(a,b)
    Spline64Resize(800,448)
    Quote Quote  
  8. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Are you sure you need "fpsnum=30000, fpsden=1001" to force this frame rate? If the source already has it, it is probably superfluous, up to a point that it might skip or duplicate frames unnecessarily.

    Apart from that ... which audio encoder do you use? In case of an AAC encoder: Some players compensate for a "decoder lag", others may not.
    Quote Quote  
  9. "fpsnum=30000, fpsden=1001" was done automatically by MegUI. I've used other Indexers which had no 'frame rate forcers' and the results were the same. Still, I'll try FFMS without that line and see what happens... As for audio, I'm converting it to mp3 within MeGUI.
    Quote Quote  
  10. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    Your sync problem won't be fixed by using avisynth outside of megui, as there should be no difference if using the same .AVS script with Megui and without Megui. What it really comes down to is the video decoder you use with difficult videos. Usually I have trouble with .TS sync and some decoders add extra frames at the beginning. I tend to get the best results from DSS2. It's works especially well with damaged .TS recordings and keeping the sync.
    Quote Quote  
  11. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    deleted
    Quote Quote  
  12. Interesting, KarMa. How do I actually 'use' DSS2? Could I use it within MeGUI?
    Quote Quote  
  13. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    The easy way to use it is to just go into the script creator and create a new avisynth profile with DSS2 prefered. Then the next time you want to index a file, click the directshow instead of the other options. And it will use DSS2 instead of Directshow.
    Click image for larger version

Name:	DSS2.png
Views:	297
Size:	66.7 KB
ID:	44053

    Example

    Code:
    LoadPlugin("C:\Program Files (x86)\Haali\MatroskaSplitter\avss.dll")
    dss2("O:\To Be Encoded\Source.ts", fps=29.970, pixel_type="yv12").AssumeFPS(30000,1001)
    A big hang up with me and DSS2 is that it usually just assumes everything is YUY2, even though just about everything (especially if you are a novice) is going to be YV12. So I have to put pixel_type="yv12", as shown in my example script, to force it to decode it as YV12. Otherwise megui will ask to add converttoyv12(), which will hurt quality a very tiny amount but noticeable with red colors. I personally manually add pixel_type="yv12" every time, until I think of something automatic.

    There are some nuanced frame accuracy problems with it since it does not build an index. Mostly having to do with trying to watch the video backward, instead of forward. So if you are simply doing a script to play the video from start to end then there should be no problems.

    In megui when the preview window pops up the first time, showing you the video after clicking "Directshow", just close that preview as it's glitched with DSS2 (to put simply). After closing that preview window get your script how you want it and press the preview button manually which should work better.

    DSS2 uses Haali Media Splitter, which you might need to download and install.
    Quote Quote  
  14. If ffms is giving you A/V sync errors try using LSmashVideoSource() and LSmashAudioSource() intead -- both part of the LSMASH source package.
    http://avisynth.nl/index.php/LSMASHSource

    I usually use the x264 CLI encoder and mux with the original audio afterward. I keep a batch file on the desktop so I can drag and drop AVS scripts onto it:

    Code:
    start /b /low "x264" x264.exe --preset=slow --crf=18 --keyint=50 --sar=1:1 --colormatrix=smpte170m --output "%~1.mkv" "%~1"
    Edit the bat file as necessary for the project.
    Last edited by jagabo; 18th Dec 2017 at 07:12.
    Quote Quote  
  15. Thanks very much, guys. (jagabo - I did try that, you'd given me that advice previously). Good news, though - I've just done an encode, same as before, but changed mp3 to ac3 and the resulting file plays fine on both MPCHC and on TV via the Dune box. Nice...
    Quote Quote  
  16. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Please note: L-SMASH Works provides two sets of source functions with different splitters.

    LSMASHVideoSource + LSMASHAudioSource use the L-SMASH splitter which supports only ISO Media container types (like MP4, MOV, 3GPP). It does not require indexing and relies on index chunks in the container.

    The other set, LwLibavVideoSource + LwLibavAudioSource, uses libavformat and creates an index, usually as file. This set is supported by MeGUI's AVS Script Creator because it supports many more container formats.
    __

    If you noticed that the asynchronity only happens with specific audio formats, then it may be related to the "decoder lag" I previously mentioned. Some players counter a known format-dependent skew by delaying the opposite stream preemtively.
    Last edited by LigH.de; 18th Dec 2017 at 07:29.
    Quote Quote  
  17. Originally Posted by pooksahib View Post
    a=FFVideoSource("E:\August.mp4", fpsnum=30000, fpsden=1001, threads=1)
    b=FFAudioSource("E:\August.mp4")
    audiodub(a,b)[/code]
    If that script is not in-sync it is either a bug in ffms2 (please report on github) or your source wasn't in-sync to begin with.



    But how much out-of-sync are we talking about? As has been said there is encoder delay that might differ between mp3 and ac3 but it isn't usually all that much. Are you encoding the audio through the AviSynth-script?


    /edit:
    nvm, I hadn't seen the part about 0.1 (seconds) and the Dune ....
    Quote Quote  
  18. I have to assume that the problem is due to the Dune not liking mp3 with this particular vid. It's odd because the Dune has played many similar vids with no sync issues. If I've learnt one thing, it's that computers and software always have something new around the corner to p*** you off...
    Quote Quote  
  19. How do you mux the mp3?
    Quote Quote  
  20. With MeGUI. It's an all-in-one tool - you choose the video settings, choose the audio settings then press Go.
    Quote Quote  
  21. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    Sneaker is asking how exactly you mux it, with what program, and mux it into what container (.avi, .mp4 .mkv?).
    Quote Quote  
  22. Hmmm... 'mux' means to 'join together', yes? My answer's the same - with MeGUI (which I have set to output mkv). Perhaps I'm not understanding something??
    Quote Quote  
  23. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    MeGUI offers multiplexer dialogs for e.g. the MP4 or the MKV container (Ctrl+4 / Ctrl+5), and will create a job for MP4Box or mkvmerge, respectively.

    Or did you use the "One Click Encoder" in MeGUI, instead of manually adding jobs to the queue?
    Quote Quote  
  24. I use AutoEncode (rather than One-Click) which gives me a Queue like this:
    Image Attached Images  
    Quote Quote  
  25. Originally Posted by pooksahib View Post
    Good news, though - I've just done an encode, same as before, but changed mp3 to ac3 and the resulting file plays fine on both MPCHC and on TV via the Dune box.
    Not a good solution after all. The sync was fine but, for some reason, the Dune box decided to stop playing audio about 70-80% into the video. Damndedest thing. Still, did I not say that technology will always find new ways to ruin your day...

    The only other thing that I could think of was to ensure the avisynth'd vid had the same type of audio as the source vid. That was AAC(LC) which meant I had to install itunes and activate qaac within MeGUI but...... it works!!
    Quote Quote  
  26. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    You did not have to install iTunes; it would have been sufficient to extract the CoreAudioToolbox DLL's (using makeportable.cmd) and copy them into the qaac directory.

    Or you would just have multiplexed the original audio stream (using the HD Stream Extractor and the manual Multiplexer dialog). No conversion = no quality loss.
    Last edited by LigH.de; 21st Dec 2017 at 04:57.
    Quote Quote  
  27. Yes, I tried something like that when I read the megui wiki ("...or extract the AppleApplicationSupport.msi file from the iTunes installation exe and install that). Didn't work, though, so I just went for broke and installed the whole package. I wanted fades so using the original track wasn't an option.
    Quote Quote  
  28. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    That part of the Wiki may be severely outdated...

    To extract the Apple AAC encoder files, you put the iTunes64Setup.exe from apple.com/itunes/download into the MeGUI\tools\qaac directory and run the makeportable.cmd; when it finished, it should leave two subdirectories QTfiles and QTfiles64; now you can delete the iTunes installer there.

    You may even save a little space by replacing the huge original files with tiny icudt55 dummy DLL's; but it's not really necessary.
    Last edited by LigH.de; 21st Dec 2017 at 05:03.
    Quote Quote  
  29. Vielen dank for taking the time to help me with that. I'll uninstall itunes and use your method in due course.
    Quote Quote  
  30. Originally Posted by LigH.de View Post
    To extract the Apple AAC encoder files, you put the iTunes64Setup.exe from apple.com/itunes/download into the MeGUI\tools\qaac directory...
    In the case of a basic MeGUI, there would not be a qaac directory. Are you suggesting that you have to create this directory before you begin or is there some other method of handling the iTunes64Setup file? Thanks.
    Quote Quote  



Similar Threads

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