digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Restore, Filter, Improve Quality (https://www.digitalfaq.com/forum/video-restore/)
-   -   Using Trim, color correction clips, recombining? (https://www.digitalfaq.com/forum/video-restore/15094-trim-color-correction.html)

billct97 04-26-2025 07:44 PM

Using Trim, color correction clips, recombining?
 
I've been at this for hours and I probably should have just split the clip into 7 parts, applied filters to each clip and then recombined them. Here's what I want to do.

1. I have a 60 second NTSC VHS newsbreak from the 1980's. Captured as an AVI.

2. There are 7 discrete parts to the newsbreak.
- Graphic to open.
- Anchor man and woman introducing the stories.
- Video of the 1st story.
- Video of the second story.
- Video of a person talking on stage.
- Black and white still of "the wife".
- Back to the anchors to wrap it up.

3. The levels and color are all over the place in each part.

I thought it would be easy enough to use Trim 7 times in an Avisynth script to assign the frame ranges. Then after each Trim have a line or two of ColorYUV, Tweak and Levels. Then at the end use AlignedSplice to recombine them. No such luck. It's probably something stupid easy like putting "last" in the right place or assigning the trimmed sections to a variable. But whatever I've tried (and researched) doesn't work.

If you have a section of Avisynth code where you are doing this could you share? I'd post what I've tried but I didn't save the failed attempts.

Thanks,
Bill

traal 04-26-2025 08:02 PM

I find all the chapter frame numbers, then do like this:

Code:

ch1_start = 960
ch2_start = 46533
ch3_start = 91664
a = Last
c0 = a.trim(0,ch1_start-1).Tweak(hue=0)
c1 = a.trim(ch1_start,ch2_start-1).Tweak(hue=-3)
c2 = a.trim(ch2_start,ch3_start-1).Tweak(hue=-4)
c3 = a.trim(ch3_start,0).Tweak(hue=0)
c0 ++ c1 ++ c2 ++ c3


billct97 04-26-2025 09:33 PM

Very nice! I'll give that a try in the morning.

keaton 04-27-2025 10:45 AM

Although you probably won't need it if you are just doing luminance/color adjustments, some filters or functions can effect the audio. So if you ever find issues with audio, such as silence in certain frames, then add AudioDubEx call at the end. This combines your video with the audio from the original clip before any of those filters/functions were used.

For black and white clips, if you look at a histogram or vectorscope, you'll likely find there's still some color noise that you may want to get rid of. In that case, I would set the sat setting to 0 in the tweak function. Of course, by the mid-90s there were network logos in the lower corner of the frame that might have color in them, even if the rest of the frame was black and white. In those cases, I don't set saturation to 0 and fix the color cast of the grey image.

Code:

#save copy of unaltered video to preserve the audio
audio = last

#do an operation that silences audio
v1 = audio.trim(0,100).tweak(sat=1.1).samplefilter()

#black and white clip, so remove residual color by setting saturation to 0
v2 = audio.trim(101,0).tweak(sat=0.0)

#combine video clips
video = v1++v2

#Combine resulting video with audio from the original unaltered video
AudioDubEx(video, audio)


billct97 04-27-2025 11:03 AM

Working like a charm! What I wanted to do was make the changes to the script, save it, flip over to vdub and hit F2 to see the changes to each section visually and with "Levels". I was missing the need to add the functions in line with the combined a.trim. So close yet hours wasted! Fortunately no audio problems like keaton suggested but I think AlignedSplice might help with that. The only unfixable challenge was video wipes (4 second news transitions) where the tweaks were very different between news stories. Maybe someday I take that on. For now I'm just happy getting better color and video levels and this method is going to get used a lot! The whole script is below in case it helps someone else (or anyone wants to tell me I'm still doing it wrong ;-)



Code:

AviSource("D:\VHS\Newsbreak-1986-07-06.avi")

Crop(14,0,-8,-8).AddBorders(10,4,12,4)

ch0_start = 326
ch1_start = 1002
ch2_start = 1574
ch3_start = 1873
ch4_start = 2048
ch5_start = 2272
ch6_start = 2670

a = Last

intro = a.trim(0,ch0_start-1).ColorYUV(gamma_y=0,gamma_u=7,gamma_v=-7).Tweak(sat=1.1, cont=1.0,dither=true,coring=false).Levels(35,1.3,225,16,235,dither=true,coring=false)

c0 = a.trim(ch0_start,ch1_start-1).ColorYUV(gamma_y=0,gamma_u=7,gamma_v=-7).Tweak(sat=1.1, cont=1.0,dither=true,coring=false).Levels(35,1.3,225,16,235,dither=true,coring=false)

c1 = a.trim(ch1_start,ch2_start-1).ColorYUV(gamma_y=-0,gamma_u=25,gamma_v=-40).Tweak(sat=1.2, cont=1.0,dither=true,coring=false).Levels(50,1.1,235,16,255,dither=true,coring=false)

c2 = a.trim(ch2_start,ch3_start-1).ColorYUV(gamma_y=-0,gamma_u=-20,gamma_v=-15).Tweak(sat=1.2, cont=1.0,dither=true,coring=false).Levels(50,1.1,235,16,255,dither=true,coring=false)

c3 = a.trim(ch3_start,ch4_start-1).ColorYUV(gamma_y=0,gamma_u=30,gamma_v=-30).Tweak(sat=1.5, cont=1.0,dither=true,coring=false).Levels(50,1.1,255,16,235,dither=true,coring=false)

c4 = a.trim(ch4_start,ch5_start-1).ColorYUV(gamma_y=0,gamma_u=60,gamma_v=-60).Tweak(sat=1.1, cont=1.0,dither=true,coring=false).Levels(30,1.1,255,16,235,dither=true,coring=false)

c5 = a.trim(ch5_start,ch6_start-1).ColorYUV(gamma_y=0,gamma_u=0,gamma_v=0).Tweak(sat=1.0, cont=1.0,dither=true,coring=false).Levels(0,1.0,255,16,235,dither=true,coring=false)

c6 = a.trim(ch6_start,0).ColorYUV(gamma_y=0,gamma_u=7,gamma_v=-7).Tweak(sat=1.1, cont=1.0,dither=true,coring=false).Levels(35,1.3,225,16,235,dither=true,coring=false)

intro ++ c0 ++ c1 ++ c2 ++ c3 ++ c4 ++ c5 ++ c6

# ConvertToYV12(interlaced=false)
# Histogram("Levels")


billct97 05-04-2025 08:54 PM

1 Attachment(s)
I'm much happier with the way the color looks now and I'd like to fix some of the other imperfections but I'm not quite sure what they are called which might help choose what filters to use. I've uploaded 5 seconds of video (HuffYUV compressed) to get under the 99MB limit. Here are the things I'd like to improve upon.

On the graphics slide...
- The green on some left and right edges of the orange logo.
- The wavy edges on all of the letters.

On the anchors...
- The wavy edges of the lower windows of the capitol building on the background.
- The white outline to the right of the male anchors head.
- The green halo to the left of both anchors heads.

Anything else you'd fix let me know and thank you!

Aya_Rei 05-04-2025 09:32 PM

The bleeding colors can be fix with some chroma shifting, or at least made less bad. The white outline is a halo, dehaloing filters can be used to help reduce it.

As for the wavy edges, are you using a VCR with a TBC built in? Those should help correct those kind of waves, but seeing how it only affects that small part of the image and not the whole frame, I'm not sure myself

billct97 05-05-2025 05:58 AM

Quote:

Originally Posted by Aya_Rei (Post 102540)
The bleeding colors can be fix with some chroma shifting, or at least made less bad. The white outline is a halo, dehaloing filters can be used to help reduce it.

Got it, will work with those filters!


Quote:

Originally Posted by Aya_Rei (Post 102540)
As for the wavy edges, are you using a VCR with a TBC built in? Those should help correct those kind of waves, but seeing how it only affects that small part of the image and not the whole frame, I'm not sure myself.

TBC on both VCR's - JVC HR-9800U and AG-1980 plus the external TBC3000. ATI 600 USB for capture.

This is a rather old tape and IIRC my in-laws (who recorded this) had one of those big old top loading VTR's (where did that ever go?). So maybe this is a result of very old recording technology or noise in the CATV back in those days? Maybe if I re-read some of sanlyn's old posts I'll find a fix as well.

Selur 05-08-2025 10:03 AM

is that a sample of your source or of the already filtered file?

billct97 05-08-2025 10:18 AM

That 5 second sample is after color correction. I believe it is also deinterlaced already (destination will be YouTube eventually). I can post the original capture before deinterlace and color correction if that would be better.

Selur 05-08-2025 12:30 PM

1 Attachment(s)
Yes, that might help allow more to lessen the bleeding.
(script: https://pastebin.com/4ykctT44)

billct97 05-08-2025 08:56 PM

1 Attachment(s)
Quote:

Originally Posted by Selur (Post 102596)
Yes, that might help allow more to lessen the bleeding.
(script: https://pastebin.com/4ykctT44)

Here is 10 seconds of the original capture, no color correction, no deinterlacing if you would like to try your script on this (and thank you!). I see your script is written for Vapoursynth and I'd assume that it can be imported into Hybrid? Could you explain how that is done?

I may not reply until next weekend as I'll be travelling for work soon.

Thank You,
Bill

billct97 05-08-2025 09:04 PM

Quote:

Originally Posted by Selur (Post 102596)
Yes, that might help allow more to lessen the bleeding.
(script: https://pastebin.com/4ykctT44)

Looking at your "going crazy.mp4" on my larger calibrated display, I do see the wavy letters and capitol windows are much less wavy and the color bleed also looks better. The video does have that soft and waxy look that I see a lot of people seem to go for in restoration. Myself I might go a little less soft and waxy if I can. I don't mind an old video looking old. As long as I can do better fixing things that shouldn't be there. Getting there so very slowly!

Selur 05-09-2025 09:18 AM

4 Attachment(s)
I played around a bit more.
Looking at the unfiltered source.
a. you might want to apply different U and V shifts to the chroma
b. you might want to filter the intro differently than the rest. (Maybe replace the intro with a cleaned up static image,...)

Cu Selur

billct97 05-22-2025 08:18 PM

Hi, I'm back from a long work trip and looking forward to trying your script. Of course I will need to change "F:/Hybrid/64bit/" to match my system. What I don't understand is how to load playing_around_1.txt into Hybrid. I've looked at the Hybrid interface and Googled without any success.

Selur 05-26-2025 07:54 AM

Yes, one could load the script into Hybrid, by giving it a .vpy extension, adjusting the paths and loading it in Hybrid.
But, I would not recommend it. Better get accustomed to Hybrid and create the script using Hybrid.
Looking at the Vapoursynth script preview should help, to adjust the settings to what I chose, but be aware, that these scripts require the vs-mlrt addon of Hybrid to be installed too.

Cu Selur


All times are GMT -5. The time now is 04:27 PM

Site design, images and content © 2002-2026 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2026 Jelsoft Enterprises Ltd.