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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th May 2014, 18:15   #1  |  Link
jkilez
Registered User
 
Join Date: May 2014
Posts: 24
Looking for a script that can find blocky frames

Many HDTV captures that I have often have a number of bad sections where the picture becomes blocky for just a frame or two before returning to normal. These dropouts are tolerable when watching live TV, but when rewatching, it can be distracting. Since I am starting the process of converting my captured MPEG streams to smaller x264 files, I would like to fix those glitches at the same time. I could fix them easily enough if I knew where they were.

What makes this difficult is that the captures are mostly pristine. There may only be one or two instances of blockiness in an hour of video (or there may be none). It is a task that is mind-numbing and arduous when done by a human, but hopefully it can be done simply by script. There are any number of scripts or plug-ins that will simply deblock, but that is not what I am seeking. I would like something that generates a file of frame numbers that I could use to locate and fix problem areas manually.

Has this been done somewhere already?

Last edited by jkilez; 27th May 2014 at 22:42.
jkilez is offline   Reply With Quote
Old 27th May 2014, 21:42   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,980
I asked similar question some time ago, did not get any answer, I think.

Suggest maybe change thread title from "bad" to "blocky" frames.
__________________
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 May 2014 at 22:33.
StainlessS is offline   Reply With Quote
Old 27th May 2014, 22:53   #3  |  Link
jkilez
Registered User
 
Join Date: May 2014
Posts: 24
Thread title has been updated per StainlessS's suggestion. At least now I know I that I did not overlook some obvious solution.

At this point I can create a log file, but I am missing the logic on how to determine the blockiness of the frame. One idea I had was to apply a heavy deblocker to a copy of the frame and compare it to the original. If the two varied substantially, I could record the frame number. This would use duplicate frame check logic, but in reverse.
jkilez is offline   Reply With Quote
Old 29th May 2014, 21:40   #4  |  Link
AzraelNewtype
Registered User
 
AzraelNewtype's Avatar
 
Join Date: Oct 2007
Posts: 127
This is going to sound like a strange idea, but when I have captures of a particular show that is primarily progressive with some occasional combed bits, I run a good old writefileif(IsCombedTIVTC()) to find the spots to hit manually. Sometimes these areas are just combed, but other times the algorithm is tripping on heavy blocking. In fact all instances of particularly bad blocking show up as combed.

Obviously, if your source is completely interlaced this will do nothing for you, and if it's a telecine you'll probably want to ivtc first with as little post processing as possible, but it could be worth a shot.
AzraelNewtype is offline   Reply With Quote
Old 30th May 2014, 00:32   #5  |  Link
jkilez
Registered User
 
Join Date: May 2014
Posts: 24
Quote:
Originally Posted by AzraelNewtype View Post
I run a good old writefileif(IsCombedTIVTC()) to find the spots to hit manually. Sometimes these areas are just combed, but other times the algorithm is tripping on heavy blocking. In fact all instances of particularly bad blocking show up as combed.
Thanks for the pointer. I am going to play around with the parameters to IsCombedTIVTC() to see if I can get it to pick up the blocking. If so, this would make a great solution.
jkilez is offline   Reply With Quote
Old 30th May 2014, 19:28   #6  |  Link
jkilez
Registered User
 
Join Date: May 2014
Posts: 24
I have been playing with IsCombedTIVTC() to detect the flawed frames, but by default, it gives many false positives. I have also not been able to use the function outside of "WriteFileIf()" or "ConditionalFilter()". Any use outside of those two functions just gives an "invalid parameters" error. Is this normal?

In searching further for solutions, I came across this thread: Script for fixing corrupted frames. The script it discusses is attacking (more or less) the same problem I am experiencing.
jkilez is offline   Reply With Quote
Old 30th May 2014, 23:05   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,980
IsCombedTIVTC() is a runtime function and has to be used in runtime environment.

http://avisynth.nl/index.php/Interna...time_functions

http://avisynth.nl/index.php/The_scr...untime_scripts

EDIT:
You could use it something like this:
Code:
# Requires RT_Stats : http://forum.doom9.org/showthread.php?t=165479

Report="Report.Txt"

AviSource("D:\avs\Test.avi")

Exist(Report) ? RT_FileDelete(Report) : NOP

ScriptClip("""
    IsC = IsCombedTIVTC()
    (IsC) ? RT_TxtWriteFile(String(current_frame),Report,append=True) : NOP
    RT_Subtitle( (IsC) ? "Two Legs Bad" : "Four Legs Good" )
    return Last
""")
EDIT: You dont need RT_Stats if you dont use the three RT funcs.

EDIT: Here another script that writes a file of combed frames, and optionally deinterlaces them (of course you want to deblock instead).
http://forum.doom9.org/showthread.ph...TC#post1666918
__________________
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; 31st May 2014 at 14:43.
StainlessS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.