VideoHelp Forum




+ Reply to Thread
Results 1 to 25 of 25
  1. Hello,

    I'm using this avs code to open an mkv file inside virtualdub
    DirectShowSource("C:\DVD\title00.mkv", FPS=30,convertfps=true)

    But each time and in many different videos virtualdub is choosing a random frame from the movie and add it to the beginning of the video then the movie starts.

    For video compression i'm using XVID one pass max quality.
    Using 2 filters: resize and box blur.

    What to do to avoid this?

    Thanks.
    Quote Quote  
  2. Mod Neophyte redwudz's Avatar
    Join Date
    Sep 2002
    Location
    USA
    Search Comp PM
    I wouldn't use VD for this type of conversion. It's not well suited for it. Other problems could be variable frame rate video or just as likely, VD can't find the correct keyframe within the MKV. Depends on how the MKV(Probably h.264) was made.

    You might try AVIDemux or Vidcoder or similar. Others here may have better suggestions. Just curious, why the filters?
    Quote Quote  
  3. DirectShowSource() is not frame accurate.
    Quote Quote  
  4. I'm removing the nudity part of some of my movies and i must use VD because it's easy to use so i can blur some parts and cut some others.
    Can you help me get the rid of the problem?
    Quote Quote  
  5. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    DirectShowSource depends entirely on the filters available on your machine. If those filters (demuxers and decoders) are not reliable (frame-accurate), the final result will not be good at all.
    While you don't learn how to deal with the DirectShow hell , you'd better use DSS2 (requires the infamous Haali Media Splitter), or switch to FFMS2
    Quote Quote  
  6. The "seek" and "seekzero" options of DirectShowSource() may work.
    Quote Quote  
  7. But the whole movie good, it only add this random frame to the beginning of the movie.
    Please help me, i'm a noob in such field so don't go pro with me.

    @jagabo, can you modify my above code please to use seek and seekzero?
    Quote Quote  
  8. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    so when your its done, edit out the random frame, you know CUT delete, save with out the random frame

    if it's only one frame its only going to blink ( be on display) for approx 1/29 of a second
    Quote Quote  
  9. Member
    Join Date
    Nov 2009
    Location
    United States
    Search PM
    Why are you using an avisynth script to load with directshowsource if you're filtering with Vdub ?
    Virtualdub has a plugin to load files with directshow.
    It might work better ?
    You can find it on the virtualdud download page here on videohelp, just scroll down to the plugins section.

    Or you might want to try the FFmpeg input driver, it seemed to work better with the file I tested with.
    Last edited by gregalan; 22nd Jul 2013 at 02:43. Reason: Update
    Quote Quote  
  10. The random frame at the beginning thing is something I've experienced when encoding via DirectShow. Not while using VirtualDub though, so I guess it's a DirectShow problem. I don't know why it happens. Unless you particularly need to use DirectShow......

    Another option is to open the video with ffms2 instead. Just download it and put it somewhere, then create a script to use ffms2 to index and open the video. Something like this (I've included the frame rate conversion in case you need it):

    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    FFVideoSource("E:\video.mkv", threads=1, fpsnum=30, fpsden=1)

    The first time you open the script with VirtualDub (or any program) there'll be a delay while ffms2 creates the index file (it might take a minute or so depending on the video size), but it only needs to happen the first time. The above script will open the video only. There's instructions here for including the audio too.

    PS. When using DirectShow for decoding, you could try telling AVISynth not to include the first frame. Whether that'd stop the random frame from being added to the beginning, I'm not sure. Anyway, to tell AVISynth to skip the first frame (frame zero), add something like this to the end of the script (the second number being the total number of frames, or more):

    trim(1, 9999999)

    If memory serves me correctly, the random frame replaces what would otherwise be the first frame (instead of an extra frame being added to the beginning) so not encoding the first frame might effect the audio sync a little bit.
    Quote Quote  
  11. @thewizard, VD is kinda stubborn and each time i cut the frame and re save the file it does nothing when using (direct stream option), i have to full reprocess the avi file to get the rid of it and that's will waste more time while direct stream copy is super fast, usually it works if you remove good amount of frames but not just one frame and i have no idea why.

    @gregalan, i'm using it because i can't load mkv directly into VD and before i use it i've searched about such plugin but couldn't find, anyone knows the name of it?

    @hello_hello, thank you but the trimming thing is not something that i want to do while the first process plus ffms2 seems to be more complicated than directshow.
    Quote Quote  
  12. The MKV and ffmpeg source plugins are listed on the VirtualDub page here.
    Quote Quote  
  13. Yeah that's my problem , i saw this page before but links are down.
    Matroska (MKV / MKA) x64 (by fcchandler)
    Quote Quote  
  14. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by danswano View Post
    Yeah that's my problem , i saw this page before but links are down.
    Matroska (MKV / MKA) x64 (by fcchandler)
    http://gral.y0.pl/~fcchandler/
    Quote Quote  
  15. The first thing you should do is stop using the 64 bit versions of VirtualDub and AviSynth. They are full of bugs and there are fewer third party filters available for them. And you get almost no benefit in exchange.
    Quote Quote  
  16. @El Heggunte, Thanks.
    @jagabo, on both 32 and 64bit i'm getting MISSING CODEC inside the black screen and if i try to play the mkv file i get no audio decompressor found.

    any idea? :/

    Video
    ID : 1
    Format : MPEG Video
    Format version : Version 2
    Format profile : Main@Main
    Format settings, BVOP : No
    Format settings, Matrix : Custom
    Codec ID : V_MPEG2
    Codec ID/Info : MPEG 1 or 2 Video
    Bit rate mode : Variable
    Bit rate : 4 873 Kbps
    Maximum bit rate : 9 800 Kbps
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Variable
    Original frame rate : 29.970 fps
    Standard : NTSC
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Scan order : Top Field First
    Compression mode : Lossy
    Time code of first frame : 00:59:58;00
    Time code source : Group of pictures header
    Language : English
    Default : No
    Forced : No

    Audio
    ID : 2
    Format : AC-3
    Format/Info : Audio Coding 3
    Mode extension : CM (complete main)
    Format settings, Endianness : Big
    Codec ID : A_AC3
    Duration : 1h 50mn
    Bit rate mode : Constant
    Bit rate : 448 Kbps
    Channel(s) : 6 channels
    Channel positions : Front: L C R, Side: L R, LFE
    Sampling rate : 48.0 KHz
    Bit depth : 16 bits
    Compression mode : Lossy
    Stream size : 354 MiB (8%)
    Title : 3/2+1
    Language : English
    Default : Yes
    Forced : No
    Quote Quote  
  17. Originally Posted by danswano View Post
    @thewizard, VD is kinda stubborn and each time i cut the frame and re save the file it does nothing when using (direct stream option), i have to full reprocess the avi file to get the rid of it and that's will waste more time while direct stream copy is super fast, usually it works if you remove good amount of frames but not just one frame and i have no idea why.
    Without re-encoding, you can only cut the video on keyframes. If you try to cut it on other frames and use Direct Stream Copy, VirtualDub will either ignore the cut, or cut it in the wrong place (I can't remember). Sometimes you'll get lucky and the first unwanted frame will be a keyframe on it's own so you can remove it, sometimes you'll need to remove a bunch of frames from the beginning. When navigating with VirtualDub, hold down the Shift key while using the seek bar. When you stop, VirtualDuib will stop on a keyframe. Alternatively, the back/forward buttons on the navigation bar with pictures of keys on them.... they'll skip from one keyframe to the next.
    The above only applies to opening a video directly. If you open it via an AVISynth script every frame is uncompressed, so there's no keyframes.... although obviously you can't use Direct Stream Copy either.

    Originally Posted by danswano View Post
    @hello_hello, thank you but the trimming thing is not something that i want to do while the first process plus ffms2 seems to be more complicated than directshow.
    Why don't you want to try trim?? It's a standard AVISynth function. I use it all the time. You can add multiple trims to a script and just encode the frames you want, skipping the rest. So you're effectively editing and encoding at the same time. Plus it's quite handy if you want to process sections of video differently. For example, maybe you want to crop the first half of the video differently to the second. It's easy:

    trim(0, 1918).crop(20, 8, -18, -8).Spline36Resize(640,480)\
    ++ trim(1919, 4893).crop(12, 6, -26, -10).Spline36Resize(640,480)

    But I digress.....
    ffms2 isn't hard to use once you've done it once, and it doesn't complicate the encode by adding unwanted frames to the beginning. All you need to do to get started is to download it and create a script just like the one I posted earlier, while simply changing the path to ffms2 and the video location to suite. Then open the script with VirtualDub (there'll be a delay the first time while the video is indexed).
    If setting it up yourself seems a little hard at first, maybe try installing MeGUI. Use it to open an MKV via the File/Open menu and it'll offer to index the video. Add the indexing job to the queue and run it. When it's done MeGUI will open the script creator where you'd normally set up the encode, but you can simply save the script "as-is". If you do, the script will do nothing more than open the video with ffms2. You can open that script with VirtualDub if you want to, and you won't have any more unwanted frames added to the beginning.
    Last edited by hello_hello; 22nd Jul 2013 at 18:09.
    Quote Quote  
  18. Thanks hello_hello for the detailed explanation but i'm kinda noob, what do i have to edit in your code for each movie? and in which line of the script i should add them?
    Quote Quote  
  19. Originally Posted by danswano View Post
    @El Heggunte, Thanks.
    @jagabo, on both 32 and 64bit i'm getting MISSING CODEC inside the black screen and if i try to play the mkv file i get no audio decompressor found.

    any idea?
    AC3 plugin
    Quote Quote  
  20. I don't seem to find what to add to the script from the help page so FFMS load the audio, can you guide me please?
    Quote Quote  
  21. Originally Posted by danswano View Post
    I don't seem to find what to add to the script from the help page so FFMS load the audio, can you guide me please?


    If you unzip the ffms2.avsi from the ffms2 package into the plugins folder, there will be a helper function FFMpegSource2

    FFMpegSource2("video.mkv", atrack=-1)

    or you can do it without, just with ffms2.dll

    aud=FFAudioSource("video.mkv")
    vid=FFVideoSource("video.mkv")
    AudioDub(vid,aud)
    Quote Quote  
  22. Originally Posted by danswano View Post
    Thanks hello_hello for the detailed explanation but i'm kinda noob, what do i have to edit in your code for each movie? and in which line of the script i should add them?
    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    FFVideoSource("E:\video.mkv", threads=1, fpsnum=30, fpsden=1)

    I generally add the lines to load all used plugins to the beginning of every script so they're all together, but they can be loaded anywhere in a script as long as they're loaded before they're used. Then I follow that with opening the video in question (DirectShowSource or FFVideoSource etc) followed by any filtering in the order you want it to happen (resizing, de-interlacing etc).

    In the above script, just change the first line to point to the location of ffms2 on your hard drive. Change the "E:\video.mkv" part to the location of the video in question. The rest of the script above was to convert the video to 30fps, as per your original script. "threads=1" is to run ffms2 in single threaded mode as multi-threaded mode has more potential to cause problems. You can get rid of all that and the script would look like this:

    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    FFVideoSource("E:\video.mkv")

    Originally Posted by danswano View Post
    I don't seem to find what to add to the script from the help page so FFMS load the audio, can you guide me please?
    When you download ffms2, there's a script included called either FFMS2.avs or FFMS2.avsi (I can't remember which). Scripts with an avsi extension will automatically be loaded by AVISynth if they're in the AVISynth plugins folder (the same thing applies to most plugins too). Copy the FFMS2.avsi script to there and make sure the extension is avsi rather than avs. That script allows the video and audio to be loaded automatically in the script you create, without needing to specify each individually. Instead of using
    FFVideoSource("E:\video.mkv")
    in your script to open just the video, you can use FFMpegSource2 to open both the video and audio. So your script for opening the MKV will then look like this:

    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    FFMpegSource2("E:\video.mkv", atrack=-1)

    The "atrack" part tells ffms2 which audio track to use. In the above example it's the first one it finds.

    If you want to, you can also copy the ffms2.dll and ffmsindex.exe files to the AVISynth plugins folder, so ffms2.dll will be auto-loaded too. That way there's no need to load the ffms2 plugin manually, so the script you need to create to open both the audio and video is then reduced to this (changing the path to the video's location):

    FFMpegSource2("E:\video.mkv", atrack=-1)

    Not really any harder than DirectShow once you have the correct files in the AVISynth plugins folder and it's working. If it's worked once it should keep working. Just remember the first time you open the script the video will be indexed which can take anything from a few seconds to a few minutes, so don't panic if the program opening the video looks like it's frozen the first time.

    I usually create a script and encode just the video, unless the audio's in a format not compatible with AVI (in which case it needs to be re-encoded). I generally just extract the original audio from the MKV with MKVCleaver (it needs MKVToolNix to be installed in order to work) and then I add that audio to the AVI output file using Direct Stream Copy so it's not being re-encoded. There should be no problem doing so with AC3.

    Another utility you might want to look at is AVISynthesizer. It'll let you create AVISynth script templates for opening video. They can be as simple or complicated as you like. I've got simple templates for opening video via DirectShowSource, FFMS2 and AVISource, so to open one via a script I right click on the video in question, select SendTo/AviSynthesizer, and from there a window opens where I select the desired template. AVISynthesizer creates the script for me and then all I need to do is open it. Once you've create an FFMS2 script and got it working, creating a template for one should be nice and easy. My template for opening video (only) with ffms2 looks like this. It's saved as an "avst" file and kept in the AVISynthesizer/Templates folder.

    #ASYNTHER FFMS2 - No Audio
    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    [FFVideoSource("%f")]

    I also have a script template to convert the colours correctly when reducing high definition video to standard definition AVIs while encoding. This template also creates a script which converts the frame rate to 25fps.

    #ASYNTHER 25fps - FFMS2 - No Audio
    LoadPlugin("C:\Program Files\ffms2\ffms2.dll")
    [FFVideoSource("%f", threads=1, fpsnum=25, fpsden=1)]
    LoadPlugin("C:\Program Files\MeGUI\tools\avisynth_plugin\ColorMatrix.dll" )
    ColorMatrix(mode="Rec.709->Rec.601", clamp=0)

    Pretty much all AVISynthesizer does is take the template, fill in the name and location of the video file and save it as an AVISynth script ready for you to open. It just saves having to create the script from scratch manually every time.
    Last edited by hello_hello; 22nd Jul 2013 at 20:40.
    Quote Quote  
  23. @poisondeathray, thanks.
    @hello_hello, wow dude, you have been such a great help for me, thank you for your kind support.
    Working now on a movie and i will see how it goes.

    Thank you very much.
    Quote Quote  
  24. I just edited my post a little, so maybe refresh the page..... but I'm glad to have helped.
    Quote Quote  
  25. i have a question here dude if you have knowledge in BD authoring i need your awesome help.
    Quote Quote  



Similar Threads

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