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 > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th July 2020, 20:21   #21  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
After some time experimenting with avisynth, I finally conjured a good avs script using QTGMC deinterlacing. The resulting image quality - checked using Virtualdub as a frameserver - turned out really nice, especially taking into account the not-so-good original PAL VOB.

Here's the script:

LoadPlugin("C:\Program Files (x86)\MEGUI\tools\avisynth_plugin\FFMS2.dll")
LoadPlugin("D:\USER\Documentos\IMPORTANT STUFF BACKUP\avisynth plugins\hqdn3d\hqdn3d.dll")
mpeg2source("G:\WORKING\Duarte&co\Duarte e Companhia - 10 RTP memoria.d2v")
AssumeTFF()
QTGMC( Preset="Slower", MatchPreset="Slower", MatchPreset2="Slower", SourceMatch=3, Sharpness=0.9, TR2=3, Lossless=2 )
#(TR2= 0 for clean sources TR2=3 for noisy sources)
SelectEven()
#SelectEven() maintains original framerate
hqdn3d(ls=1.0, cs=1.0, lt=6.0, ct=1.0, restart=7)
LanczosResize(768,576)
Crop(10, 2, -16, -0)

However, I'm still experiencing difficulties trying to maintain the original aspect ratio. I scaled to 768x576 because I read in avisynth's wiki that operation changes the PAR to 1:1, which is what I want: a universal resolution for modern displays (LCD and such), giving up on CRTs.

Yet, when I open the resulting video file, VLC player still changes the aspect ratio when I switch from original to 4:3. This confuses me, because I thought I had created a video file that did not require aspect ratio changes on modern LCDs.

Which one is right: my stipulated resolution or VLC?
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/
tugatomsk9 is offline   Reply With Quote
Old 8th July 2020, 21:30   #22  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by tugatomsk9 View Post
SelectEven()
Don't do that, especially not for motorsport.
Cary Knoop is offline   Reply With Quote
Old 8th July 2020, 21:44   #23  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by Cary Knoop View Post
Don't do that, especially not for motorsport.
I forgot to mention this particular case is not the aforementioned motorsports videos, but is instead an old Portuguese drama series. It was originally entirely shot on film, hence why I felt that it was of no use to bob the framerate to 50fps and increase the bitrate further; 25fps seemed more than enough in this case.
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/

Last edited by tugatomsk9; 8th July 2020 at 21:50.
tugatomsk9 is offline   Reply With Quote
Old 8th July 2020, 22:14   #24  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,387
Quote:
Originally Posted by tugatomsk9 View Post
I forgot to mention this particular case is not the aforementioned motorsports videos, but is instead an old Portuguese drama series. It was originally entirely shot on film, hence why I felt that it was of no use to bob the framerate to 50fps and increase the bitrate further; 25fps seemed more than enough in this case.
If it was shot on film and transferred to PAL, it should have 25p frames even if the container specifies interlaced. Bobbing in that case would either do nothing or wreck your content, making it look all soap-opera like, ala turning on aggressive motion smoothing settings on a TV.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 8th July 2020, 23:52   #25  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by benwaggoner View Post
If it was shot on film and transferred to PAL, it should have 25p frames even if the container specifies interlaced. Bobbing in that case would either do nothing or wreck your content, making it look all soap-opera like, ala turning on aggressive motion smoothing settings on a TV.
The production originally shot on film, yes, but the show was broadcasted on cable (and had been broadcasted decades earlier on aerial TV) and I recorded it in DVD format with a standalone Sony DVR. That's why my source is interlaced.
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/

Last edited by tugatomsk9; 9th July 2020 at 00:17. Reason: grammar
tugatomsk9 is offline   Reply With Quote
Old 9th July 2020, 07:13   #26  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,934
You could post a sample, it's easier to see what it actually needs Avisynth-wise. There's a variety of high-quality denoisers out there and hqdn3d may not be optimal especially with content with lots of motion.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 9th July 2020, 07:39   #27  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,739
Quote:
Originally Posted by tugatomsk9 View Post



LanczosResize(768,576)
Crop(10, 2, -16, -0)

However, I'm still experiencing difficulties trying to maintain the original aspect ratio. I scaled to 768x576 because ....
But you crop after resizing. Your player has probably stretched the cropped picture to 4:3 DAR.
Upload a short sample of the captured video for obtaining better advice how to crop and resize.
Sharc is offline   Reply With Quote
Old 9th July 2020, 14:36   #28  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by Sharc View Post
But you crop after resizing. Your player has probably stretched the cropped picture to 4:3 DAR.
Upload a short sample of the captured video for obtaining better advice how to crop and resize.
I cropped heavily because there were significantly large black areas on the sides. Another reason was it was my understanding that cropping after setting the desired aspect ratio did not change it.

Here's a sample of the original VOB:

https://drive.google.com/file/d/1IYQ...ew?usp=sharing
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/

Last edited by tugatomsk9; 9th July 2020 at 14:54.
tugatomsk9 is offline   Reply With Quote
Old 9th July 2020, 16:07   #29  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,739
For converting to square pixels and 4:3 DAR I would suggest:
Code:
crop(10,2,-16,-2)
LanczosResize(720,542)
AddBorders(0,16,0,18)
It returns a 720x576 frame, square pixels, for DAR 4:3.
Sharc is offline   Reply With Quote
Old 9th July 2020, 16:13   #30  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,934
That one's definitely progressive. If you just load the source and use Bob(), you can see that there is no motion between the fields. This means you can ditch QTGMC.

In my opinion it doesn't need that much denoising, but you could try MCDegrainSharp. Adjust to taste.
https://forum.doom9.org/showthread.p...45#post1737045
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 9th July 2020, 17:06   #31  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by Sharc View Post
For converting to square pixels and 4:3 DAR I would suggest:
Code:
crop(10,2,-16,-2)
LanczosResize(720,542)
AddBorders(0,16,0,18)
It returns a 720x576 frame, square pixels, for DAR 4:3.
Most interesting! Thanks for correcting me, I' going to use this method as a template for VOBs.
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/
tugatomsk9 is offline   Reply With Quote
Old 9th July 2020, 17:11   #32  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by Boulder View Post
That one's definitely progressive. If you just load the source and use Bob(), you can see that there is no motion between the fields. This means you can ditch QTGMC.
I didn't notice it was progressive! It's just that all my recordings from that DVR are interlaced, so I assumed this one was too. I guess that particular episode was broadcasted as progressive and the DVR detected it?

Anyway, thanks for pointing that out. Removing QTGMC will boost the encoding speed by a lot.


Quote:
Originally Posted by Boulder View Post
In my opinion it doesn't need that much denoising, but you could try MCDegrainSharp. Adjust to taste.
https://forum.doom9.org/showthread.p...45#post1737045
What's the main difference between MCDegrainSharp and HQDenoise3D? Is the former much faster?
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/

Last edited by tugatomsk9; 9th July 2020 at 17:20.
tugatomsk9 is offline   Reply With Quote
Old 9th July 2020, 17:34   #33  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,739
Quote:
Originally Posted by tugatomsk9 View Post
Most interesting! Thanks for correcting me, I' going to use this method as a template for VOBs.
Just word of caution:
My proposal was based on the assumption that the .vob had an ITU PAR of 1.092 (for DAR=4:3). The left and right borders are an indicator for this assumption.
You will find other .vobs (usually of newer DVD's) with a 'Generic' PAR of 1.067 (for DAR=4:3). These do normally not have left and right black borders, and the resizing to square pixels would become slightly different.
But anyway, if you pick the wrong one the error is 2.4% only.
Sharc is offline   Reply With Quote
Old 9th July 2020, 18:07   #34  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,387
Quote:
Originally Posted by tugatomsk9 View Post
I didn't notice it was progressive! It's just that all my recordings from that DVR are interlaced, so I assumed this one was too. I guess that particular episode was broadcasted as progressive and the DVR detected it?

Anyway, thanks for pointing that out. Removing QTGMC will boost the encoding speed by a lot.
24p film is converted to 25p PAL by speeding the film up 4% so each film frame becomes one PAL frame. Nothing like the 3:2 telecine NTSC countries have been cursed with.

So, the broadcast was probably interlaced, and the bitstream is probably flagged as such. But the actual frames themselves are progressive source, and with MBAFF are made entirely of progressive macroblocks.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 9th July 2020, 18:11   #35  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
Quote:
Originally Posted by Sharc View Post
Just word of caution:
My proposal was based on the assumption that the .vob had an ITU PAR of 1.092 (for DAR=4:3). The left and right borders are an indicator for this assumption.
You will find other .vobs (usually of newer DVD's) with a 'Generic' PAR of 1.067 (for DAR=4:3). These do normally not have left and right black borders, and the resizing to square pixels would become slightly different.
But anyway, if you pick the wrong one the error is 2.4% only.
Thank you once more.
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/
tugatomsk9 is offline   Reply With Quote
Old 9th July 2020, 20:28   #36  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,934
Quote:
Originally Posted by tugatomsk9 View Post
What's the main difference between MCDegrainSharp and HQDenoise3D? Is the former much faster?
Probably slower MCDegrainSharp does motion compensated denoising, simply put it sharpens blocks of good matches and blurs ones of bad matches with some weighting. Basically it should enhance edges and detail while removing noise.

It's easy to test how a filter changes the frame by using Interleave(), for example:

DGSource("test.dgi")
Interleave(last, MCDegrainSharp(bblur=0.2, csharp=0.4, frames=1))

Then you can switch between the original and processed frame in VirtualDub2 and adjust the parameters much faster.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 9th September 2020, 23:53   #37  |  Link
tugatomsk9
tugatomsk9
 
Join Date: Mar 2020
Posts: 21
So, I ended up buying the Avermedia Game Capture HD II which generates mp4 video files.

The recorded video quality of the Avermedia device in "576i optimal" (for VHS content) is good, but not great. The 8bit AVC average bitrate of only 7500 kbps is merely serviceable. VLC player plays it fine, though. The aspect ratio is 1:1, apparently, resulting in 720x576 video files. I guess it makes resizing easier?

The VCR being used is primarily a 2003 Panasonic NV-FJ623, with an older mono Sony SLV-135 whenever tracking becomes an issue.

The recording process is somewhat convoluted because I lack a composite to HDMi converter (I've ordered one, it just hasn't arrived yet). The signal from the VCR passes through a Sony DVD recorder (Sony RDR HX-710) via SCART. Then, the signal from the component output of the Sony recorder enters the Avermedia through the component input via a composite cable. It may seem terrible, but guess what, it works great, all things considered!

I'm trying to adapt the earlier avisynth script to these new mp4 files. I'm using Virtualdub 1.10.4 as a frameserver so I can check for errors.

Another issue is light aliasing present in the original VHS playback, like this, albeit not as strong:
https://forum.videohelp.com/threads/...nt-v-s-S-video

I tried figuring out if the aforementioned convoluted recording setup could be related to this. The conclusion is that it seems to be completely random, it doesn't happen all the time. I can't find a logical explanation. The tape in question was recorded in the late 80s with a long-gone National VHS VCR. There's no correlation with any of the cables used or the VCRs. Moreover, I used the Sony DVD recorder plenty of times in the past without aliasing issues.

To make matters worse, opening the avisynth script in Virtualdub is only sucessful if I don't use QTGMC, santiag (trying to test its anti-aliasing). It returns the error "File does not have a video stream"...

I even dumped the whole original mp4 in Virtualdub just so I could figure out if it was a case of fields swapped. I used "Field Swapping" in Virtualdub but it did not improve things.


EDIT: Here's a sample video.
https://mega.nz/file/aZBSyQZY#cPYbb4...1ywo51OREItECs

Right at the start of the video, notice the aliasing on the characters's contour lines.
__________________
Check out my youtube page at https://www.youtube.com/user/tugatomsk/

Last edited by tugatomsk9; 10th September 2020 at 00:49. Reason: more info
tugatomsk9 is offline   Reply With Quote
Old 10th September 2020, 07:43   #38  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,739
Quote:
Originally Posted by tugatomsk9 View Post
Mixed interlaced and progressive content, frame rate doubled with a broken pattern.
Try
Code:
QTGMC()
selecteven()
It will return 50fps progressive video preserving the temporal resolution of the interlaced sections.
Sharc is offline   Reply With Quote
Old 10th September 2020, 17:03   #39  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,387
Quote:
Originally Posted by tugatomsk9 View Post
So, I ended up buying the Avermedia Game Capture HD II which generates mp4 video files.

The recorded video quality of the Avermedia device in "576i optimal" (for VHS content) is good, but not great. The 8bit AVC average bitrate of only 7500 kbps is merely serviceable. VLC player plays it fine, though. The aspect ratio is 1:1, apparently, resulting in 720x576 video files. I guess it makes resizing easier?
No, it's just a bug. It is almost certainly 720x576 4:3 if it is from VHS, so anamorphic. I'd keep the resolution the same. But if you want square pixel, stretch it horizontally to 768x576. Although you probably want to crop to 704x576 first due to horizontal blanking.

Quote:
The VCR being used is primarily a 2003 Panasonic NV-FJ623, with an older mono Sony SLV-135 whenever tracking becomes an issue.

The recording process is somewhat convoluted because I lack a composite to HDMi converter (I've ordered one, it just hasn't arrived yet). The signal from the VCR passes through a Sony DVD recorder (Sony RDR HX-710) via SCART. Then, the signal from the component output of the Sony recorder enters the Avermedia through the component input via a composite cable. It may seem terrible, but guess what, it works great, all things considered!
I am besotted with a heady mix of nostalgia and PTSD reading the above.

Can't you just get a capture card that can go composite to lossless or perceptually lossless 4:2:2? Or at least real-time to something better than an ASIC H.264? That'd be fewer steps and better quality. Doing 4:2:0 capture with interlaced is just buying yourself pain.

Quote:
Another issue is light aliasing present in the original VHS playback, like this, albeit not as strong:
https://forum.videohelp.com/threads/...nt-v-s-S-video
What field order are you capturing with? It should be Top Field First for PAL, and you should consistantly use that throughout the pipeline. Bottom Field First got used for NTSC by default sometimes, so if you are reusing any NTSC workflows, things could get off.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 10th September 2020, 18:00   #40  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by Sharc View Post
Mixed interlaced and progressive content, frame rate doubled with a broken pattern.
Try
Code:
QTGMC()
selecteven()
It will return 50fps progressive video preserving the temporal resolution of the interlaced sections.
No, it won't.
Cary Knoop is offline   Reply With Quote
Reply

Tags
50fps, hevc, vhs, x264, x265

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 01:27.


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