I have a snapshot of a frame in a video, and want to use it to locate the video source on my hard drive.
+ Reply to Thread
Results 1 to 29 of 29
-
-
I can only hope that someone else thinks differently. There are tantalising hints of the possibility in the cybersphere; in fact one thread claimed that commercial programs had been found, but 'he' wanted a free one. Sadly, 'he' did not mention which paid-for items filled the bill.
-
Give Video Comparer a try. There's a limited function free version. Make the snapshot into a repeating short video and it may find the video in thorough mode. I don't know how accurate it is, but I use the Pro version and it finds dupe scenes of a few seconds.
-
Same problem happened to me few years ago. I had to watch every single video I saved until u found the right one
-
Lingyi - I have tried the Video Comparer, and am at a loss as to how to select the snippet to find its 'long' video source. I seem to be able to only select folders. There does not appear to be a useful HELP file to get me started. Can you help ?
-
AFAIK, it's not possible to select individual videos to compare. Put your snippet on the drive you're searching and let it run. It will search all the folders for a match. Be patient as it can take a long time perform the search, especially in thorough mode.
-
The procedure you describe is obvious. The snippet IS already on the drive - but how do I identify the snippet to COMPARE, and then how do I tell Compare which drive/folder to search in ? That is a TWO step process and I have NO idea how to start it.
-
I'm not sure what the confusion is. As shown on this page https://www.video-comparer.com/product-screenshots.php, you choose the directory/folders on the left that has the videos you want to compare. You don't choose the individual videos, only the entire directory or folder.
Anyway, I just checked and did a test and it probably won't work for you. The minimum duplicate length is 10 seconds. Settings>Advanced. I thought it was shorter because it will tag multiple scenes as dupes. I ran a test with shows that have preview snippets of the next episode and it didn't tag them. I also tried comparing an alternative version of a scene from a TV show and it didn't tag that either. -
Three things have happened.
Once you mentioned comparing videos rather than searching for a video from a snapshot, I realised that in the particular need I have RIGHT NOW, I have a long enough segment of the complete video to look for the complete one.
I decided to look for a user guide and found one - WITH AN EMAIL address for technical support. I also saw that the basic function is to look for ANY duplicates on a drive, as distinct from finding a particular one that matches another.
I have sent off an email asking the 'publishers' if their product can be made to do what I want - else if they know of a product that might. -
If this video is a commercial film, you might be better off uploading a still or two. You never know someone might recognise it or at least provide some pointers.
-
I've had a reply to my inquiry. It said that the feature I want is not available in the free version.
Google had an entry '21 alternatives to Video Comparer' - I am about to launch into testing those alternatives. -
What the OP is trying to do is not possible, at least not in any practical way.
He wants a piece of software that is capable of "looking" at a single still screenshot/snapshot and match it to a movie he has on his hard drive.
If he had an actual frame, in theory, he could put together a script that used ffmpeg to compare said reference frame to each individual frame of each video and then include logic in the script that when a PSNR ratio higher than a certain value was returned and/or an SSIM value closer to 1 than a given percentage was calculated, said movie was flagged as the likely match.
But he states he has a "snapshot" of a single frame, maybe he could try facial recognition software but the stuff law enforcement uses is not available to the public and the open source variants, as far as I know, exist only as libraries that he would need to incorporate into an application he created.
As I said, for all intents and purposes, it's not going to happen. -
I revised my original statement - I do have a film clip (more than just a snapshot) of the complete video I want. Does that make it more feasible ?
-
Just do a search for .mkv,.mp4 etc...,it will show up.
I think,therefore i am a hamster. -
If I were tasked with this, i'd be writing a script in python or another language to input all videos, break the video into individual frames, then analyze each frame image with one of those image comparison libraries against the sample image.
I think you're going to have to build something yourself. Cool utility though. Maybe if I get free time i'll build it. -
Here's the script, a sample video, and a sample image. The script searches through the video for the image. If it finds a match it outputs the frame number in a text file called match.txt.
Code:v = LSmashVideoSource("video.mp4") i = ImageSource("small145.jpg", fps=v.framerate).ConvertToYV12(matrix="rec709").Trim(0, length=1) v = v.BicubicResize(i.width, i.height) diff = AbsDiff(v, i) WriteFileIf(diff, "match.txt", "AverageLuma<5.0", "current_frame", append = false) function AbsDiff(clip v1, clip v2) # Absolute value of clip1 - clip2 { Subtract(v1, v2) Overlay(last.ColorYUV(off_y=-126), last.Invert().ColorYUV(off_y=-130), mode="add") }
In this example the image is half the size of the video so the video is downscaled to match the image dimensions. Also note that the ConvertToYV12() will use a limited range rec.601 matrix by default. You may need to change that if your image was produced differently (rec.709, full range...). And this will not work if the image doesn't contain the full frame. An image that's a crop of the full frame will not be found. You may also need to change the threshold value (5.0 in the script) to another, depending on the quality of the image. Lower values will be more selective (require a closer match), higher values less selective (a looser match). -
I think I need a bit more instruction on how to run this.
I can't open the avs script in vdub because it gives me the error "does not have a video stream" and menu option "run video analysis pass" is greyed out until you have something open.
I must be missing something simple here. -
And now have it all working. Sorry for the wall of messages. Here's my modifications for running against a UTVideo uly2 AVI file, and comparing against a jpeg of identical size. I had to bump the score up to 8.0 to get the matches I was looking for, as i'm trying to find spots in Video8 captures where the screen goes blue, when the analog converter can't process the image. Very useful, thank you!
Attached is the frame I was searching for.
v = AVISource("clip.avi").ConvertToYV12(interlaced=Tru e)
i = ImageSource("frame.jpg", fps=v.framerate).ConvertToYV12(matrix="rec601")
diff = AbsDiff(v, i)
WriteFileIf(diff, "match.txt", "AverageLuma<8.0", "current_frame", append = false)
function AbsDiff(clip v1, clip v2)
{
Subtract(v1, v2)
Overlay(last.ColorYUV(off_y=-126), last.Invert().ColorYUV(off_y=-130), mode="add")
} -
For a nearly all blue image like that you could probably use the average U and V values rather than an image. Cropping away the black borders shows the average U value is 215, average V values is 114.
Code:ImageSource("frame.jpg") ConvertToYV12() # blue screen will have U=215, V=114 Crop(32,32,-32,-32) ColorYUV(analyze=true)
Code:AVISource("clip.avi").ConvertToYV12(interlaced=True) Crop(16,16,-16,-16) # crop away discolored edges WriteFileIf(last, "match.txt", "AverageChromaU>213.0", "current_frame", append = false)
-
Awesome, yup that's way nicer and quicker. Takes about 25% of the time of the other method. With some rounding of the frame numbers i'm given a nice easy list of approximate sections to check for dropouts. This is going into my capture process right after trimming down the capture file to check if I need to do another pass or use a different deck/camcorder.
Thanks! -
Back on the subject of how to find an image in a bunch of videos, here's a batch file that will search all the MP4 file in a folder:
Code:@echo off for %%F in (*.mp4) do ( echo v = LWlibavVideoSource^("%%~dpnxF", cache=false^) >script.avs echo i = ImageSource^("image.jpg", fps=v.framerate^).ConvertToYV12^(^).Trim^(0, length=1^) >>script.avs echo v = v.BicubicResize^(i.width, i.height^) >>script.avs echo diff = AbsDiff^(v, i^) >>script.avs echo WriteFileIf^(diff, "match.txt", "AverageLuma<5.0", "current_frame", append = false^) >>script.avs echo function AbsDiff^(clip v1, clip v2^) >>script.avs echo { >>script.avs echo Subtract^(v1, v2^) >>script.avs echo Overlay^(last.ColorYUV^(off_y=-126^), last.Invert^(^).ColorYUV^(off_y=-130^), mode="add"^) >>script.avs echo } >>script.avs echo %%~dpnxF "g:\program files\avsmeter190\avsmeter64" script.avs 1>nul 2>nul type match.txt del match.txt del script.avs ) pause
Code:E:\VCR\AVS\Find Image in Video\ScanAll\1min clip.mp4 E:\VCR\AVS\Find Image in Video\ScanAll\avideo.mp4 145 E:\VCR\AVS\Find Image in Video\ScanAll\PhaseShifted.mp4 Press any key to continue . . .
Code:for %%F in (*.mp4) do (
Code:for /R %%F in (*.mp4) do (
-
Wow. You lads have some time on your hands.........fairplay for your commitment.
-
I'd like to bring attention to vapoursynth, it all can be done within a single script, because of the nature of being it a python script.
-script could generate list of paths for particular files (by extensions, dimensions etc.)
-check for differences
-actually request all frames (no need to run it in other app)
-print finds to python console.
Code:import vapoursynth as vs from vapoursynth import core import os DIRECTORY = r'D:\movies' IMAGE = r'D:\pictures\snapshot.jpg' TOLERANCE = 8 tolerance_float = TOLERANCE/255 files = os.listdir(DIRECTORY) paths = [os.path.join(DIRECTORY, file) for file in files if file.endswith(".mkv")] image_clip = core.ffms2.Source(IMAGE)[0] for path in paths: clip = core.ffms2.Source(path) print(f'searching in: {path}') if clip.width > image_clip.width: image_clip_adjust = image_clip.resize.Bicubic(format = clip.format.id, matrix_s='709') clip = clip.resize.Bicubic(width = image_clip.width, height = image_clip.height) else: image_clip_adjust = image_clip.resize.Bicubic(width = clip.width, height = clip.height, format = clip.format.id, matrix_s='709') y1 = clip.std.ShufflePlanes(0, vs.GRAY) y2 = image_clip_adjust.std.ShufflePlanes(0, vs.GRAY) diff = core.std.Expr([y1, y2], 'x y - abs').std.PlaneStats() for n, frame in enumerate(diff.frames()): if frame.props.PlaneStatsAverage < tolerance_float: print(f'match: frame {n}') continue print('done')
Similar Threads
-
Expanding Hard Drive Capacity
By Tom Saurus in forum Latest Video NewsReplies: 0Last Post: 29th Mar 2021, 09:23 -
Video Editing hard drive setup
By bridgyguy in forum Newbie / General discussionsReplies: 2Last Post: 17th Mar 2021, 07:51 -
Backing up all my disks to a hard drive
By kshavo in forum DVD RippingReplies: 20Last Post: 26th May 2019, 02:55 -
Mirror Edition Hard drive recovery.
By dafoe in forum ComputerReplies: 6Last Post: 1st Dec 2017, 06:52 -
Unable to access my external Hard drive
By aruwin in forum ComputerReplies: 36Last Post: 15th Oct 2016, 15:52