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...![]()
+ Reply to Thread
Results 1 to 13 of 13
-
-
Originally Posted by guns1inger
i'm searching for simpler way... -
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 -
Originally Posted by guns1inger
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. -
Originally Posted by Gavino
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). -
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.
-
Originally Posted by epsi1on
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))
-
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.
-
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...
-
Originally Posted by jagabo
Originally Posted by guns1inger
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. -
Originally Posted by Gavino
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")))
-
Originally Posted by Gavino
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 }
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)
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.
Similar Threads
-
content based video analysis using motion detection
By Rimaz in forum ProgrammingReplies: 1Last Post: 4th Apr 2012, 10:30 -
libx264 detection
By rzippert in forum LinuxReplies: 1Last Post: 24th Feb 2012, 08:31 -
No more hdtv detection
By bjjaddict in forum ComputerReplies: 0Last Post: 27th Nov 2009, 15:09 -
Video resolution detection
By mattyh in forum ProgrammingReplies: 3Last Post: 25th Mar 2009, 17:06 -
video breakup and glitch detection software
By Zone3 in forum Newbie / General discussionsReplies: 4Last Post: 16th Feb 2009, 21:22