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. |
12th November 2018, 21:07 | #1 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
Encoding and deinterlacing DVDs using .avs
Hello,
Could someone help me with how to use .avs scripts properly? I have some ripped DVDs in which videos are interlaced in 30000/1001 NTSC format. I would like to encode the video using MediaCoder, ffmpeg, MeGUI or any other program with x264 codec and to use in the encode process my .avs script. I have never deinterlaced DVDs so I'd like to get some help from you. I read trough a lot of threads and would like to deinterlace using YADIF + nnedi3 and FFT3DFilter. I have seen video sample using TempGaussMC but it's probably taking too long to deinterlace so I'm not thinking about this plugin anymore. Code:
Load_Stdcall_Plugin("C:\Programs\MeGUI\tools\avs\plugins\yadif.dll") LoadPlugin("C:\Programs\MeGUI\tools\avs\plugins\nnedi3.dll") LoadPlugin("C:\Programs\MeGUI\tools\avs\plugins\fft3dfilter.dll") Yadif(mode=0, order=-1, planar=false, opt=-1) nnedi3(field=1) FFT3DFilter(sigma=3) I tried using MediaCoder x64 and load this script but nothing happened. I tried using ffmpeg BUT I don't know how to write .avs script with plugins and x264 settings and what commands to use while typing in console ffmpeg .... ? I tried using MeGUI but got error saying something about wrong version... I have installed AviSynth 2.6.0 latest version from sourceforge, ffmpeg x64, plugins x64 and x32. Should I install another version of AviSynth? Could someone post how to write script that I can use with ffmpeg including x264 options? ... or maybe you guys recommend another way of encoding and deinterlacing video? PS. I found in MediaCoder 2 options: Motion Compensation? IVTC? Should these be used while deinterlacing? Also if the video is in NTSC format can I use -framerate 24000/1001 without destroying the flow of video without any stuttering? Thanks a lot for any replies. |
13th November 2018, 00:06 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
It may seem a little obvious, but do you do not seem to have a Video Source in the script ?
__________________
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 ??? |
13th November 2018, 17:20 | #3 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
I'm using directshow. Should I use maybe avisource or the other avi?
Either way what I'm most interested in right now is how do you write script for ffmpeg to use x264 encoder with settings inside the script? Someone can post an example? And also how to avoid stuttering if I want to change ntsc framerate to film one 24000/1001? |
13th November 2018, 21:36 | #4 | Link | ||||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
(Its a little difficult to find as Pinterf dont have his own thread and original avs+ thread points to a very old version, also Pinterf sig below his posts points to the source code and not the binary, so one has to do a little bit of investigating to find it). Quote:
(DirectShowSource should be last option where everything else fails). Quote:
Post a sample on some file host (MediaFire often used [EDIT: zip it up first]), In DGIndex, mark start ('[' symbol), and end (']') of a 10 second segment with motion, then on file Menu, "Save Project and Demux Video", and post the "m2v" file. [EDIT: Dont bother with any other produced files] The experts here will be able to tell you if your source is interlaced or film requiring Inverse Telecine rather than deinterlace. To determine field order Code:
... # source filter AssumeTFF # or also try AssumeBFF return SeparateFields ... # [EDIT: Will be half height, resize in VDub2 to full size when viewing] Quote:
Others here can probably help you better than I, I'm from PAL land and dont have to play with NTSC much (HeHeHe).
__________________
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; 13th November 2018 at 22:10. |
||||
13th November 2018, 22:58 | #5 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
Okay, um I have ripped DVD and what I have are .VOB files.
This is it about the file from MediaInfo: Code:
Complete name : C:\dvd\VTS_01_1.VOB Format : MPEG-PS File size : 1 024 MiB Duration : 16 min 52 s Overall bit rate mode : Variable Overall bit rate : 8 482 kb/s Writing library : encoded by TMPGEnc Video Mastering Works 5 Version. 5.3.0.82 Video ID : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : M=3, N=16 Format settings, picture structure : Frame Duration : 16 min 52 s Bit rate mode : Variable Bit rate : 8 121 kb/s Maximum bit rate : 9 400 kb/s Width : 720 pixels Height : 480 pixels Display aspect ratio : 16:9 Frame rate : 29.970 (30000/1001) FPS Standard : NTSC Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.784 Time code of first frame : 00:00:00:00 Time code source : Group of pictures header GOP, Open/Closed : Closed Stream size : 980 MiB (96%) Writing library : TMPGEnc Video Mastering Works 5 Version. 5.3.0.82 Color primaries : BT.601 NTSC Transfer characteristics : BT.601 Matrix coefficients : BT.601 Audio ID : 189 (0xBD)-128 (0x80) Format : AC-3 Format/Info : Audio Coding 3 Commercial name : Dolby Digital Muxing mode : DVD-Video Duration : 16 min 52 s Bit rate mode : Constant Bit rate : 192 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Bit depth : 16 bits Compression mode : Lossy Stream size : 23.2 MiB (2%) Service kind : Complete Main I have installed the AviSynth+ and this is my script: Code:
LoadPlugin("C:\Programy\AviSynth+\plugins64+\DirectShowSource.dll") DirectShowSource("C:\dvd\VTS_01_1.VOB", fps=23.97, convertfps=true, pixel_type="YV12") Load_Stdcall_Plugin("C:\Programy\AviSynth+\plugins\yadif.dll") Yadif(mode=0, order=-1, planar=false, opt=-1) LoadPlugin("C:\Programy\AviSynth+\plugins64+\nnedi3.dll") nnedi3(field=1) LoadPlugin("C:\Programy\AviSynth+\plugins64+\fft3dfilter.dll") FFT3DFilter(sigma=3) So I downloaded yadifmod2 and it works fine. This is all too hard for me. Maybe I will tell what I'm trying to achieve. My goal is to encode the .VOB file to .mp4 file using x264 plugin with my own settings, deinterlace it and if possible change fps to 23.97 or if it's better to leave as it is then it's fine then I would like to save image sequences and run batch file to resize it and encode it back into .mp4 resized version. PS. I have installed AviSynth+ x64 and x86, aswell ffmpeg x64, mediacoder x64, megui. If I should use different programs to do so let me know. PS2. I have also installed VapourSynth64Portable I found on this forum it's probably for resizing video but I'd better stick with resizing images since it won't be a piece of cake to use this program probably... Oh well that's it. EDIT. What should I write in the script if I want to encode all the .VOB files 01, 02, 03, 04 and join them together into .mp4? Last edited by Blovesx; 14th November 2018 at 00:06. |
14th November 2018, 14:02 | #6 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
I doubt that you should deinterlace. Your video is probably telecined film, but we would need a sample to be sure. So leave as is and don't resize it in a first attempt. Edit: You could also import your DVD in BD-Rebuilder and select the .mp4 output container. You need to familiarize with BD-Rebuilder though and carefully follow its installation instructions. Good luck. Last edited by Sharc; 14th November 2018 at 15:05. |
|
15th November 2018, 09:21 | #7 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
|
If it's a VOB extracted from a DVD, don't use DirectShowSource, use DGIndex instead.
DGIndex it's gonna index your VOB and extract audio tracks. Once you have done that, check whether it's truly interlaced or telecined. If you are not sure whether it's interlaced or telecined, just try to deinterlace it first and go frame-by-frame; if it has dups, it probably means that it's telecined. If interlaced: Code:
#Indexing video=DGDecode_MPEG2Source("video.d2v") audio=WAVSource("audio.wav") AudioDub(video, audio) #Deinterlace to 29.970fps progressive tdeint(mode=2, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2, opt=4) #Resize Spline64Resize(848, 480) Code:
#Indexing video=DGDecode_MPEG2Source("video.d2v") audio=WAVSource("audio.wav") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) |
17th November 2018, 23:59 | #8 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
Why would I resize the original VOB to 848x480?
This is the information about my VOBs I have: Code:
Stream Type: MPEG2 Program Profile: main@main Frame Size: 720x480 Display Size: 720x480 Aspect Ratio: 16:9 [3] Frame Rate: 29.970030 fps Video Type: NTSC Frame Type: Interlaced Coding Type: B Colorimetry: SMPTE 170M Frame Structure: Frame Field Order: Top What more... it is animation. So I believe I should save it as D2V project file using 'Honor Pulldown Flags' and use the IVTC one code you gave me? Should I also deinterlace it? One more question I don't get about colours is which is the one people mostly use for PC? I'm always confused... but I'm sure in ffmpeg you can only choose yuv420p whatever it is meant to be. Also should I use yuv420p10 if I want to use x264 to encode to 10bit? PS. Most important question I have 4 .VOB files from the DVD but I'd like to merge 2 of them only. Should I run it trough IVTC process then merge it using ffmpeg option? Then I can encode it for .mp4 format? Maybe stupid question how do I use the script? Code:
LoadPlugin("C:\Programy\AviSynth+\docs\dgmpgdec158\DGDecode.dll") video=MPEG2Source("VTS_01_1.d2v") audio=AC3Source("VTS_01_1 T80 2_0ch 192Kbps DELAY 0ms.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) Last edited by Blovesx; 18th November 2018 at 00:45. |
18th November 2018, 18:38 | #9 | Link | ||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
|
Quote:
720x480 can be either flagged 4:3 or 16:9, it's up to the player to display the correct aspect ratio. You could leave it as it is and just flag it, but if you are gonna watch it on a computer, I think it's better if you resize it yourself to 16:9. Quote:
This way, you'll have the original progressive framerate back. Quote:
Color Sampling: 4:2:0, 4:2:2, 4:4:4 are the chroma sampling. 4:2:0 is generally the standard as it's supported by a wide majority of devices. 4:2:2 is generally used by studios in order to make mezzanine files. (I use it on a daily basis). 4:4:4 is generally used for master files and it retains as many details as possible for chroma. The reason why the standard chroma sampling is 4:2:0 is that luma samples are more important than chroma samples for our eyes due to rods and cones. Color Matrices: The most known color matrices are BT601 (for SD contents), BT709 (for HD and FULL HD contents) and BT2020 (for UHD contents). In your case, the color matrix is BT601 and you should keep it that way, unless you wanna upscale. In that case, you would have to convert it. Levels (TV and PC): TV and PC is actually just a different name for "Limited" and "Full". TV range is Limited range. PC range is Full range. Because TVs can't display as many things as PCs, everything that goes on air must be in Limited range, otherwise it will be refused on QC. Limited range is 16-235 (0.0 - 0.7V), while Full range is 0-255 for 8bit. In your case it's limited range, with 16 as pure black and 235 as pure white and you should leave it as it is. Bit depth: The standard has always been 8bit, but nowadays, with HEVC, UHD contents are 10bit. As a matter of fact, x264 has been able to encode in 10bit for many years, but unfortunately it has never been standard and it was possible to play such files on computers only (and a very limited number of devices). Anyway, Avisynth has been supporting high bit depth for years and there's a reason: filtering. In other words, I always suggest to encode to 10bit in H.264 if you don't care about playback compatibility for two reasons: 1) If you wanna filter out issues, index your 8bit source, bring everything to 16bit, filter out issues, then dither it down to either 10bit or 8bit. 2) If you wanna encode an 8bit source to 10bit, it would still make sense to encode it to 10bit 'cause x264 will use 10bit precision calculations internally and it will manage to save more space (at the same quality) than 8bit. If you do wanna have playback compatibility, then you should encode to 8bit. Quote:
Code:
#Indexing video=DGDecode_MPEG2Source("VTS_01_1.d2v") audio=AC3Source("VTS_01_1.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) part1=last #Indexing video=DGDecode_MPEG2Source("VTS_01_2.d2v") audio=AC3Source("VTS_01_2.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) parte2=last #append part1++part2 By the way, may I suggest you to use x264, NeroAAC and Mp4box instead of ffmpeg? Last edited by FranceBB; 18th November 2018 at 18:43. |
||||
19th November 2018, 20:59 | #10 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
One more thing is could you explain me how do I use the script and could you give me example scripts concerning the other programs and the commands to use them trough cmd aswell as the order in which I should use them? I have downloaded x264 10bit and 8bit version, NeroAAC and Mp4box now I need to know how to use them.
Another thing is I have installed AviSynth+ 64 bit should I use AviSynth+ x86 version instead? Do you recommend using x64 plugins or x86 plugins what's the difference? Last one, you explained to me how the colors work but I'm still not sure is it i420 or yv12 I should use? Code:
The reason why the standard chroma sampling is 4:2:0 is that luma samples are more important than chroma samples for our eyes due to rods and cones. |
20th November 2018, 10:18 | #11 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,821
|
If you use MeGUI, it should take care of your concerns, and it comes with the programs you mentioned, except for NeroAAC (copy it to the "MeGUI\tools\eac3to" folder if it exists, and enable NeroAAC in MeGUI's options).
MeGUI comes with a portable version of Avisynth+ that it uses by default. I assume 32 bit MeGUI comes with 32 bit Avisynth+ and 64 bit MeGUI includes 64 bit Avisynth+. You can't mix and match. If you installed 32 bit Avisynth then you need to use 32 bit Avisynth plugins with it. It's probably better for the "installed" Avisynth to be the same as MeGUI's portable version, as then scripts created by MeGUI will open in other programs (only MeGUI uses it's portable version). There used to be a shortage of 64 bit plugins, although I think it's getting better now, but installing 32 bit versions of everything is probably the safer bet. |
20th November 2018, 20:23 | #12 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
|
You should install Avisynth+ (pinterf) x86, 'cause it's more stable and there are many filters for it.
You can get a list of plugins from me as I included "plugins" and "plugins+" in the rar I uploaded: Link In the rar you'll find: 1) Plugins 2) Plugins+ 3) encoder In the "encoder" folder, you'll find avs4x264mod.exe, Bepipe.exe, NeroAAC.exe, MP4Box.exe, x264-10b.exe, Command Line H264 10bit.bat and AVS Script.avs. Copy all my plugins in your plugins directory. Make sure you have all the C++ Redistributable and .NET Framework installed. Leave the AVS Script as it is, just make sure that the names and the path are correct. Then, double click on the .bat and the encode should start. The bat is pretty easy, it basically encode the video with x264 10bit in 4:2:0 High level 4.1 crf 19 and creates a ".h264" file. Bepipe gets the audio from Avisynth and pipes the uncompressed audio stream to NeroAAC which encodes in AAC at 320kbit/s (bitrate should be enough, but you can change it). NeroAAC creates a ".aac" audio. Last but not least, MP4Box muxes video and audio and creates a ".mp4" file. AVS Script: Code:
#Indexing video=DGDecode_MPEG2Source("VTS_01_1.d2v") audio=AC3Source("VTS_01_1.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) part1=last #Indexing video=DGDecode_MPEG2Source("VTS_01_2.d2v") audio=AC3Source("VTS_01_2.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) parte2=last #append part1++part2 #Color Matrix Conversion ColorMatrix(mode="Rec.601->Rec.709", interlaced=false, threads=0, thrdmthd=0, opt=3) #Clipping Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240) Code:
avs4x264mod.exe "AVS Script.avs" --x264-binary "x264-10b.exe" --preset medium --level 4.1 --profile High10 --crf 19.0 --vbv-maxrate 25000 --vbv-bufsize 25000 --deblock -1:-1 --overscan show --colormatrix bt709 --range tv --log-level info --thread-input --transfer bt709 --colorprim bt709 --videoformat component --nal-hrd vbr --output "raw_video.h264" Bepipe.exe --script "Import(^AVS Script.avs^)" | neroAacEnc.exe -lc -br 320000 -if - -of "audio.aac" mp4box.exe -add "raw_video.h264" -add "audio.aac" "final_output_10bit.mp4" pause Cheers |
23rd November 2018, 04:23 | #13 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
Thank you for your help FranceBB. You helped me a lot and probably other people who were watching this thread.
Though, I had problems using the script you gave me but I found somehow the solution to it. I had to use these plugins: Code:
LoadPlugin("C:\Programs\AviSynth+\plugins\MPEG2DEC.dll") LoadPlugin("C:\Programs\AviSynth+\plugins\DGDecode.dll") LoadPlugin("C:\Programs\AviSynth+\plugins\NicAudio.dll") Code:
video=DGDecode_MPEG2Source to video=MPEG2Source Code:
audio=AC3Source to audio=NicAC3Source Since we're at it could you tell me how using this script I can encode part1 and part2 certain amount of time for ex. from 0 to 10 min. only not the whole file. I'm not really sure what the rest of the script is doing: Code:
#Color Matrix Conversion ColorMatrix(mode="Rec.601->Rec.709", interlaced=false, threads=0, thrdmthd=0, opt=3) #Clipping Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240) Not really sure what's Limiter doing which plugin is responsible for this and ColorMatrix? PS. Can I use NicAC3 to encode .ac3 format to also my chosen bitrate and bits, khz? It's said in documents only .raw file. PS2. How should I approach the encoded file now if I want to save all the frames as image sequences so I can run batch file to resize it using another program? After that can I just use ffmpeg to connect image sequences into *.mp4 without encoding? Last edited by Blovesx; 23rd November 2018 at 04:26. |
23rd November 2018, 06:46 | #14 | Link | |||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
|
Quote:
Quote:
As to Limiter, it just makes sure that Limited TV Range is respected and values don't exceed the range 16-235. (Ever since I started working in broadcast, I started to be extremely concerned about tv range). Quote:
You said that you wanted a specific frequency; in that case, you can either use ResampleAudio() or SSRC in Avisynth to feed the audio encoder (ffmpeg) with the desired sampling rate. Like: Code:
#Loudness Correction ResampleAudio(48000) Quote:
For instance: Code:
#Indexing video=DGDecode_MPEG2Source("VTS_01_1.d2v") audio=AC3Source("VTS_01_1.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) #Trimming the first 1000 frames trim(0, 1000) part1=last #Indexing video=DGDecode_MPEG2Source("VTS_01_2.d2v") audio=AC3Source("VTS_01_2.ac3") AudioDub(video, audio) #IVTC to 23.976fps tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3)) tdecimate(mode=2, rate=23.976) #Resize Spline64Resize(848, 480) #Trimming 5000 frames randomly (from frame 2000 to frame 7000) trim(2000, 7000) parte2=last #append the trimmed parts part1++part2 #Color Matrix Conversion ColorMatrix(mode="Rec.601->Rec.709", interlaced=false, threads=0, thrdmthd=0, opt=3) #Clipping Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240) AVSPmod will also help you edit and preview Avisynth scripts, so you can actually *see* what you are trimming. Quote:
Whenever I have a little bit of spare time at work, I always go to Doom9. I took so much from this community, as Avisynth helped me so much back in 2004 and ever since 2013 I tried to give something back (that's why I love open source). ^^ Last edited by FranceBB; 23rd November 2018 at 06:51. |
|||||
30th November 2018, 02:39 | #15 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
I'm back to ask for a few more things.
1. I have DVDs encoded as: 720x480 / 16:9 720x480 / 4:3 How should I do it to keep the 16:9 to be 16:9 and 4:3 to be 16:9? I will be encoding for PC usage. So far I have tried the 16:9 video encoding using SAR 1:1 but then I got 3:2, SAR 16:9 got 2.667, SAR 40:33 got finally 16:9... but whatever I don't get it anyway. If I use this 848x480 resize filter you told me to use I have from 720x480 / 16:9 again 16:9 somehow but this thing probably blurs the video because of resizing? I just love mathematics. All I want to do is keep the video 720x480 / 16:9 so I can resize it to 1280x720p or 1080p. So probably I should tell x264 to use SAR 40:33 for 16:9 and for 4:3 SAR x ? 2. Do you know what's the difference here: Code:
motion-adaptive cubic interpolation deinterlacing motion-adaptive modified-ela deinterlacing 4. You've written few posts above about colours: is it i420 or yv12 I should use? 5. Could I ask you for PAL .avs settings if it's not top secret? Haha. Thank you! Last edited by Blovesx; 30th November 2018 at 04:44. |
30th November 2018, 18:42 | #16 | Link | |||||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
|
Quote:
If you wanna resize it to 16:9, just resize it to 848x480, if you wanna resize it to 4:3, just resize it to 640:480. Quote:
There are some upscaling kernels that are sharper than others, for instance Bilinear is kinda blurry, Bicubic is sharper than Bilinear but it's prone to introduce ringing, Lanczos is generally as sharp as Bicubic without introducing too much ringing. What I generally use to upscale it's Spline, 'cause I find it very sharp and I like the idea behind it. In order to get better results, you could also use NNEDI instead of a "simple" resizing kernel, but using NNEDI to do such a little upscale it's an overkill. You said that you don't want to upscale and it's perfectly understandable if you don't wanna "waste" bitrate, however, you also said Quote:
If you leave the content as it is (720x480) and you just flag it as 16:9, then it's up to the player to upscale it to the full resolution of your monitor. Because players have to render the result in real time, the vast majority of them use something simple like a "FastBilinear" which is very blurry or something crappy like PointResize (if you love mathematics, then you'll love the explanation behind the nearest neighbour and other resizing kernel and you'll probably understand why I prefer a Spline-based resizing kernel): http://avisynth.nl/index.php/Resampling In other words, if you wanna deliver the content on PCs, then keep in mind that the majority of people will see it with a random player that will use a "simple" resizing algorithm, so you are better off upscaling it using NNEDI and Spline64 than to let them upscale it. Anyway, if you wanna leave it as it is and just flag it to the correct aspect ratio: NTSC 4:3 DAR = 8:9 NTSC 16:9 DAR = 32:27 Quote:
PAL 16:9 DAR = 64:45 Quote:
Quote:
i420 is the same but not in Avisynth. Different terms, same meaning, I think. Quote:
Just use Tdeint with the normal settings to deinterlace (it will produce a 25fps progressive file) and upscale to 1024x576. Code:
tdeint(mode=2, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2, opt=4) Spline64Resize(1024, 576) Last edited by FranceBB; 30th November 2018 at 18:44. |
|||||||
1st December 2018, 21:43 | #17 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
FranceBB, do you mean I should use the same TFM settings and these "tdeint" settings you gave me post above for PAL DVDs without this setting?
Code:
TDecimate(mode=2, rate=23.976) Code:
Frame rate mode : Variable Frame rate : 25.474 FPS Minimum frame rate : 14.985 FPS Maximum frame rate : 119.880 FPS Original frame rate : 29.970 (30000/1001) FPS Another question for you or someone who's knowledgable with color format who can explain to me how is that and what color primaries were actually used in the attached photos? I don't really get it but when I play the one encoded by x264 (default settings) and with resizer (spline) in a VLC or any other player I can see the same colors but inside of Photoshop it's different? BT706 is just encoded as extra one. Is the one done by spline64 copying color primaries from original DVD keeping BT601 and ignoring x264 default color settings i420? x264 (default settings) http://oi66.tinypic.com/5k35ht.jpg Spline64 http://oi66.tinypic.com/dotj09.jpg BT706 http://oi63.tinypic.com/zmb67d.jpg Last edited by Blovesx; 1st December 2018 at 22:19. Reason: Fixed link (spline64) |
2nd December 2018, 07:09 | #18 | Link | ||
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,255
|
to put my two cents in,...
Quote:
(Audio sync issues aside) In case your source really in some parts requires 119.88 to appear fluid, you won't get to 23.976 without stuttering. My first approach for this would be to try some things: 1. remux the content to mkv drop the time codes in the process wo see whether the content has just broken time codes or not. If the content really is cfr and not vfr things would be easier. (you might still not get to 23.976 without stuttering, in case you need the 29.97fps for fluidity) 2. look at the actual frame to see whether there a duplicates, ghosting etc. In case you got clean pictures and motion between each frame you probably won't get to 23.976 without suttering 3. play around with sRestore and similar filters to go for 23.976 and see how they handle the file 4. if none of the above provides a usable solution I would think about whether writing a full custom script is really worth the time and effort. (depending on the nature of the clip something like Yatta/Wobbly/... or a script like AnimeIVTC might also be helpful) Quote:
So during normal DVD reeencoding where you stay the whole time in YUV 4:2:0 the only thing that is required is that the information is kept as a flag for the output (VUI) so the decoder of the player knows the right matrix when converting from YUV to RGB. If the color between players/tools differ, it usually means that either the vui matrix information got dropped somewhere or simply got ignored. Cu Selur |
||
2nd December 2018, 10:02 | #19 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,821
|
Quote:
http://avisynth.nl/index.php/I420 BT601/709 describes how the YUV colorspace is converted to RGB on playback. It has to be converted to RGB as all displays are RGB. Normally when you re-encode a video though, it's decoded as YUV, filtered as YUV and re-encoded as YUV (at least in Avisynth). There's no RGB conversion in the process. BT601 is the method used for most standard definition to convert the YUV colorspace to RGB. BT709 is generally used for HD. They're slightly different and that's why you're sometimes seeing a slight color difference. Your x264 and Spline64 screenshots have slightly different colours, by the way. As standard definition is normally BT601 (unless you're re-encoding a video someone else downscaled) you'd set the following for the x264 colour matrix option. For PAL it's --colormatrix bt470bg It's the same as BT601. For NTSC it's --colormatrix smpte170m. For HD it's --colormatrix bt709. I think the -colormatrix option is the only one that really matters, but "colormatrix", "transfer characteristics" and "color primaries" have no effect on how the video is encoded. They only offer suggestions as to how it should be converted to RGB on playback. When upscaling or downscaling, I try to stick with the same colorimetry rules (BT601 for SD and BT709 for HD). In order to do that, the colormatrix filter can be using to convert BT601 to BT709 when upscaling. ColorMatrix(mode="Rec.601->Rec.709", clamp=0) Then you'd specify --colormatrix bt709 for the x264 encoder. When downscaling, you'd do it the other way around. If you don't convert the colors when upscaling and downscaling, then you should specify the original colormatrix. Many players will read the info and display the video correctly. Some players might ignore it and just use BT601 for SD and BT709 for HD anyway, so personally I think converting the colors when upscaling/downscaling is a good idea. For encoding VFR sources... I'd try decoding while converting back to the original frame rate (I think the 119.880 FPS maximum rate is going to be some sort of anomaly in MediaInfo's interpretation of the frame rate). In theory, conversion to the original CFR while decoding will replace the duplicate frames that were dropped to make it variable, and from there you can often apply IVTC normally, as required. FFVideoSource("D:/Video/mp4", fpsnum=3000, fpsden=1001) TFM().TDecimate() # if required LSmashVideoSource has the same options. If that doesn't work and the output isn't smooth, you can extract the timecodes (or ffmpegsource has an option to write a timecodes file while while indexing) and you can give the timecodes to x264 and it'll encode in VFR mode (in which case you wouldn't convert to CFR while decoding). If x264 writes directly to MKV, the timecodes will be included in the output file and all you need to do is add the audio etc. The x264 option is this (the timecodes file name can be anything): --tcfile-in "D:\video timecodes.txt" MeGUI's OneClick encoder does that sort of thing for you these days. I think it assumes MP4 and MKV sources will be VFR by default (although I don't actually use the OneClick encoder myself). Last edited by hello_hello; 2nd December 2018 at 17:59. |
|
3rd December 2018, 05:27 | #20 | Link |
Registered User
Join Date: May 2015
Posts: 14
|
I'm back with some news (forgot to mention it was .mp4 file).
Here's what I did: 1. Since I had problems with opening the file in DGAVCIndex I demuxed the video out and I put .h264 inside of the program and run save project to take a look at the file. Code:
Stream Type: AVC Elementary Profile: High Level: 4.1 Frame Size: 720x480 SAR: 32:27 Display Size: 853x480 Frame Rate: 29.970030 fps Colorimetry: BT.601* [2] Frame Structure: Frame Frame Type: not yet Coded Number: 22969 Playback Number: 22969 Frame Repeats: 0 Field Repeats: 0 Bitrate: 0.039 Bitrate (Avg): 1.520 Bitrate (Max): 5.110 Elapsed: 0:00:46 Remain: 0:00:00 FPS: Info: Finished! Not really sure how do you read this: BT.601* [2] but inside of MediaInfo all I see is info that the file is using YUV colorspace (nothing is mentioned that the color matrix is BT.601 or anything). 2. Encoded using .h264 from DGAVC (I don't know if you can use .dga to change framerate of file): Code:
video = FFVideoSource("TRY_track1.h264", fpsnum=30000, fpsden=1001) I tried converting using MediaCoder and ffms with set framerate to 29.97 and it worked like a charm. I have no idea what settings the program used so I hope you will tell me how to set .avs script and neroaac settings. I got only info in the log: Code:
[12-03 02:59:16] Suspended for 1.3 secs to sync [AudioEncodeThread] [12-03 02:59:18] Suspended for 1.8 secs to sync [AudioEncodeThread] [12-03 02:59:19] Suspended for 1.8 secs to sync [AudioEncodeThread] Okay, here's some replies to you Selur: Code:
remux the content to mkv drop the time codes in the process wo see whether the content has just broken time codes or not Video: https://pastebin.com/A4SgJUMF Audio: https://pastebin.com/qgiPEUuS (was too long, cut half of the file). Code:
play around with sRestore and similar filters to go for 23.976 and see how they handle the file This is what I believe a video settings were before destroying the framerate (of course not same length): Code:
Stream Type: MPEG2 Program Profile: main@main Frame Size: 720x480 Display Size: 720x480 Aspect Ratio: 16:9 [3] Frame Rate: 29.970030 fps Video Type: NTSC Frame Type: Interlaced Coding Type: P Colorimetry: SMPTE 170M Frame Structure: Frame Field Order: Top Coded Number: 30342 Playback Number: 2 Frame Repeats: 0 Field Repeats: 0 VOB ID: 1 Cell ID: 7 Bitrate: Bitrate (Avg): Bitrate (Max): Audio Stream: 80: AC3 2/0 192 Timestamp: 0:16:51 Elapsed: 0:00:16 Remain: FINISH FPS: Info: Code:
If the color between players/tools differ, it usually means that either the vui matrix information got dropped somewhere or simply got ignored Some replies to hello_hello: Code:
Your x264 and Spline64 screenshots have slightly different colours, by the way Code:
ColorMatrix(mode="Rec.601->Rec.709", clamp=0) Then you'd specify --colormatrix bt709 for the x264 encoder Back to the topic FranceBB gave me this code I wasn't really looking into the plugins settings and what these means. How is it different from your simple Rec->Rec setting? Code:
#ColorMatrix(mode="Rec.601->Rec.709", interlaced=false, threads=0, thrdmthd=0, opt=3) Code:
If that doesn't work and the output isn't smooth, you can extract the timecodes (or ffmpegsource has an option to write a timecodes file while while indexing) and you can give the timecodes to x264 and it'll encode in VFR mode (in which case you wouldn't convert to CFR while decoding). If x264 writes directly to MKV, the timecodes will be included in the output file and all you need to do is add the audio etc. Phew, that's a lot of writing. Thanks for helping me out by the way guys! Last edited by Blovesx; 3rd December 2018 at 05:37. |
Thread Tools | Search this Thread |
Display Modes | |
|
|