VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 28 of 28
Thread
  1. I have many videos that I wish I could ope with Virtualdub without having to type ffvideosource("C:\video.mov"), save it to .avs, right-click and find vdub every time. Is there a way to automatically generate an AVS script for any video I want to open?
    Thanks.
    Quote Quote  
  2. You could make a context menu item

    Click image for larger version

Name:	MakeAVS.jpg
Views:	153
Size:	60.8 KB
ID:	40286

    using a batch file to write the .avs and start vdub

    echo ffvideosource("%1") > temp.avs
    [Path]VirtualDubmod.exe temp.avs

    I use Types to make the context menu item
    Quote Quote  
  3. Originally Posted by Aludin View Post
    I have many videos that I wish I could ope with Virtualdub without having to type ffvideosource("C:\video.mov"), save it to .avs, right-click and find vdub every time.
    I don't do it automatically, but have a bunch of 'template' AviSynth scripts handy. I choose an FFVideoSource one and only have to fill in the name of the video (cut and paste from the video itself). Easy. Those same scripts also have a bunch of filters already included which I only have to 'turn on' and perhaps configure, open the script in VDub and I'm ready to go.
    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    I have a different method.

    I have this in my plugins directory:

    Code:
    function AVSSource( float "fpsnum", float "fpsden")
    {
    	fpsnum=default (fpsnum, 0)
    	fpsden=default (fpsden, 1)
    	BaseName=LeftStr(ScriptName(),StrLen(ScriptName()) - 4)
    	return EXIST (BaseName + ".dgi") ? DGSourceIM (BaseName + ".dgi") : \
    	EXIST (BaseName + ".d2v") ? MPEG2Source (BaseName + ".d2v") : \
    	EXIST (BaseName + ".avi") ? AVISource(BaseName + ".avi") : \
    	EXIST (BaseName + ".mkv") ? LWLibavVideoSource(BaseName + ".mkv", fpsnum=fpsnum, fpsden=fpsden) : \
    	EXIST (BaseName + ".ts") ? LWLibavVideoSource(BaseName + ".ts", fpsnum=fpsnum, fpsden=fpsden) : \
    	EXIST (BaseName + ".mp4") ? LSMASHVideoSource(BaseName + ".mp4", fpsnum=fpsnum, fpsden=fpsden) : \
    	EXIST (BaseName + ".m4v") ? LSMASHVideoSource(BaseName + ".m4v", fpsnum=fpsnum, fpsden=fpsden) : \
    	Assert(false, "AVSSource:  ERROR:  No supported source file found.")
    }
    All I have to do it put to put AVSSource at the top of any AVS script, rename the script to match the video file and away we go.

    If I'm dealing with a series, all I have to do is create a copy of a script for each of the episodes and give them the same name as the file.

    I've put "AVISynth script" in the New context menu... that only allows for a single template but I can put anything I want in the template and just comment in/out or delete as is needed.

    Rather than doing it manually I've got cmd/batch files all over the place for these kind of purposes.

    Before I wiped all my hard drives my batch files would iterate through each line of an ASV script looking for meta commands, get info about the file from MediaInfo, read settings files I left in the same folder with the video and modify the AVS script and output settings accordingly.
    Quote Quote  
  5. copy that text into notepad and save it As something.BAT, then drop your file onto that batch and it will open just created avisynth script in VirtualDub right away,
    just set that VirtualDub path correctly depending where it resides in your PC:
    Code:
    @echo off
    set virtualdub="C:\tools\VirtualDub\VirtualDub.exe"
    set "temp_folder=C:\Temp"
    
    if not exist "%temp_folder%" MD "%temp_folder%"
    
    echo ffvideosource("%~1")          > "%temp_folder%\%~n1.avs"
    
    start "" %virtualdub%  "%temp_folder%\%~n1.avs"
    exit
    if all you do is the same thing in VirtualDub you can also automatize even that, creating vcf file (saving it after first manual filter setting in VirtualDub), so then script could be modified to fix the whole bunch of files at once

    also did not test this, it might index your MOV file for a while, so it might sort of freeze virtualDub or something, it'll take a while, not sure how it is going to behave, but I'm sure you know that ...
    Last edited by _Al_; 12th Jan 2017 at 13:06.
    Quote Quote  
  6. For MOV/MP4 , L-smash (LSMASHVideoSource() ) might be a better option. It doesn't require indexing

    If you're not actually using vdub , just editing the script and preview or perhaps encoding, avspmod has templates as well - so you can right click context on any video file, open with avspmod and it will use the appopriate source filter that you stipulated in the templates
    Quote Quote  
  7. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    I have a batch that does exactly that... except it echoes "AVSSource" into the AVS file instead. It's actually my DGIndex batch, I drag the file(s) I want to index onto it, it indexes it and echoes an AVS into being.

    You could do the same with ffmsindex.exe.

    Then you wouldn't have to wait for ffvideosource to index the files if you're manually opening them in VirtualDub...

    (I have Windows set to open AVS files using VirtualDub by default.)
    Quote Quote  
  8. Originally Posted by videobruger View Post
    using a batch file to write the .avs...

    echo ffvideosource("%1") > temp.avs
    That's what I do. I have different batch files for different source filters. The MPEG 2 batch file runs DgIndex to build the index file then creates an AviSynth script with Mpeg2Source() and some default filters like TMF() and TDecimate().

    Originally Posted by videobruger View Post
    I use Types to make the context menu item
    But I just put the batch files in the SendTo folder. Then I can right click on a video file and select Send To -> filename.bat.
    Quote Quote  
  9. I made this. It helps me, maybe it helps you. It shows a bar of custom icons where you can drop files and it will copy avs-files (or any text-files) from templates where a custom string (%%%% default) is replaced by the file-name of the dragged file. Rather configurable and I think somewhat self explainatory. Look in the DropThis.ini.

    Name:  DropThis.jpg
Views: 961
Size:  29.4 KB
    Image Attached Files
    Quote Quote  
  10. Many thanks, people. This is one more step to making video editing suck less. It never occurred to me that this is an easy fix I could've pondered a long time ago and not bottled up my impatience until the last minute. You'd think someone who knows enough regedit to make a custom "Play with MPC" context menu tab for AVS files would figure this out too. I'm dumb.

    Never got around to trying that LSmashSource thing. I'd prefer a universal one that works with all file types. But it can't be frame-accurate without an index, no?
    Quote Quote  
  11. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    MP4 has a built in index that describes every single frame. That's how LSmashSource works without creating an index.

    An MKV index only usually describes key frames, ts indexes are non-existent.

    AVI is constant frame rate only, so its contents are predictable, which is why AVISource works without needing to create an index too.
    Quote Quote  
  12. So MKV files can never be opened frame-accurately without an index? And what about H264 AVIs? I vaguely remember having issues opening them with Avisource before.
    Quote Quote  
  13. Originally Posted by Aludin View Post
    So MKV files can never be opened frame-accurately without an index? And what about H264 AVIs?
    A program could always seek back to the start and parse the video frame by frame.
    Quote Quote  
  14. Would probably be slow as hell I'd imagine. Also, is this why MP4 files are slightly bigger than MKVs?
    Quote Quote  
  15. I'd not thought about it until now, but how to media players do it? Or are they not considered reliably frame accurate?

    I ask, because often I open a script with one instance of MPC-HC and the original video in another, and run them both on my TV for comparisons. As a result, I'm regularly using MPC-HC's Naviagte/GoTo menu to navigate to identical frame numbers and I'm not sure they ever disagree. Navigation is very quick. Sources are mostly AVC in an MKV, so that's what I've had the most experience with. Actually, full disclosure... the player opening the script and the player opening the source are always off by a single frame, but I think that relates to Avisynth counting from frame zero. I've never bother to look closely at that.

    When encoding video if I get x264 to write directly to an MKV, that MKV can be opened, but it's often slow as the way I understand it the splitter has to create an index, but after remuxing the video to a new MKV with MKVToolNix it's not necessary and navigation is always fast.

    So why the need for an index file in order to encode? No doubt there's a reason, but why can MPC-HC navigate quite accurately without one? At least when it comes to MKVs created by MKVToolNix.
    Quote Quote  
  16. Players don't navigate accurately. Just like DirectShowSource(), they're often off by a frame or two.
    Quote Quote  
  17. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    MKVs can have an index, it's just it's not MANDATORY and it doesn't have to point at anything in particular.

    MPC-HC can navigate an MKVMerge MKV because MKVMerge writes in an index that points to every I-frame. All MPC-HC has to do to navigate to any particular time is to find the closest I-frame BEFORE it needs to go, then decode all the necessary frames until it finds the correct one. What MPC-HC CAN'T do is find a frame with a particular NUMBER, because MKVs are natively VFR and the index doesn't mention the number of a frame and there's no way of knowing how many frames are between any two seek points unless somehow you know it's CFR.

    In MP4 an index IS mandatory, it points at everything and it describes it all too.
    Last edited by ndjamena; 12th Feb 2017 at 03:29.
    Quote Quote  
  18. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Interestingly enough MPC-HC's "Go To..." dialogue has both a "Go To Time" section and a "Go To Frame" section. The thing is, the "Go To Frame" section asks for a frame rate and you can change it if you like. It's actually nothing more than a calculator and in a VFR video will take you to the wrong frame (if you're just counting encoded frames).
    Quote Quote  
  19. Guys, is there a way to make the .ffindex file in a fixed location rather than in the same place as the video? I can't open videos inside write-protected drives cuz of this.
    Quote Quote  
  20. Originally Posted by Aludin View Post
    Guys, is there a way to make the .ffindex file in a fixed location rather than in the same place as the video? I can't open videos inside write-protected drives cuz of this.
    Something like this should do it:

    FFVideoSource("D:\video.mkv", cachefile="E:\Some Folder\video.ffindex")
    Quote Quote  
  21. Ah, cachefile. Thanks hello_hello.

    I need some help on the CMD grammar, tho. Using %1 seems to paste the entire path rather than only the filename. Which parameter denotes only the filename and extension?

    My current script:
    echo ffvideosource(%1, cachefile="M:\%1") > %1.avs
    "C:\Program Files\VirtualDub-1.6.17\VirtualDub.exe" M:\%1.avs
    Quote Quote  
  22. Code:
    echo ffvideosource("%~1", cache=true, cachefile="M:\%~n1.ffindex") > "M:\%~n1.avs"
    "C:\Program Files\VirtualDub-1.6.17\VirtualDub.exe"  "M:\%~n1.avs"
    Using %1 in avisynth script is a particular situation, where you need to use expanded form for %1, which is %~1. Windows would not create quotes if there is a space in it. So you add them manually: "%~1"
    Quote Quote  
  23. For the first argument:

    Code:
    %~1 full dirve,path,name,extension without quotes
    %~d1 = drive, including :
    %~p1 = path, including leading and trailing \
    %~n1 = name
    %~x1 = extension
    %~dpnx1 = full drive, path, name, extension, without quotes, same as %~1
    "%~dpnx1" = full drive, path, name, extension, with quotes
    "%~dpn1.alt" = full drive, path, name, .alt extension, with quotes
    Replace the 1 with a 2 for the second argument. Etc.
    Quote Quote  
  24. Friends, your assistance is required again. I need to do this for an entire folder now. The old right-click context menu script could do this but only for like 19 videos at a time for some reason and even then it sometimes fails. I have hundreds of speedruns I wanna quickly go thru before finally deleting this crap that's been taking up space for years.

    My current script: (thanks hello_hello for FFMS4)
    Code:
    echo FFMS4("%~1", atrack=-1, cachefile="M:\cleanup\%~n1%~x1.ffindex") > "M:\cleanup\%~n1%~x1.avs"
    echo AssumeFPS(FrameRate*2.0) >> "N:\cleanup\%~n1%~x1.avs"
    echo TimeStretch(Tempo=200.0) >> "N:\cleanup\%~n1%~x1.avs"
    Quote Quote  
  25. You can use a FOR loop to handle all the mp4 files in a folder. I also like to use a separate worker batch file that does the encoding. You can drag/drop a source file onto that worker batch file for testing. Here the worker is called _DoOne.bat:

    Code:
    echo a = LSmashAudioSource("%~dpnx1") > "%~dpn1.avs"
    echo v = LSmashVideoSource("%~dpnx1") >> "%~dpn1.avs"
    echo AudioDub(v, a) >> "%~dpn1.avs"
    echo AssumeFPS(FrameRate*2.0) >> "%~dpn1.avs"
    echo TimeStretch(Tempo=200.0) >> "%~dpn1.avs"
    ffmpeg -i "%~dpn1.avs" -preset veryfast "%~dpn1.mkv"
    del "%~dpn1.avs"
    Use a FOR loop in a batch file to call it (I called it DoAll.bat):

    Code:
    For %%F in ("*.mp4") do ( _DoOne.bat "%%F" )
    Put the two batch files in the folder with the MP4 files. If you use a different name for the worker batch file you'll need to modify the name in the FOR loop too. Note I'm using LSmash to load the audio and video, ffmpeg is used to encode the AVS script, the AVS script is deleted after the encoding, and I'm converting from MP4 to MKV in the same folder.
    Quote Quote  
  26. Thanks jagabo, this worked. But I don't need to convert them, just turn them into loadable AVS files to play in media player at faster speed. If I use its internal speedup feature, the playback is craptastically choppy. AVS scripts play perfectly smooth, hence my need for this updated script.
    Quote Quote  
  27. Originally Posted by Aludin View Post
    Thanks jagabo, this worked. But I don't need to convert them, just turn them into loadable AVS files to play in media player at faster speed. If I use its internal speedup feature, the playback is craptastically choppy. AVS scripts play perfectly smooth, hence my need for this updated script.
    Why don't you just make a batch file that creates the script, spawns the player to play it, then deletes the script. You can put that batch file in your SendTo folder which will allow you to right click on any video and select Send To -> name.bat -- where name.bat is the name of your batch file, say, PlayFast.bat. This way you won't clutter up your disk with a bunch of AVS scripts.

    Code:
    echo a = LSmashAudioSource("%~dpnx1") > "%~dpn1.avs"
    echo v = LSmashVideoSource("%~dpnx1") >> "%~dpn1.avs"
    echo AudioDub(v, a) >> "%~dpn1.avs"
    echo AssumeFPS(FrameRate*2.0) >> "%~dpn1.avs"
    echo TimeStretch(Tempo=200.0) >> "%~dpn1.avs"
    "g:\program files\mpcbe64\mpc-be64.exe" "%~dpn1.avs"
    del "%~dpn1.avs"
    Change the path to the player you want to use.
    Quote Quote  
  28. Because it's a lot easier to have a saveable playlist that keeps track of which ones I watched and which ones I didn't. I already have the one-click open script that you helped me make in 2017, but I don't wanna have to do that for every single video in the folder. I'm getting lazier or more industrious, who knows which. What I need to do is stop binge-downloading shit and then forget about it for years. Hell, I even lost interest in these specific speedruns but still wanna at least quickly view them so all that effort to grab them years ago wasn't for nothing. Twitch is notoriously annoying for downloading and it got worse lately.
    Quote Quote  



Similar Threads