VideoHelp Forum

+ Reply to Thread
Results 1 to 27 of 27
Thread
  1. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Hi all

    Newb here.

    I'm using Avidemux and loving it, so far.

    I have, as an input file, a 25fps mp4 x264 video which is showing time lapse footage.

    On average, each image is displayed for 3 frames, sometimes 4.

    I'd like to remove all of the duplicates, if possible, so that each image is only displayed for the duration of one frame.

    How?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  2. AviSynth and TDecimate() will work pretty well. You might get acceptable results with a simple decimate in VirtualDub.
    Quote Quote  
  3. I haven't used this avisynth filter, but maybe getdups sounds like it might work for this
    http://avisynth.org.ru/getdups/getdups.html

    is a special plugin for selecting unique duplicate frames from clip, it return frames which have copies only, by one from the series (group).
    Quote Quote  
  4. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Can the avisynth filters (or any others that do the same thing) be imported and used with avidemux?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  5. Originally Posted by robindean View Post
    Can the avisynth filters (or any others that do the same thing) be imported and used with avidemux?
    yes, through avsproxygui.exe - it's included with the avidemux download

    although most of filtering and editing that you can do in avidemux can be done in avisynth too
    Quote Quote  
  6. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    I'm wondering ... does AVISynth do this via graphical comparison (one frame against another) or via some sort of frame data?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  7. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by robindean View Post
    I'm wondering ... does AVISynth do this via graphical comparison (one frame against another) or via some sort of frame data?
    The first.

    http://avisynth.org.ru/getdups/getdups.html
    5. Uses method and code of pixels block comparing from Dup plugin
    Quote Quote  
  8. TDecimate() preferentially throws out duplicate frames (by comparing them). It sounds like GetDups() does the same.
    Quote Quote  
  9. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Okay ... I'm in trouble here. Let's take it from the top.

    I downloaded AVIDemux, created a project, imported a video and rigorously configured my intended output tab by tab.

    The one thing missing from my output is the removal of duplicate frames. So, I've downloaded AVISynth as well as the GetDups archive. AVISynth is installed. Where do I put the GetDups function and all of the contents that came with it?

    I'm hoping that I can do this from within AVIDemux so that I don't have to re-encode a second time via another program.

    Step by step, how do I get a filter working that will do this thorugh the AVIDemux GUI?

    Thanks for all of this, by the way.
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  10. Put GetDups.dll in AviSynth's Plugins folder and it will load automatically. I'd put GetDups.html (the docs) there too just for future reference. You don't need the rest of the files.
    Quote Quote  
  11. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Yes ... but then, won't that make it available only to AVISynth?

    Again, I'm hoping I won't have to encode twice.

    How do I make use of the AVISynth GetDups plugin via AVIDemux without any need to double the encoding?

    My humble apologies for not being better anchored in this. I'd be happy to use AVISynth alone but the settings I'm using are pretty elaborate within AVIDemux.
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  12. Avisynth is a frame server. Whatever your script does, it feeds frames to another application, in this case avidemux through avsproxygui (to avidemux, the script looks like a video with whatever filters you stipluated in the script)

    So you need to create a script plus whatever filters. It' s just a text file saved, then the extension renamed to .avs

    e.g.
    DirectShowSource("video.mp4")
    GetDups()
    #or whatever filter

    In this case I would actually use a better source filter than directshowsource() , since it's unreliable (dependent on system installed filters and splitters) and not necessarily frame accurate. I would use FFMpegSource2 instead, that has to be downloaded and placed in the plugins folder as well

    FFMpegSource2("video.mp4")
    GetDups()

    As I said earlier, I've never used this particular filter, I don' t know if it works or how it works, but there are instructions and examples in the documentation (all avisynth filters have documenation bundled)

    If that doesn't detect the dupes properly, you could try tdecimate

    What do you plan to do with the audio? Because it won't match
    Last edited by poisondeathray; 10th Mar 2010 at 23:20.
    Quote Quote  
  13. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Okay. I'm BEGINNING to see how this works.

    You see, I'm a career studio musician. In Cubase (a music program) we have something called "ReWire" which, in it's own bizarre fashion, detects other running apps. It can send music and tracks into those apps and pull them back in after they've been externally altered ... all in real time.

    Is that SORT of what you mean?

    As late as it is, I plan to hop back onto this issue tomorrow. If you're willing, I'll take baby steps and build this thread around my effort. I'll do some googling first, to learn more about the progs but, upon confusion, I might need more guidance (I'm pretty slow and a little dim).
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  14. sort of.... think of it like a proxy. So to the other application, that tiny .avs file (it's just a few lines of text) looks and smells like a video with whatever filters you specifed. The .avs file references the real video , and applies filters , so the other application sees the old video with the video filters applied, not the old video as it used to be.

    you can read about the basics
    http://avisynth.org/mediawiki/Main_Page

    EDIT: I just played around with the filter and dedup() seems to do a better job
    Last edited by poisondeathray; 10th Mar 2010 at 23:53.
    Quote Quote  
  15. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Cool. The fog is beginning to lift. I can feel it.

    Would you be willing to type up a step-by-step?

    I have all of my ingredients and the prep-work is done, outside of Synth.

    I've got my video.
    I've got Demux.
    I've got Synth.

    Does synth already have dedup() built in?

    Either way ... how do I align all of this noise? LOL.
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  16. How about a sample of the video? There's probably a pattern to the duplicate frames giving the video a 'base' framerate allowing the duplicate frames to be pulled out using more conventional (and perhaps more accurate) AviSynth methods.
    Quote Quote  
  17. I would try TDecimate(mode=2, rate=8). Step through the video with that and see if there are any duplicate or missing frames. Adjust the rate as necessary.

    TDecimate() is part of the TIVTC package:
    http://avisynth.org.ru/docs/english/externalfilters/tivtc_tdecimate.htm
    Quote Quote  
  18. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    The video is on youtube here: http://www.youtube.com/watch?v=4yFn7Oeo-w0&feature=related

    I used a FireFox video download helper to get the HQ22 version (53mb).

    The pattern I'm noticing is that each image gets 3 frames ... now and then 4.

    AVIDemux has a function that says "only mux every 'n' number of frames" ... would that aid me at all?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  19. Why do you want to decimate the video? If you think removing all the duplicate frames is going to make it compress better -- it won't make much difference. With high compression codecs exact duplicate frames take almost no bitrate to encode. If you want to make it play faster:

    DirectShowSource("video.mp4")
    BilinearResize(640,360) # to make a smaller file for upload
    TDecimate(mode=2, rate=8)
    AssumeFps(25)

    Quick Xvid AVI attached. There might be a few dups or missing frames. You can fine tune the rate.
    Image Attached Files
    Quote Quote  
  20. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    What codec do you use to convert colorspace to something these plugins can use? Everything I've tried has given me the colorspace error except for x264.avi. I'm setting the colorspace in Virtualdub to both YUY2 and YV12 but it doesn't matter. I even set Huffyuv to YUY2 but I still get the error. I don't want to have to convert everthing to x264 just to get rid of all the duplicate frames.

    Jagabo, I tried your TDecimate(mode=2, rate=8) and it didn't do anything. I got rid of rate=8 and set mode to 0 and it worked but seeking is very slow with x264. It gave me two duplicate frames at the beginning and at the end, it was the last frame for about 50 frames. That's easy enough to fix by setting the in and out points but not being able to use a different codec than x264 is killing me.

    Nevermind, I just used the built in decimate in Virtualdub under framerate and it worked pretty well without having to convert colorspace or re-encode.
    Quote Quote  
  21. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    It's not the compression ... it's the slow animation. In particular, it's the "strobing" look of it that I'm trying to be rid of.

    My initial thought is that I can first remove all duplicates, then apply visual filters (grayscale, auto white-balance) and export to FLV 25fps (I recently decided that mp4 complexities are driving me out of my mind).

    I want exactness in this, meaning that I don't want to use and algorithm that "works with a few mistakes here and there".

    If the frame is identical to the previous ... JUKE it.

    Suggestions?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  22. There is no such thing perfect dupe detection, short of doing it manually. There are always errors.

    You have to tweak the parameters manually. There are threshold values for determining "hey is this frame exactly the same or slightly different", whether you are under or over the criteria for discarding. Some either slip through or some good frames are lost, you tweak the parameters to which side you want to be on. It sounds like you want to be more on the discard side.

    Dupe detection is preferred over straight decimation in those cases where the pattern is different. If you have repeats every 3, then straight decimation makes more sense

    If you still have the original sequence that preceded the creation of the timelapse, it would be better to do it correctly in the first place
    Quote Quote  
  23. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Well, after placing "ffms2.dll" in the plugins folder, I'm toying around with it just to get things rolling. I've opened up Avisynth gui and then clicked on the "custom" tab. There, I've typed in the following custom script:

    FFMpegSource2("C:\Documents and Settings\John Smith\Desktop\city.mp4")
    Crop(0, 0, -100, -100)
    Greyscale()

    So far, all I get is an error saying "FFMpeg2 is not a function" blah blah blah.

    What next?
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  24. As jagabo figured out, the framerate's an even 8fps. I'd do it slightly differently, like so:

    TDecimate(Mode=0,Cycle=25,CycleR=17)

    That does a perfect job on it, as near as I can tell. And I also wonder about the reason for doing this. I don't quite see the point of encoding it yet again, particularly back to 25fps with the dupe frames reinserted again, degrading it even further. I don't really see any 'strobing', but just slightly jerky playback caused mostly by the uneven spread of dupe frames. It might look better at 24fps so each frame is repeated twice.
    Quote Quote  
  25. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    The audio is going to be gone. I'd like to be rid of the jerky playback. My thought was that elminating dupes and then playing back at 25fps would provide a smoother animation transition. I don't have the original, so I'm stuck editing what is on youtube.

    Would you mind checking out post #23? I'm having trouble getting this thing to "go".
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  
  26. You need the .avsi from the zip file in the plugins folder as well (it writes a helper function ffmpegsource2() , which can allow for audio)

    otherwise, just replace ffmpegsource2() with ffvideosource() in your script
    Quote Quote  
  27. Member
    Join Date
    Mar 2010
    Location
    Chicago
    Search Comp PM
    Goooooooal!

    Thanks guys. I'm ready to rock and know what to do for future reference.

    Much appreciated!
    PowerBook G4, OSX 10.4.11
    HP ZD7000A, Windows XP Professional
    Quote Quote  



Similar Threads