VideoHelp Forum




+ Reply to Thread
Results 1 to 13 of 13
  1. Member
    Join Date
    Sep 2008
    Location
    Iran, Islamic Republic of
    Search Comp PM
    hi all.
    i want some technique to detect where a video in censored.
    i have a original video and a censored video and i want to find where its censored.
    (for example i want to find out original video from time 00:10:15.125 to 00:10:33.237 is cutted and censored video is result...)

    and how i can do it when i have two edition of video (like vcd and DVD where vcd in censored edition of DVD movie and DVD is original).

    sorry if my english is too bad...
    Quote Quote  
  2. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Open two instances of MPC, with one video in each, and watch them side by side.

    I don't know of any software that will watch and compare them for you.
    Read my blog here.
    Quote Quote  
  3. Member
    Join Date
    Sep 2008
    Location
    Iran, Islamic Republic of
    Search Comp PM
    Originally Posted by guns1inger
    Open two instances of MPC, with one video in each, and watch them side by side.

    I don't know of any software that will watch and compare them for you.
    thanx my friend but this solution takes Long time and dont gets exact statistics (i want result ,spots milliseconds).

    i'm searching for simpler way...
    Quote Quote  
  4. Member
    Join Date
    Mar 2004
    Location
    Texas, USA
    Search Comp PM
    What you want is the *NIX "diff" utility (that works on text files), but for video. I really don't think you are going to find it.

    You can get more accurate if you open them in 2 tracks of an NLE. That would allow you to spot, to frame accuracy, where the cuts are. But you are going to have to go through it manually.

    Steve
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by guns1inger
    I don't know of any software that will watch and compare them for you.
    This can be done (up to a point) using Avisynth.
    Compare each frame of the two clips with LumaDifference until you find a mismatch (difference greater than some threshold value).

    A while ago, I wrote a function to do the converse (find a matching frame).
    http://forum.doom9.org/showthread.php?p=1258933#post1258933
    This could be suitably amended to assist with this job.
    Quote Quote  
  6. Member
    Join Date
    Sep 2008
    Location
    Iran, Islamic Republic of
    Search Comp PM
    Originally Posted by Gavino
    Originally Posted by guns1inger
    I don't know of any software that will watch and compare them for you.
    This can be done (up to a point) using Avisynth.
    Compare each frame of the two clips with LumaDifference until you find a mismatch (difference greater than some threshold value).

    A while ago, I wrote a function to do the converse (find a matching frame).
    http://forum.doom9.org/showthread.php?p=1258933#post1258933
    This could be suitably amended to assist with this job.
    thanks my friend.
    this solution protects me from wasting much time.
    so I have one unanswered question:

    and how i can do it when i have two edition of video (like vcd and DVD where vcd in censored edition of DVD movie and DVD is original).
    Quote Quote  
  7. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Interesting function, although it requires the two sources match is most (all ?) other respects - resolution, framerate etc., and that you start each on exactly the same frame. So if you have two versions of a DVD, from different distributors, with one in PAL and one in NTSC, for example, it going to struggle. And comparing a single frame to a clip is a simple, one pass test - does it match frame 1 ? does it match frame 2 ? frame 3 ? etc.

    Comparing video clips will require multiple passes and a lot more decision logic to determine what it does when the first difference is found, and how it will move past the difference to the next point of similarity to look for the next difference.
    Read my blog here.
    Quote Quote  
  8. Originally Posted by epsi1on
    and how i can do it when i have two edition of video (like vcd and DVD where vcd in censored edition of DVD movie and DVD is original).
    Start by resizing to the same frame size. You might also have to change frame rates.

    You can also use a AviSynth script with a subtract function:

    Code:
    # If Videos start at different frames 
    frameadjust=2
    name1="video1.avi"
    name2="video2.avi"
    
    v1 = AviSource(name1).BilinearResize(320,240)
    v2 = AviSource(name2).BilinearResize(320,240).trim(frameadjust,0)
    
    StackHorizontal(v1.subtitle(name1),v2.subtitle(name2))
    Then match visually. Use the frameadjust variable to match each section.
    Quote Quote  
  9. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    The big problem with any automated approach, and even a manual approach such as Jagabo's script, is that it stops working once you hit the first difference.

    Why ?

    Because at that point you then have to identify the next point in the video where the clips line up again, and start looking for the next difference. As each difference is found, the start and end point of the difference, and the clip in which is appears, needs to be logged. Depending on the cuts, one or both clips could have differences. It may not just be censorship at play, but totally different edits for different regions.

    However, lets assume that the process is purely to find parts in clip a that are not in clip b.

    Start the two clips together and scan until there is a difference. At this point the process needs to stop playing b, and continue playing through clip a until the clip b lines up again, then continue playing both until the next difference is found. Repeat until the end of the clip.

    So far, the best suggestion for doing this is either two separate players playing side by side, where the operator can stop and start one player as necessary, or an NLE whereby the clips can be aligned form the start, scanned for the first difference, then realigned to scan for the next difference, and so on.

    Both are, like it or not, manual processes.

    Theoretically it could be automated, but it would need a lot more smarts than a single avisynth script. You would need one to look for matching frames, one to look for different frames, and something sitting over the top watching frame counts, logging differences, and managing the re-alignment process.

    Sounds like quite a programming challenge.
    Read my blog here.
    Quote Quote  
  10. That's why I included the frameadjust variable. You change it to realign the two videos each time you find a discontinuity. Then open the script again...
    Quote Quote  
  11. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by jagabo
    You can also use a AviSynth script with a subtract function: ...
    Did you forget to put in the Subtract?

    Originally Posted by guns1inger
    Theoretically it could be automated, but it would need a lot more smarts than a single avisynth script. You would need one to look for matching frames, one to look for different frames, and something sitting over the top watching frame counts, logging differences, and managing the re-alignment process.
    That's why I said 'up to a point' and 'help with' this job.
    I had in mind a semi-manual process, a bit like Jagabo's idea of adjusting the start point after each cut, but automating the searches for each mismatch and rematch instead of doing it by eye.
    Sounds like quite a programming challenge.
    That's irresistible! If I find time later, I will have a go.
    Quote Quote  
  12. Originally Posted by Gavino
    Originally Posted by jagabo
    You can also use a AviSynth script with a subtract function: ...
    Did you forget to put in the Subtract?
    LOL. I originally had the subtract function in the post but decided it was simpler just to see the two videos side by side -- so I took the subtractions out. But forgot to change the text of the message. Compare.avs with subtract:

    Code:
    # If Videos start at different frames 
    frameadjust=2
    name1="video1.avi"
    name2="video2.avi"
    
    v1 = AviSource(name1).BilinearResize(320,240)
    v2 = AviSource(name2).BilinearResize(320,240).trim(frameadjust,0) 
    sub = v1.subtract(v2) 
    substrong = sub.levels(112,1,144,0,255) 
    
    StackVertical(StackHorizontal(v1.subtitle(name1),v2.subtitle(name2)),StackHorizontal(sub.subtitle("Difference"),substrong.subtitle("Difference amplified")))
    This type of comparison is best for looking at small differences beteen videos -- like before and after compression.
    Quote Quote  
  13. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by Gavino
    If I find time later, I will have a go.
    Right, here it is.
    Put this in a file called findcuts.avs:
    Code:
    # FindCuts (Gavino, 13th Sept 2009)
    # Given a clip and another which is notionally 'the same' but with one or
    # more cuts, this function displays the cut sections (with timecodes),
    # optionally logging the frame numbers of each cut to a file.
    # Assumptions: the second file is a 'cuts-only' version of the first, 
    # hence all frames in the cut file have an equivalent in the uncut file,
    # in the same order.
    # Requires GScript (http://forum.doom9.org/showthread.php?t=147846)
    
    function FindCuts(clip full, clip cut, string "logFile", int "thresh") {
      thresh = Default(thresh, 2)
      log = Defined(logFile)
      txt = "Finding cuts ..."
      sep = ", "
      if (log) { WriteFileStart(full, logFile, "txt") }
    
      show = full.ShowSMPTE() 
      result = BlankClip(full, length=0)
      current_frame = 0
      limit = full.FrameCount
    
      # loop over sequence of cuts:
      while (current_frame < limit) {
        # find next cut:
        while (current_frame < limit && LumaDifference(full, cut) <= thresh) {
          current_frame = current_frame+1
        }
        if (current_frame < limit) { # a cut was found
          start = current_frame
    
          # find next matching frame:
          frame = cut.FreezeFrame(start, limit-1, start)
          current_frame = current_frame+1
          while (current_frame < limit && LumaDifference(full, frame) > thresh) {
            current_frame = current_frame+1
          }
          end = current_frame-1
          if (log) {
            WriteFileStart(full, logFile, "start" , "sep", "end", append = true)
            current_frame = end+1 # WriteFileStart sets current_frame to -1 !!!
          }
          result = result + show.Trim(start, end)
          # add extra frames to keep clips in step:
          cut = cut.Loop(end-start+2, 0, 0)
        }
      }
      return result
    }
    Then you can use it like this in a script:
    Code:
    LoadPlugin("GScript.dll") # or install in default plugins folder
    GImport("findcuts.avs")
    
    full = ... # uncut source
    cut = ... # censored version
    FindCuts(full, cuts, "cutlog.txt")
    # to suppress log, use just FindCuts(full, cuts)
    Voila!
    Caveats:
    - I'm not sure if the cuts-only assumption is very realistic
    - it's quite slow as everything is done during script loading.
    Nevertheless, yet another example of how Avisynth is second to none for flexibility and power.
    Quote Quote  



Similar Threads

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