Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
26th February 2012, 16:18 | #101 | Link |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
You probably could have just used:
SelectEvery(clip, 999999, 2, 3, 5, 7, 9, 13) If your source has more than 999999 frames, then increase the number to suit. It just needs to be bigger than the total number of frames presented. (I wonder if there's a limit on how many frames SelectEvery can handle?) ...but having a separate function for it might be easier for people. And it would be interesting to see which version performs better. Could you provide the source code, too? This would be a good training example for folks starting out on coding their own plug-ins, I think: A nice simple objective, which lets you focus on one aspect of what a typical plug-in needs to do. Thanks! |
27th February 2012, 00:35 | #103 | Link | ||
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
Quote:
Source is here (fixed), but I don't know useful it will be, it really was cobbled together - I still only have a vague grasp of how filters come together, I only know just enough to pummel the simplesamples into doing what I want. Quote:
David Last edited by wonkey_monkey; 27th February 2012 at 17:48. |
||
27th February 2012, 03:36 | #104 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
David, source; 404.
If you want to handle audio, you need a 'GetAudio' member fn, presume you have not got one. (otherwise, will get full length audio from source clip) If you dont want any audio in output clip, set 1st 2 or 3 of below, to 0 in constructor. Code:
vi.audio_samples_per_second=0; // 0 means no audio, type int vi.num_audio_samples=0; // changed as of 2.5, type __int64 vi.nchannels=0; // as of 2.5, type int http://horman.net/simpleselect.cpp Very succinct, looks ok to me. EDIT: May want to add below to constructor Code:
frames=(int*)malloc(vi.num_frames*sizeof(int)); if(frames==NULL) env->ThrowError("SimpleSelect: Cannot allocate memory");
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 27th February 2012 at 14:41. |
23rd March 2012, 01:29 | #105 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
FrameSelect() v1.0, NEW Plugin for Avisynth v2.5+ by StainlessS.
FrameSelect() is a simple plugin to select individual frames from a clip. Can select frames numbers by direct arguments to filter, or in a string, or in a command file. Video:- Planar, YUY2, RGB32, RGB24. Audio:- Returns NO AUDIO (Does not really make sense for individual frames). EDIT: For frame range and audio support with fade in/out see trim/splice plugin Prune(). http://forum.doom9.org/showthread.php?t=162446 EDIT: For frame range replacement see ClipClop(). http://forum.doom9.org/showthread.php?t=162266 FrameSelect(Clip, int F1, ... , int Fn, string 'SCmd',string 'Cmd', bool 'Show', bool 'Ver') http://forum.doom9.org/showthread.php?t=164497 Partly inspired by DavidHorman's SimpleSelect() 2 posts earlier. (Thankyou David).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 23rd March 2012 at 16:18. |
23rd March 2012, 12:34 | #106 | Link | |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
Quote:
A nice companion function would then be something that, rather than just selecting or ignoring frames from a single source, would actually switch between two sources - i.e. frames listed are taken from source A, but the rest are instead taken from source B. People who are writing functions to detect and fix particular symptoms in video then wouldn't have to worry about implementing their own switching logic: Just have the detecting filter output an EDL listing the frames that need "fixing", then run it with a script such as: Code:
EDL = Q:\project\list_of_bad_frames.txt FindTheBadness(OriginalVideo, threshold=99, output=EDL) FixedVideo = FixTheBadness(OriginalVideo) SelectAlternative(FixedVideo, OriginalVideo, commandfile=EDL) |
|
25th March 2012, 03:50 | #108 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
ClipClop() v1.10, Range/Frame Replacement Plugin for Avisynth v2.5+ by StainlessS.
New Version v1.10, Major improvement. http://forum.doom9.org/showthread.php?t=162266 Planar, YUY2, RGB32, RGB24. Does NOT affect Audio (as source clip). Code:
ClipClop() v1.10, Range/Frame Replacement Plugin for Avisynth v2.5+ by StainlessS. Planar, YUY2, RGB32, RGB24. Does NOT affect Audio (as source clip). Clipclop is a simple plugin to replace ranges in a source clip with the same range, from a replacement clip. Supports up to 255 replacement clips, with unlimited number of replacements into output clip. If you wanted to do 1000 single frame replacements in script, that would require 3 trims and 2 splices for each replaced frame, ie 3000 trims and 2000 splices. This would involve 5000 'zero cost' filters which together will cost a little more than zero. With ClipClop(), this is reduced to 1 single filter with an overhead of approx 1 trim or splice filter. There is a small overhead setting up the filter (before the very 1st frame is fetched) while parsing the file/string commands, but then parsing and setting up 5000 trim/splice filters in a script would not be without cost either. Clipclop can parse in the region of 40000 commands (from file) in about 1 second [guessed, based on timing the sister plugin Prune(), a trim/splice plugin]. v1.10, Implements 'Nickname's, Pseudonyms for the replacement clips, ie instead of '17 100,200' you could use eg 'dn 100,200', in this case it might be to replace frames 100 to 200 of the source clip with the same frames of a denoised clip (clip 17). OR, 'cp 345' to replace frame 345 with a clip where frame n was copied from frame n-1 of the source clip, ie CopyFromPrevious [this could be generated via 'SelectEvery(1,-1)', or 'CopyFromNext' clip by 'SelectEvery(1,1)]. Supports Nicknames of up to 31 characters in length so you could use eg 'PredictFromPrevious 1234', or 'FlippedVertical 666,999'. Nicknames allow you to think in terms of functionality rather than to keep looking up which clip index holds a modified clip and you could actually write your command file/string before you even know how many clips you need, what clip index they will be, or even how you will actually create/process the clip. Once you've tried ClipClop(), you will wonder why you spent all those years doing it the hard way. (Repeat after me, "I dooo believe in Fairies!".)
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
23rd April 2012, 01:09 | #110 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
New Script filter.
MatchFrames v1.02 - 23 April 2012 Code:
Function MatchFrames(clip c, clip f, bool "Show", Float "Thresh",Float "Thresh2",string "FileName",string "LogFile") # MatchFrames v1.02, by StainlessS: # Find And return frames in c clip that are best matched to frames in f clip. # Requires YV12, as uses LumaDifference(). Null Audio returned. # ########## # Args: # c = clip, Source clip. # f = clip, Consisting of frames that you wish to find in the c clip. # Show = bool[true], Returns both find and found frames using StackHorizontal. # Thresh = float[0.0 == Search for best match], Threshold for declaring match. # Thresh2 = float[0.0 == NOT time ordered], If (Thresh < Thresh2) Then clip f is time ordered (in c). # This arg can significantly cut down on the time taken to search for frames. # Assuming time ordered f clip (Thresh < Thresh2), # Where:- # A match found where diff of find to found frames <= Thresh, # Next search will start from found frame + 1. # Else if diff of find to BEST found frame < Thresh2, # Next search will start from BEST found frame + 1. # Else # Next search will start from current start position. # End if # # FileName= string["MatchFramesCmd.txt"], Output Frames command file (For FrameSelect plugin). # LogFile = string["MatchFrames.Log"], Output Log file. # ########## Advantages:- Deals with a clip of frames to find rather than a single frame. Can find best match or 1st match below or equal to a threshold. Float Threshold. Can show StackHorizontal required 'find' frame alongside source clip 'found' frames. Can output a command file consisting of frame numbers found. Command file can be used with FrameSelect() Plugin to select all found frames (useful if viewing StackHorizontal frames without 2nd SLOW run for extraction). Outputs LogFile Can cut down on search times if clip f is known to be time ordered (in c). Find it here: http://forum.doom9.org/showthread.php?t=164766
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 23rd April 2012 at 01:13. |
9th July 2012, 05:37 | #111 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth filter
taverage 0.1 by jmac698 Jul 8, 2012 A filter to average all frames, pixel-by-pixel. YUV formats only. Designed for Avisynth 2.58. Usage: taverage(clip clip) Source is GPL Note, it's very slow. http://www.sendspace.com/filegroup/9...%2BWcMacRzuyCQ |
11th July 2012, 04:24 | #112 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth plugin
findpos 0.2 by jmac698 Jul 11, 2012 A filter to find pixels on each line. YUV only. Avisynth 2.58+ Usage: findpos(clip clip, int x1, int x2, int thresh) Search from x1 to x2 on each line for a pixel >=thresh, return a clip where luma of each line is the position found. If not found, luma will be x2. defaults: x1 0 x2 7 thresh 22 http://www.sendspace.com/file/x5abs3 Version History 0.2: Release build. Ensure you have the vc2008 runtime installed. Last edited by jmac698; 12th July 2012 at 10:42. |
11th July 2012, 11:25 | #113 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth filter
dejitter 0.3 by jmac698 Jul 11, 2012 A filter to resize each line of the source by a different amount. YUV only. Avisynth 2.58+ Usage: dejitter(clip src, clip offsets) For each line, read the luma of the first two pixels of offsets. Call these x1 and x2. Resize the source from pixels x1 to x2 inclusive to be the full width of the source. Uses bilinear filtering. http://www.sendspace.com/file/8imj3k 0.3: Made release build. Make sure to install the vc2008 runtime as well. 0.2: fix problem with x1 0.1: first release Last edited by jmac698; 12th July 2012 at 00:43. Reason: Updated |
11th July 2012, 12:49 | #114 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth script
TBC 0.61 by jmac698 Jul 11, 2012 A script to resize each line of the source by a different amount, by searching for black borders. YUV only. Avisynth 2.58+ Usage: see tbc.avs demo Requirements: dejitter 0.2, findpos 0.1 (included) 0.6: first plugin version http://www.sendspace.com/file/s78pp4 Installation note: Please extract the included plugins and place into your plugins directory. jitter03.zip -> jitter.dll -> plugins\jitter.dll findpos02.zip -> findpos.dll -> plugins\findpos.dll The VC2008 runtime is required. Download at: http://www.microsoft.com/en-us/downl...s.aspx?id=5582 Version History 0.61: Included updated plugins. Last edited by jmac698; 12th July 2012 at 10:41. |
12th July 2012, 10:38 | #115 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth runtime plugin
jcorr 0.3 by jmac698 Jul 25, 2012 A plugin to calculate the correlation between two frames. YV12 only. Avisynth 2.58+ Usage: jcorr(clip clip1, clip clip2)#returns float, can be used as runtime value http://www.sendspace.com/file/5ke3a7 Note: Do not confuse with corr2d, at http://avisynth.org/vcmohan/Corr2D/Corr2D.html , which calculates many correlations per frame to let you find the movement between frames in a panning scene. Version History 0.3 -Fixed small numerical inaccuracy -Made new test file to find inaccuracy -Changed to a faster algorithm -Static, SSE build July 25 0.2 Fixed bug where one of the calculations used a chroma plane. Updated demo script with better tests. July 12 0.1 first release. Last edited by jmac698; 25th July 2012 at 14:33. |
12th July 2012, 12:46 | #116 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth plugin
corrbyline 0.1 by jmac698 Jul 12, 2012 A plugin to calculate the correlation between two frames, a line at a time. YUV only. Avisynth 2.58+ Usage: corrbyline(clip clip1, clip clip2) Returns a clip of the same properties and the correlation as the luma per line, *255, if positive, 0 otherwise. Note: to be published later Last edited by jmac698; 13th July 2012 at 09:55. |
13th July 2012, 09:58 | #119 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth plugin
slicer 0.3 by jmac698 Jul 16, 2012 A plugin to extract raw VBI data. YV12 only. Avisynth 2.58+ Planar only. Usage: slicer(clip clip, int line, int x, int width, int bits, int order, int slicelevel, int n)#returns int, can be used as runtime value clip - a video with some white lines in it, such as EIA608, Teletext, Timecode, etc. line - the line to extract x - the starting x coordinate to look for the code. Should set to the mid-point of the first bit. width - the width of the bits bits - the number of bits (<32) order - 0 means lsb first, 1 means msb first slicelevel - anything above this is a "1". In an ideal video, this would be set to 126. n - optional frame number to use, otherwise current_frame http://www.sendspace.com/file/b0798i Note: There is also a similar plugin, DumpPixelValues http://www.theneitherworld.com/mcpoo...xelValues.html Version History 0.3 Changed width to float, as long codes need more precision. Jul 16 0.2 New demo with a real code. Updated docs. Jul 16 0.1 first release. Jul 13 Last edited by jmac698; 17th July 2012 at 01:38. |
13th July 2012, 21:40 | #120 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
New Avisynth filter
addcode 0.2 Jul 16, 2012 by jmac An Avisynth plugin to add codes (like timecodes) as white lines to a video. Usage: addcode(clip clip, int line, int x, float width, int height, int bits, int order, int luma0, int luma1, int word) clip - video to add code to line - line to start code on x - starting position of code width - width of each bit height - height of each bit bits - number of bits to draw order - 0 means draw lsb first, 1 means msb first luma0 - luma to draw for 0 bit luma1 - luma to draw for 1 bit word - a number representing the bits to draw This will only draw the bits as a block, overwriting the specified area of the video. Some parts of the video may still show at the sides. If you want a completely black background, either make sure the bits take the full width of the video, or draw a black line by using a full width code of 0 bits first. You can also create settings to draw arbitrary white or black lines anywhere on the video. It's even possible to turn this into a plot function with foreground and background pens. It could plot single pixels in YV12 which is normally quite difficult. It could also draw checkerboards. To add a timecode, use something like this in a scriptclip: addcode(last,last.height-4,0,last.width/18,2,18,0,16,235,current_frame)#good for at least 145 minutes http://www.sendspace.com/file/udsu6h Version History 0.2 Changed width to float, added timecode example and drawing rectangles to demo. Jul 16 0.1 First release. There is very little checking, please use reasonable values. The x, width, and height should not exceed the video size Jul 13 Last edited by jmac698; 17th July 2012 at 02:40. |
|
|