actual video colour range (PC or TV) into log file

Support forum for DGDecNV
Post Reply
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

Hello.

I have a number of mpeg2 video clips produced by a DVD recorder (from VHS tapes) where I do not know the actual "Colour Range" - TV or PC - in the clips.

I don't necessarily believe any header info (if such exists); having said that, mediainfo reports nothing in that regard anyway.

I'm not sure if it's feasible, but I'll ask just in case it is - would it be possible for DGIndexNV to report in its log file the the actual "color_range" encountered ?

While I'm asking, what is the "normal" way someone would determine it for a video ?
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video levels (PC or TV) into log file

Post by hydra3333 »

Ah.
I suppose "ffprobe.EXE" -show_streams something.MPG does the trick. It's in there somewhere, I'm guessing from header info, "color_range=tv".

Code: Select all

[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=720
height=576
coded_width=0
coded_height=0
closed_captions=0
has_b_frames=1
sample_aspect_ratio=16:15
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=8
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=tt
refs=1
id=0x1e0
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/90000
start_pts=21600
start_time=0.240000
duration_ts=712090800
duration=7912.120000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
[SIDE_DATA]
side_data_type=CPB properties
[/SIDE_DATA]
[/STREAM]
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
profile=unknown
codec_type=audio
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=0x80
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/90000
start_pts=23040
start_time=0.256000
duration_ts=712088640
duration=7912.096000
bit_rate=256000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
[/STREAM]
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

actual video colour range (PC or TV) into log file

Post by Rocky »

I don't know much about it. I remember using VirtualDub's histogram back in the day. I don't remember any metadata but the MPEG2 spec is readily available.
DAE avatar
Sharc
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

actual video colour range (PC or TV) into log file

Post by Sharc »

AFAIK all consumer DVD recorders record in YV12 (YCbCr) color format with TV range, i.e. the range for Y is 16 .... 235 (luma) and the range for Cb and Cr is 16 .... 240 (chroma). Black is YCbCr=(16,128,128) and White is (235,128,128). How the analog VHS tape is converted and scaled to this range depends on the recorder and some settings like brightness, contrast, saturation if available (proc amp settings).

For viewing on a RGB monitor (PC, TV) the RGB values depend on the applied conversion equations (matrix). YCbCr(16,128,128) will normally become RGB(0,0,0) for black, and YCbCr(235,128,128) will become RGB(255,255,255) for white.
You can inspect the recorded digital file by opening it in avisynth using the Histogram("levels") and Histogram("classic") functions, or by using a color picker which returns the YCbCr and/or RGB values.
The status bar in AvsPmod can be configured to display the YCbCr and RGB values when you hover with the mouse over the preview picture.

One can get more control over the VHS -> digital conversion process by capturing the VHS tape losslessly, using the DVD recorder in passthrough mode only. You find plenty of posts at the VideoHelp and Doom9 forums how to do it.
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

Thank you !

Unfortunately the DVD Recorder is an LG RC689D https://www.lg.com/au/support/manuals?c ... 9D.BAUSLLK

As far as I can see, no passthrough. Never mind, I'll do what I can in software.

The video is a hand-me-down from elderly relatives (and that takes some doing at my age :)) who projected 2h worth of ageing Super8 stuff onto a projector screen and recorded that to a (non stabilized seated) camcorder and then recorded that to VHS tape. Of which I have what looks there only remains a gen2-like copy.
The only equipment I have access to (being retired, no $ available) is the LG RC689D to copy the VHS tape to a DVD as an mpeg2 recording.

As one may well imagine, it's as blocky and dirty and spotty and as flickery and colour faded as anything.
I could just leave it as-is ... but it contains the only known footage of my wife's relatives now deceased, so my goal is to clean it up as reasonably as is possible with what I have available.

I only have vapoursynth ... so I am attempting to cherry-pick and adapt bits of videoFred's script and some of DG's stuff like DGDecodeNV, DGDegrain, DGSharpen and PVBob.

So far I've managed to
1 somewhat-deblock it
2 sort of denoise it
3 sort of sharpen it
4 begin to use that as a pre-filtered clip for input to Analyze and thence DepanStabilise, however my guess is the flickering will not help (I'll need heavy duty deflickering later anyway).

Unfortunately vapoursynth appears not to have an updated Deflicker equivalent available perhaps like https://github.com/pinterf/Deflicker (the x64 dll crashed vapoursynthwhen attempting to load it; I have all the the visual studio runtimes installed), which makes things fairly difficult.
I suppose I should ask over on videohelp if anyone knows of something or how to get that loaded into vs.

Here's a downloadable 30 second 22Mb clip to show what I mean.


edit: a 71Mb sampler of items across the whole mpeg2 file


Of course, suggestions are welcomed ! :D

Cheers
DAE avatar
Sharc
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

actual video colour range (PC or TV) into log file

Post by Sharc »

No passthrough hmmm...... I had a quick look to the manual. At the rear side you find socket 10 Video/Audio Output. Maybe the VHS signal is there with - if you are lucky - some line sync stabilization in effect which prevents flaggig. You could connect from socket 10 to a capture device (PC card or USB capture device). Unfortunately socket 10 is Composite only rather than S-video, so you may not fully profit from the internal 3D comb filter which prevents dotcrawl and rainbows. You may just want to try.

Edit: I just read the history of the source. Well, passthrough may not be 1st priority then .......
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

Thank you Sharc.

You are right of course, other things are more likely to make a contribution :)
User avatar
thechaoscoder
Posts: 49
Joined: Tue Jul 14, 2020 8:34 am

actual video colour range (PC or TV) into log file

Post by thechaoscoder »

hydra3333 wrote:
Wed May 12, 2021 3:14 am
Unfortunately vapoursynth appears not to have an updated Deflicker equivalent available perhaps like https://github.com/pinterf/Deflicker (the x64 dll crashed vapoursynthwhen attempting to load it; I have all the the visual studio runtimes installed), which makes things fairly difficult.
In this case the best solution is to use https://github.com/sekrit-twc/avsproxy
Note: It uses the 32bit avisynth version.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

actual video colour range (PC or TV) into log file

Post by Rocky »

Let pinterf know about it. He doesn't like his stuff to crash. Me too.
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

Thank you. I'll post an issue on the git site.

I'm considering going back to avisynth x64 for this ... I know there's a multi version installer tool somewhere, I just need to locate the link :P
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

Ah, the wonders of google as an external memory when one's own is in the process of failing :)

I am now back to avisynth+ x64 and enjoying the historical posts about having used it so that I can recycle some bits of them. The great news is DG tools work flawlessly as expected.

The sad thing is I popped HCEnc into the same folder as the universal installer avisynth.dll (although I REM'd out registry stuff) but it didn't find it.
Hmm, on second thought, HCEnc.exe is 32-bit and I use 64-bit avisynth+ and plugins so no wonder.

So, for PAL DVD creation I seem to be constrained to using ffmpeg with

Code: Select all

-f dvd -video_format pal -b:v 8999999 -target pal-dvd -vf "setdar=4/3" 
because I don't know of a better way (benefit/cost not high enough to backtrack to x32 stuff).
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

actual video colour range (PC or TV) into log file

Post by Rocky »

Didn't see an issue lodged at the github. Developers need reports if things are to be fixed. ;)

I'll mark this resolved as no DG tool issue is apparent.
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

actual video colour range (PC or TV) into log file

Post by hydra3333 »

fair cop, I forgot
Post Reply