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. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 | Link |
Registered User
Join Date: Aug 2003
Posts: 129
|
Is it possible to stabilize this horizontally jerkyvideo?
It's a PAL/SECAM G tape. I'm using a TBC-1000.
https://mega.nz/#!T19inJjK!nRCI9349r...lz5s87fDxZDuTE |
![]() |
![]() |
![]() |
#3 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,655
|
Is this VHS?
If so, is it recorded in the EP (6-hour) mode? Have you tried adjusting the tracking manually? Do other PAL G tapes play this way, or is the problem just with this one tape? The last question is an attempt to determine if this is indeed a VCR problem, or just a problem with this one tape. There are multiple things going on, judging by the various horizontal offsets that are happening at regular intervals, looking vertically down the left edge. In addition, you have the considerable wobble. |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
I'm glad to have a sample. Perhaps I can use this to work on my software TBC.
I'm dying to work on that but I have to warn you, I'm taking classes and homework due tomorrow so the earliest I should even think about this is Sunday. |
![]() |
![]() |
![]() |
#5 | Link |
Registered User
Join Date: Apr 2012
Posts: 7
|
I developed my own tool to fix horizontal shaking in digitized videos: https://github.com/rsnitsch/vhs-deshaker
|
![]() |
![]() |
![]() |
#6 | Link |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 93
|
Does it work for vertical shift as well? Is it able to go at field level? It happens sometimes in a capture that the even or the odd fields are shifted by 1 or more lines. Easily fixable by hand with crop().addborders(), but if an automatic tool is available it may have a large interest
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
![]() |
![]() |
![]() |
#8 | Link | ||
Registered User
Join Date: Apr 2012
Posts: 7
|
Quote:
I did not know that digitized VHS videos can also suffer from vertical shaking or shifted lines. Do you know why that happens? Can you upload some example video files (ideally separate files for each problem type). If it's easy to fix then I might develop another tool in my free time... or extend vhs-deshaker. My first recommendation for vertical shaking would be to try and use a normal deshaking tool. In my case the performance of traditional deshaking tools was bad because - I guess - the shaking was very severe and irregular between subsequent frames. Therefore I developed my own tool, which yielded much better video quality. But the traditional deshaking tools DID help somewhat at least... if I recall correctly about 50% of the shaking was gone. With my own tool I got to about 90%. Quote:
Last edited by robert.n; 17th March 2023 at 14:08. |
||
![]() |
![]() |
![]() |
#10 | Link | ||||
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 93
|
Quote:
Quote:
Quote:
Quote:
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
||||
![]() |
![]() |
![]() |
#11 | Link | |
Registered User
Join Date: Apr 2012
Posts: 7
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#12 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,285
|
Quote:
A "hacky" solution for that would be to detect the top non Y=16 line, and use conditionalfilter for the line shift . But it would be a less generalizable solution to generic problem - Is that pattern consistent for that setup ? ie. In that sample, it's always the same field shifted in the same direction, and the same magnitude - the pattern does not change This will "fail" if the content is dark, maybe a fade in , that sort of thing - it will give a false positive Code:
o=AVISource("PATH\ufo_sIII3c_amtv_4_v2.avi").ConvertToYV24(interlaced=true) f1=o.assumebff().separatefields().selecteven() f2=o.assumebff().separatefields().selectodd().crop(0,0,0,-1,true).addborders(0,1,0,0) interleave(f1,f2) weave() f2up=last #r=blankclip(o, height=1 , color=color_red) #overlay(o, r, y=10, opacity=0.8) #find line position det=o.crop(0,10,0,-565,true) #ConditionalFilter(det, f2up, o, "AverageLuma()", ">", "30", show=true) #debug threshold ConditionalFilter(det, f2up, o, "AverageLuma()", ">", "30", show=false) ConvertToYV16(interlaced=true) |
|
![]() |
![]() |
![]() |
#13 | Link | |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 93
|
Thanks poisondeathray for your attempt, higly appreciated. I will experiment it.
Quote:
To detect them I use this approach (developed with help from StainLessS); it produces many false positive and does not detect many of the 1 line only shifts: Code:
AviSource(video) # plugins directory plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\" # RT_Stats loadPlugin(plugins_dir + "RT_Stats_25&26_x86_x64_dll_v2.00Beta12_20181125\Avisynth26\RT_Stats_x86.dll") # FrameSel loadPlugin(plugins_dir + "FrameSel_x86_x64_dll_v2-20_20180420\Avisynth+_x86\FrameSel_x86.dll") AssumeTFF() threshold = 7 frames_file = video+"_bad_frames_threshold_"+string(threshold)+"_v2.txt" frames_file = frames_file.RT_GetFullPathName RT_FileDelete(frames_file) report = """ n = current_frame Top2Bot = RT_FrameDifference(last.separateFields.selectEven(),last.separateFields.selectOdd(),n=n,n2=n,ChromaWeight=0.0) Prv2CurE = RT_FrameDifference(last.separateFields.selectEven(),last.separateFields.selectEven(),n=n,n2=n-1,ChromaWeight=0.0) Cur2NxtE = RT_FrameDifference(last.separateFields.selectEven(),last.separateFields.selectEven(),n=n,n2=n+1,ChromaWeight=0.0) Prv2CurO = RT_FrameDifference(last.separateFields.selectOdd(),last.separateFields.selectOdd(),n=n,n2=n-1,ChromaWeight=0.0) Cur2NxtO = RT_FrameDifference(last.separateFields.selectOdd(),last.separateFields.selectOdd(),n=n,n2=n+1,ChromaWeight=0.0) Bingo = (Top2Bot > threshold && Prv2CurE > threshold && Cur2NxtE > threshold) || (Top2Bot > threshold && Prv2CurO > threshold && Cur2NxtO > threshold) (Bingo) ? RT_WriteFile(frames_file,"%d",n,Append=True) : NOP subtitle(RT_String("%d] Top2Bot=%.2f : Prv2CurE=%.2f : Cur2NxtE=%.2f : Prv2CurO=%.2f : Cur2NxtO=%.2f",n,Top2Bot,Prv2CurE,Cur2NxtE,Prv2CurO,Cur2NxtO),\ text_color=(Bingo)?$FF40FF:$FFFF00,y=10) """ ScriptClip(report) RT_ForceProcess return FrameSel(last,Cmd=frames_file,Show=true,REJECT=false) return last Code:
function shift_fields_GMa(clip c, int frame_number, line_shift_even, line_shift_odd) { # separate fields tff c_tff_sep=c.AssumeTFF().separateFields() # separate fields tff even c_tff_sep_even=c_tff_sep.SelectEven() # separate fields tff odd c_tff_sep_odd=c_tff_sep.SelectOdd() # shift field even c_tff_sep_even_rep = (line_shift_even > 0) ?\ c_tff_sep_even.trim(0,frame_number-1)\ ++c_tff_sep_even.trim(frame_number,frame_number).crop(0,0,0,-line_shift_even).addborders(0,line_shift_even,0,0)\ ++c_tff_sep_even.trim(frame_number+1,0)\ :\ c_tff_sep_even.trim(0,frame_number-1)\ ++c_tff_sep_even.trim(frame_number,frame_number).crop(0,-line_shift_even,0,0).addborders(0,0,0,-line_shift_even)\ ++c_tff_sep_even.trim(frame_number+1,0) # shift field odd c_tff_sep_odd_rep = (line_shift_odd > 0) ?\ c_tff_sep_odd.trim(0,frame_number-1)\ ++c_tff_sep_odd.trim(frame_number,frame_number).crop(0,0,0,-line_shift_odd).addborders(0,line_shift_odd,0,0)\ ++c_tff_sep_odd.trim(frame_number+1,0)\ :\ c_tff_sep_odd.trim(0,frame_number-1)\ ++c_tff_sep_odd.trim(frame_number,frame_number).crop(0,-line_shift_odd,0,0).addborders(0,0,0,-line_shift_odd)\ ++c_tff_sep_odd.trim(frame_number+1,0) # repaired video c_rep=interleave(c_tff_sep_even_rep,c_tff_sep_odd_rep).Weave() return(c_rep) }
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
|
![]() |
![]() |
![]() |
#14 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,655
|
For those who might not find it, if you click on Robert.n's link in post #5, and then click on the Readme.md file and you'll get lots of good information on his software, along with an excellent before/after video.
It looks to me like the software works on the entire frame rather than on individual lines. It therefore will probably not be useful for TBC errors which change a vertical flag pole into a wavy mess. Since this is correcting time base errors, it is worth mentioning past efforts on this problem. Building a software TBC has been a holy grail in this forum for many years, and while a few authors have come close, no one has ever produced something that really works, at least as far as I know. Here are links to some previous attempts. The length of some of these threads clearly shows the interest in such a project: New Script: Software TBC 0.6 & Sample (was Fast Line Shifter 0.53) Software TBC (Multi-page thread 1 2 3 4) Could a software equivalent to TBC be done in Avisynth... (Multi-page thread 1 2) However, even if this software isn't developed any further, it looks like it will still be very useful for certain types of VHS capture problems. |
![]() |
![]() |
![]() |
#15 | Link |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 93
|
Thanks a lot johnmeyer for the hints.
The problem here is not really the implementation of a (frame)TBC in software, which is a difficult (impossible?) and not accomplished task. What happens is that the (line)TBC of the VCR is active, and corrects the V synch of the signals (is then effective) but sometimes it makes an error of 1 or more lines. In general it occurs only in a couple of frames over 100.000 frames, in this special case happens more frequently. This can be fixed easily with just a shift of one of the field, but there is not (I have not found yet) an accurate way of detecting the shifted fields and fixing them, especially if they are 1 line only and consecutive. So I have to check at 1/3 of the speed the original video, and manually write the corrective actions. The final result will then be ok, but you understand that this manual operation is ok for few videos, it is crazy for many of them. Poisondeathray approch is working very well for a single pattern (even field shift 1 line up) and if no black areas are inside the top active image of the frame/field. I will work on it trying to extend its capabilities, but the problem is always the "right" detection.
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g Last edited by lollo2; 17th March 2023 at 17:42. |
![]() |
![]() |
![]() |
#16 | Link |
Registered User
Join Date: Apr 2012
Posts: 7
|
Thank you for the valuable information, in particular @johnmeyer.
As I mentioned in a related thread in the VideoHelp forum, I initially named my tool post-mortem-tbc. In the end I went with vhs-deshaker because it is easier found by laymen who don't know about TBC. Also, to be honest, I am not sure I have understood what TBC is all about. Over time I have seen various clips that demonstrate VHS playback with and without TBC. The symptoms (lines are horizontally shifted) are very similar (maybe identical, dunno) to what I encountered in my own VHS videos and what vhs-deshaker is meant to fix. My conclusion therefore is that indeed my tool is likely able to clean up many of these clips. Although in extreme cases it is probably necessary to tweak some internal smoothing parameters... Suggestion: You can upload some example clips with such TB problems and I can try and process them with my tool. Then we can see how good (or bad) it handles such cases. Ideally I get examples with varying degrees of TB problems (mild, medium, extreme). Lossless or quasi-lossless compression would be best (but x264 with CRF 18 should be sufficient). Last edited by robert.n; 17th March 2023 at 18:26. |
![]() |
![]() |
![]() |
#17 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,655
|
Time base correction is not well understood by most people. I am an electrical engineer but since I never had a job in the TV industry, I only partially understand the detailed complexities of how an analog TV signal is created, stored on tape, and then played back. However, I certainly understand enough to know that a key part of the very complex process is that the analog video camera, which initially captures the image, embeds a variety of different timing signals before the beginning of each video field, and also in between each half frame. The TV set which receives the video signal uses these timing signals to synchronize the scanning beam so that the capacitor which stores the ramp voltage which deflects the beam that puts the spot on the phosphor tube starts charging that capacitor at precisely the right time.
Unfortunately, when the analog video signal gets stored on tape, those timing signals get degraded. A time base corrector uses those degraded signals and, using the knowledge of how those signal should look, attempts to reconstruct them. Here is a link to a really short, simple explanation of what video can look like if the time base signals are corrupted, along with an "after" picture showing how a time base corrector can help: Using Time Base Correctors There are several problems created by a poor time base that would be very difficult to correct using software, after the capture. However, one of the most common problems where each scan line starts a little too early or a little too late compared to the adjacent lines, is something that almost certainly could be corrected in software. It is this particular problem that was discussed in those early thread I linked to in my previous post. On paper, the problem seems simple enough to solve especially if you are lucky enough to have a capture which has not been cropped in any way and therefore includes pure black down either the left or right edge of the frame. The idea is that you shift each line so that you get a "clean edge" up and down the extreme left or right of the frame. However, while I think the problem is solvable, it requires some reasonably advanced programming skills. |
![]() |
![]() |
![]() |
#18 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,156
|
@johnmeyer: I get '403 Permission Denied' for https://www.tgrantphoto.com/sales/in...o-dubbing-tips
|
![]() |
![]() |
![]() |
#19 | Link | |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,655
|
Quote:
Can you get to their site at all by just going to the main page? https://www.tgrantphoto.com If not, there must be something blocking you, either from your ISP, from the German government, or at some other point. You could try a VPN, if you have one installed. |
|
![]() |
![]() |
![]() |
#20 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,285
|
Quote:
If you have the combinations defined, it should be possible if you have a way of detecting it . You can do multi conditionals, scriptclip , but it gets complicated quickly. My gut says that sounds like too many combinations for that type of approach . Quote:
|
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|