VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. I have ~1100 files totaling approximately 120 GB of HD dashcam footage I'd like to make into a five minute timelapse or so. I want to use Avidemux to automate this and know what I need to do for each video and have saved that into a project file, but unfortunately every time I try the example script from the AVI Demux page or another one I found on the forums here it causes the app to crash if I try to evaluate the script or run the script project. I just need to change the FPS, resample, change again, and resample again, both times reencoding to mpeg4 ffdshow or xvid codecs.

    Here's one of the scripts I've been trying to use for one of the passes (changing FPS, or resampling)

    //AD <-
    /*
    Simple script that scans the orgDir directory
    and loads all .xyz files and encodes them to Xvid+MP3 AVI
    The resulting file is put in destDir directory

    Using new directorySearch API
    */
    var app = new Avidemux();
    var ds = new DirectorySearch();
    var srcDir;
    var dstDir;
    var reg = new RegExp(".$");
    var extReg = new RegExp(".*[.](.+)$");

    //this is the directory separator char for WINDOWS! for *nix, it should be: sep = "/";
    var sep = "\\";
    var fileExt;
    var pickedExt;
    var dstPath;

    var filesDone = 0;
    var filesSkip = 0;
    var filesErrd = 0;

    displayInfo("Pick any file in the source directory. All files of that type (.xyz) will be processed. Filename will

    be ignored but the file extension will be used! \r\n\r\ne.g. If you want to process AVIs, be sure to pick any .avi

    file!");

    //pop up a dialog asking for a source file. We will remove the file name leaving just the dir
    srcDir = fileReadSelect();

    //run the extReg regex designed to pull out just the extension of this file
    pickedExt = srcDir.replace(extReg, "$1").toLowerCase();

    displayInfo(pickedExt + "Pick the destination directory and enter a random filename. Filename will be ignored");

    //pop up a dialog asking for a destination file. We will remove the file name leaving just the dir
    dstDir = fileWriteSelect();

    //extract just the path part of each picked file
    srcDir = pathOnly(srcDir);
    dstDir = pathOnly(dstDir);


    while(srcDir.charAt(srcDir.length-1) == sep){
    srcDir=srcDir.replace(reg,"");
    }
    while(dstDir.charAt(dstDir.length-1) == sep){
    dstDir=dstDir.replace(reg,"");
    }


    if(ds.Init(srcDir))

    while(ds.NextFile())
    {

    dstPath=ds.GetFileName();


    if(!ds.isNotFile && !ds.isDirectory && !ds.isSingleDot && !ds.isDoubleDot)
    {
    //we want to do some work with the extension so pull it out now
    ext=ds.GetExtension();

    //is the extension of this file the same as the one we picked?
    if(ext.toLowerCase() == pickedExt)
    {
    //build the output file name. To avoid ovwriting source file, if dir is the same prefix a _
    if(srcDir.toLowerCase() == dstDir.toLowerCase()){
    dstPath = dstDir + sep + "_" + ds.GetFileName() + ".avi";
    }else{
    dstPath = dstDir + sep + ds.GetFileName() + ".avi";
    }

    //build the source file path
    srcPath = srcDir + sep + ds.GetFileName();

    //we set this option first. If Avidemux loads a file it thinks need unpacking/time mapping
    //then setting this option now will ensure that operation is done when we load
    app.forceUnpack();

    //load the file. this action also purges all the video filters and codec settings
    app.load(srcPath);

    //see if the audio is VBR. if it is, this builds a time map. if it is not, this does nothing
    app.audio.scanVbr();

    //this might not need doing if forceUnpack has been stated. I dont think it can be done
    //twice though so its safe to repeat here
    app.rebuildIndex();

    //all the code in this section was generated by the app. if you want to write a script and use filters
    //you can get the app to do the hard work by:
    // load one of the files you will script
    // set all the video and audio options you want
    // on file menu, pick Save Project as (note: NOT save avi file!!)
    //the job file you save will have a section detailing the filters. copy it

    //re-encode to xvid 2 pass, bitrate = 1000 (plus 128 for audio = 1128 kbps, 507.6 megs per hour)
    //all options are set to simple, no GMC, no Qpel etc so that standalone simple players are ok

    adm.videoCodec("ffMpeg4", "params=CQ=2",

    "lavcSettings=:version=2:MultiThreaded=2:me_method =5:_GMC=False:_4MV=True:_QPEL=False:_TRELLIS_QUANT =True:qmin=2:qm

    ax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=0:is_l uma_elim_threshold=1:luma_elim_threshold=429496729 4:is_chroma_eli

    m_threshold=1:chroma_elim_threshold=4294967291:lum i_masking=0.050000:is_lumi_masking=1:dark_masking= 0.010000:is_dar

    k_masking=1:qcompress=0.500000:qblur=0.500000:minB itrate=0:maxBitrate=0:user_matrix=0:gop_size=250:i nterlaced=False

    :bff=False:widescreen=False:mb_eval=2:vratetol=800 0:is_temporal_cplx_masking=False:temporal_cplx_mas king=0.000000:i

    s_spatial_cplx_masking=False:spatial_cplx_masking= 0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol =False:bufferSi

    ze=0:override_ratecontrol=False:dummy=0"
    )

    adm.addVideoFilter("changeFps", "oldMode=0", "oldFpsDen=1000", "oldFpsNum=30000", "newMode=0", "newFpsDen=1000",

    "newFpsNum=200000")

    adm.audioClearTracks()

    adm.setSourceTrackLanguage(0,"unknown")

    adm.audioAddTrack(0)
    adm.audioCodec(0, "copy");

    adm.audioSetDrc(0, 0)
    adm.audioSetShift(0, 0,0)

    adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")


    //write that file
    app.save(dstPath);

    } else{ //we decide not to process this file
    //some diagnostic info incase you wonder why a whole dir of files arent processing
    whyNot = dstPath + " wasnt processed because: ";
    if(ds.isNotFile)
    whyNot += "it is not a file, ";
    if(ds.isDirectory)
    whyNot += "it is a directory, ";
    if(ds.isHidden)
    whyNot += "it is hidden, ";
    if(ds.isArchive)
    whyNot += "it is marked for archive, ";
    if(ds.isSingleDot)
    whyNot += "it is a meta-ref to the current dir (.), ";
    if(ds.isDoubleDot)
    whyNot += "it is a meta-ref to the parent dir (..), ";

    //whats that reason now?
    print(whyNot);
    }
    }
    }
    ds.Close();
    }
    Quote Quote  
  2. Figured out how to do it with a combination of avidemux to stitch many videos together and virtual dub 32 bit with ffdshow and directshow plugins.

    Follow this advice to get vdub to work with the h264 stitched-together files outputted from avidemux:

    http://www.bikingbrian.com/2009/07/12/opening-h264-mp4-files-in-virtualdub/

    Then used fast recompress with ffdshow output codec and frame rate changes with decimation to get the timelapse effect I wanted. VirtualDub and Avidemux are the best free tools I've ever gotten to use, and the community here and elsewhere makes them even better.
    Quote Quote  
  3. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    You could as well have used AviSynth to load several clips, concatenating them logically with (Un)AlignedSplice, and building a timelapse with SelectEvery... and alike functions.

    For a more current and feature-rich modification of VirtualDub, try the VDubFilterMod project on SourceForge.
    Quote Quote  



Similar Threads

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