A hack was released in July that allows the Panasonic GH2 to record at extremely high bitrates. I hacked the camera once and had success though I hacked it a second time I had a wedding to shoot the next day. Since the hack worked the first time I didn't think about checking to make sure the hack was successful. It turned out it must have recorded at a much lower bitrate. The quality was very poor and there is a strobing effect on every 15th frame.
I'm not asking about how to improve the video quality because I am pretty sure it is impossible to fix. But is there a way to delete every 15th frame and replace it with every 14th frame? Because this would remove the strobing effect.
+ Reply to Thread
Results 1 to 30 of 44
-
-
You can probably do it with remapframes() in avisynth
But are you sure about that approach? It might be worse. Duplicate frame pairs will cause a jerky stutter. If it's 1 bad frame every 15 frame cycle, even a blended frame would be less noticable to most viewers than a duplicate frame. The 3rd option is a motion interpolated frame
If you can describe it better or upload a sample clip, maybe there is something else going on or other options you can tryLast edited by poisondeathray; 15th Aug 2011 at 23:11.
-
Here is a link to a sample clip of what the strobing effect that I am speaking of looks like.
http://www.youtube.com/watch?v=l-rCKOe-jSk
@posiondeathray, your suggestion about blending the 14th and 16th frames together to replace the 15th frame sounds like a much better idea. I just have no idea how or what program I would use to do this.
Any help would be greatly appreciated. -
It's "keyframe popping", the newest versions of VK's hack should fix it. But you probably don't have a time machine and probably can't reshoot the wedding
You can replace it with badframes() or R() in avisynth
There is a bit of a learning curve, but not too bad once you get going. I'll post a better explanation with examples in a minute -
I would use avisynth, but there is a bit of learning curve. You would apply the script and transcode to an intermediate (e.g. cineform, dnxhd, or some lossless format like huffyuv, lagarith) then import the clips into your NLE
Because the "bad" frames occur exactly 15 frames apart it's easy to replace with a blend or interpolated frame
You can generate a text list in excel or google spreadsheets by entering the 1st 3 numbers then dragging the box, and it will autofill (every 15th frame)
23
38
53
.
.
.
You can use fill in the function and brackets, and it will autofill as well, so all you have to do is copy & paste. It will look something like this
Badframes (23)
Badframes (38)
Badframes (53)
.
.
.
The third option I talked about is motion interploated frames. There are some functions called "R" , "RP", and "RX" , for replace 1 frame, replace frame pair and , replace a string of frames. Single frame is all you need
The difference is the replaced image won't be a "dumb" blend, it will use optical flow to generate an "in between" frame
I posted examples screenshots and videos illustrating the differences . For the screenshots, I chose frame 128 at random, the first uses badframes(), the other R(), you will see R() is less blurry on the repaired frames
The problem with motion interpolation, is you can get weird artifacts from the interpolation. With slow controlled movements like those in your clips , it's usually not a problem. With action like sports, it can be a problem - then you can use BadFrames() instead (or you can mix & match)
(You're probably lost if you are new to avisynth, so don't be afraid to ask questions, someone here will help you)Last edited by poisondeathray; 16th Aug 2011 at 11:23.
-
The R() function is not built-in, so you need to extract the source from this post and amend the global setup code to fit in with your clip.
But unless your wedding was very quick, you will have many thousands of frames to replace, so a more automated solution is preferable and, given the regular pattern of 'bad' frames, this is possible.
Code:source = ... # your source source sup = MSuper() bv = MAnalyse(sup, isb=true, delta=2) fv = MAnalyse(sup, isb=false, delta=2) interpolated = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0) replace = interpolated.SelectEvery(15, 14) # replacement frames DeleteEvery(15, 14) # delete bad frames InterleaveEvery(replace, 15, 14) # replace deleted frames
You may have to adjust the offset (14) to fit the cadence of your clip (is the first bad frame really 23?), but hopefully you get the idea. -
Awesome job gavino. You always come up with super sexy elegant avisynth solutions
If it's ok with NBninja8, I'll upload the .flv from youtube here so it can be used for learning/testing purposes. I renamed it "0.flv". I also uploaded the (clunkier) scripts I used which have the R(), RP(), RX() functions -
Let me make sure I understand this correctly.
What I need to do is run the script, R or the script Badframes, correct? R uses interpolation to place a new frame where the keyframe popping appears. badframes just removes the frames.
I prefer R and I like the way that it looks on the video of mine you tested it on.
I have edited R to a new script with a different avi file for testing. I attached my edited script to this post. I'm going to Virtualdubmod and going to file>open video file. And selecting R.avs.
What I get is a message saying:
AVIsynth open failure:
Script Error: there is no function named "msuper"
("C:\Documents and Settings\Wei Liang He\Desktop\Video\R.avs", line 4)
I was not able to figure out how to apply the plugin "applyevery". I read somewhere that you have to add in a command to load the plugin somewhere in the script.
Would you mind terribly, writting a script that has this command, or explaining why I am getting the Script Error message. I'm really new to this.
Thankyou -
Yes, R() will replace using mvtools2, and badframes() will use a dumb blend if blend=true (default). For R() you need mvtools2.dll and place in avisynth/plugins folder. Most .dll's that are in plugins folder will autoload. Otherwise you can use LoadPlugin("PATH/plugin.dll") . .avsi scripts will autoload as well if placed in the plugins folder
http://avisynth.org.ru/mvtools/mvtools2.html
http://avisynth.org.ru/badframes/badframes.html
(the actual download is at the bottom of the page, but you should read the documentation when you get a chance)
Same with ApplyEvery , you either autoload the .dll or loadplugin manually
I recommend using avspmod for scripts. push f5 for preview. It does a lot more like sliders, macros, tabbed scripts but you can read about that at your leisure
http://forum.doom9.org/showthread.php?t=153248Last edited by poisondeathray; 16th Aug 2011 at 21:49.
-
As well as installing mvtools2 as poisondeathray describes, you will need to change this line in your script:
Source = ("C:\Documents and Settings\Wei Liang He\Desktop\Video\AVISYNTH.avi")
which should be:
AviSource("C:\Documents and Settings\Wei Liang He\Desktop\Video\AVISYNTH.avi") -
Sorry, I'm still not getting this.
I created a new script instructing AviSynth to use the plugins mvtool2.dll and ApplyEvery.dll
When I try and run the script to create an Avi file in AvsPmod I get an error message telling me the script has an error but does not specify what went wrong.
In Virtualdubmod, when I try and open the .avs file I get:
Avisynth Open Failure
unexpected character "["
(C:\Documents and Settings\Wei Liang He\Desktop\Video\R.avs, line 1, column 23)
I tried placing the plugins in the plugins folder of AviSynth and not adding a line saying LoadPlugin ("filename" [, ...])
-though it did not help. I still got the same message when trying to open the script:
AVIsynth open failure:
Script Error: there is no function named "msuper"
("C:\Documents and Settings\Wei Liang He\Desktop\Video\R.avs", line 4) -
If you leave mvtools2.dll and ApplyEvery.dll in the plugins folder they will autoload , you don' t need the LoadPlugin line, you can erase it or comment it out "#"
The syntax for avisource , you don't need the "=" , and path for loadplugin is incorrect
Gavino posted this above, it should be:
AviSource("C:\Documents and Settings\Wei Liang He\Desktop\Video\AVISYNTH.avi")
However, If you wanted to use LoadPlugin (or manually load any .dll) , it should be
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ApplyEvery.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools2.dll")
What is "avisynth.avi" ? is it the file you are trying to fix ? -
You are misinterpreting the LoadPlugin documentation.
When it says
LoadPlugin ("filename" [, ...])
it doesn't mean you should literally write "filename", it means you replace filename by the name of the plugin dll you want to load. The [, ...] part means that further filenames can optionally be added, separated by commas - the square brackets are meta-characters to indicate optionality, you don't actually put them in the command.
In fact, it's more normal to use a separate LoadPlugin call for each dll.
I don't think I've ever seen a script posted using multiple dll's in a single call (though it is allowed). -
Again, remove the "=" from avisource
Download the corrected.avs in post #13 and note the differences
Post the exact error message if you still have any -
When I try and open the file corrected.avs, I get the same message.
Avisynth Open Failure
AVIsynth Autodetect: couldn't open file 'C:\Documents and Settings\Wei Liang He\Desktop\Video\AVISYNTH.avi'
Error Code: 2
('C:\Documents and Settings\Wei Liang He\Desktop\Video\corrected.avs, line 3)
The file is DV-AVI. Can AviSynth open this type of file or does it look like I need to download a codec? -
yes, cedocida is free a DV-AVI VFW decoder
but if this is interlaced, the script will not be optimal => it's interpolating from frames not fields
Where did you get this DV-AVI file ? You should be using the original file from the camera, the .mts
What mode did you shoot in? -
I'll have to convert it to progressive because it is interlaced.
The reason it is DV-AVI is because I am not editing this footage. I shot it and I screwed it up. That's why I am trying to fix it. But my editor prefers DV-AVI because of his system and the end product is a DVD so it is fine that it is DV-AVI.
Unfortunalty I was very low on hard disk space and I did not save the original .mts files. I converted them all to DV-AVI for my editor originally thinking they could not be salvaged anyways.
So if I download cedocida, AVISynth should work with DV-AVI? -
What was the original footage shot at , what where the specs, and how did you convert it to DV-AVI ?
*There are many ways to screw up the conversion to DV-AVI
If it's truly interlaced, then you probably want to keep it interlaced, otherwise you lose 1/2 the information if you single rate deinterlace.
It is possible to use mvtools2 on fields instead of frames, similarly you can use badframes() on fields instead of frames, but these require special treatment and modification of the script
Since you don't have the original files, Upload a sample clip of DV-AVI that you are using for your "master" files. If it's >30MB, use a free hosting site like mediafire.com
If you download and install cedocida, than AVISource() should work with DV-AVI -
Here is a link to a sample.
https://docs.google.com/leaf?id=0B9hkaLEW4EFpOTAwNGY3MWYtMTI0OS00NTY4LTlkZmUtNzBiZTUwN...5YTY0&hl=en_US
It is actually a .dv file.
I may have screwed up the field order. I believe I encoded this as lower field first when HD video is usually encoded as upper field first.
The .dv file was then converted to .avi (DV-AVI) for my editor. Again a fault on my part. I thought that .dv would play on a windows machine, as I primarily use Mac. -
Can we assume all your files were converted using the same method ?
If so, it has been improperly converted, single rate deinterlaced. So you have no choice but to treat it as progressive 480p29.97
In the future, especially if this is a paid gig , I would backup the original footage, always , always. Hard drives are very affordable these days. Many problems that you thought impossible to fix might be possible to improve as demonstrated here. Even things like light flicker , rolling shutter , moire issues (less of problem with a GH2 than Canons) may have workarounds
In the future, make sure you are using stable hack settings or use stock settings. If you were a GH13 user, you might recall the first few months were filled with "growing pains" as well until it became stable after more development and testing
Use ffmpegsource2 as the source filter , unzip the .dll and .avsi place into plugins folder to autoload
http://code.google.com/p/ffmpegsource/
sample syntax:
FFMpegSource2("00186.dv", atrack=-1)
AssumeFPS(30000,1001)
You don't need full path if the .avs is in the same directory as the video files. You don't need cedocida, unless it's DV-AVI and you are using AVISource()
The AssumeFPS is used to make the FPS "perfect", because FFMS2 sometimes reads it incorrectly
Everything else is the same, and you can treat it as progressive (you would have to adjust the offset or frame numbers to match the ones you want to replace for each clip, so for this clip I would start with 36, 51, 66, etc... Other clips may have different offsets or numbers)
With Gavino's function or the R() function, you can only interpolate frames that have neighboring "good" frames. So those stuck frames at the beginning cannot be fixedLast edited by poisondeathray; 17th Aug 2011 at 22:23.
-
Poison Death Ray, thankyou so much for your hard work. This is really helping me.
If I can ask you a favor. This is really over my head and I really have no time to learn this program.
If I encode a new .dv file encompassing all of the clips rendered with the exact same settings, no changes and gave you the beginning 30 seconds of the file. And then I install ffmpegsource2 by placing the .dll and .avsi in the plugins folder for Avisynth. And having placed the other .dlls for ApplyEvery.dll and mvtool2.dll into the plugins folder as well. Also assuming the .avs script is in the folder C:\Documents and Settings\Wei Liang He\Desktop\Video and the .dv file is also in this folder. Can you write this script for me?
I can send you some money over paypal, I just don't have a whole lot. As I said I couldn't buy another hard disk.
I'm really not understanding this process very well and I would probably have to continue asking you questions for a long while. -
Never mind I just realized this wouldn't work, as you said some clips may have different offsets or numbers.
-
-
If you could write the sample script that would be great. Thankyou so much.
-
I don't see how that would help, it's exactly the same procedure as described earlier
Anyways, I've attached the script for that .dv clip
Looking more closely 1st treatable "bad" frame starts at 21. So 21, 36, 51 etc...
Presumably your clips are longer, so either use that excel trick to autofill, or gavino's function
EDIT: I added what I think gavino's function would look like for this clip. I think you would change the values of the last 3 lines to 15,6 , because 15+6 =21, which is the 1st frame to be replaced. (I think it also replaces frame 6, but I wouldn't worry about it because the first bunch of frames are usually junk with the hack anyways)Last edited by poisondeathray; 18th Aug 2011 at 20:02.
-
-
I have figured it out. The script dv.avs works well.
Though it only works for the frames specified in the script. You mentioned an excel trick to autofill the proceeding frame numbers. But I don't understand what this trick is. Can you explain?
Similar Threads
-
Frame-By-Frame Restored James Bond Films Released
By Soopafresh in forum RestorationReplies: 9Last Post: 27th Apr 2012, 14:09 -
How do I debug/extract i-frame p-frame and b-frame?
By jwbrasil2 in forum ProgrammingReplies: 0Last Post: 20th Nov 2011, 12:24 -
Replace first frame of WMV file?
By HiTechHiTouch in forum Newbie / General discussionsReplies: 2Last Post: 9th Mar 2011, 21:18 -
Play an MTS file frame by frame, displaying timecode or frame number
By SeánB in forum Software PlayingReplies: 5Last Post: 5th Oct 2010, 16:26 -
Advancing/Rewinding Clip Frame by Frame on Windows Movie Maker (Vista)
By ione in forum EditingReplies: 20Last Post: 9th Sep 2008, 22:53