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. |
19th September 2022, 05:59 | #1541 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Sorry for late answer, I did not see your post, not been about much lately.
I think requestLinear would be best placed AFTER RoboCrop(), you probably get the frame not cached thingy because RoboCrop() by default samples 40 frames, spread evenly throughout the source clip, and requestLinear might need to cache entire clip for it to work correctly. After its pre-scan, RoboCrop delivers cropped frames as per normal. EDIT: I did experience some problems with DGSource some months ago [dont know if same prob in current DGSource, updated several times since], where RoboCrop failed to find good border, and I examined RoboCrop() Debug Info output to DebugView to view 1st frame which showed no border at all. I then inserted "Return Last" immediately after DGSource [ie no RoboCrop], reloaded clip into VDub2, and jumped to that no-border frame. Was a full-frame multi-colored mess due to DGS not decoding frame properley at that frame entry point. Repeat with jump to 10 or so frames before the offending frame, then stepping forward, shows that there is no decode problem, only when decode from problem frame, ie not a source clip problem, is DGS x264 decode problem [was in MKV]. Maybe its fixed now in DGS [EDIT: DGS == DGSource, DGIndexNV source filter], I dont know. Is it similar problem that you are having, I think I just did manual crop on clips exibiting that [fairly uncommon, maybe 1 in 20 or 30 clips] prob. EDIT: You might be able to encourage frame decode failure [for experiment] by changing RoboCrop(SAMPLES=Src.FrameCount/50) [about 2%] on a clip of 200,000 frames or so. Maybe prob happens only on clips encoded by a certain encoder, or on all clips, dont know. EDIT: eg Code:
DGSource("D:\Source.dgi") FC = FrameCount PERCENT = 2.0 / 100.0 # 2.0 % SAMPLES = Round(FC*PERCENT) THRESH = -40 # -40 Default with AutoThresh Prescan, use eg THRESH=56 to set Explicit Threshold without AutoThresh prescan before border detect scan [ie faster but not as good if dodgy levels clip]. RT_DebugF("FRAMECOUNT=%d %.3f%% SAMPLES=%d THRESH=%f",FC,PERCENT,SAMPLES,THRESH) Return RoboCrop(Samples=SAMPLES,Thresh=THRESH,Debug=True) Code:
00006340 0.48317650 RT_DebugF: FRAMECOUNT=150401 0.020% SAMPLES=3008 THRESH=-40.000000 00006342 0.54735380 RoboCrop: v1.13 - 07 Feb 2020 - By StainlessS 00006343 0.54740667 Input: Width=1920 Height=1080 FrameCount=150401 00006345 0.54753429 Thresh set to user supplied -40.00 00006346 0.54755449 Thresh -40.00 recognised as DEFAULT AUTOTHRESH 00006347 0.54757363 Potential Auto Credits Skip Start@5%=7520 End @90%=135360 : Range=127841 00006348 0.54759288 Skip Start(7520) and End(135360) : Range=127841 00006350 0.54766637 Samples=3008 Thresh=-40.000 Laced=True Matrix=3 00006351 0.54774839 WMod=4 HMod=4 {Colorspace/Laced Restricted XMod=2 YMod=4} 00006352 0.54783821 RLBT=15 Ignore=0.400 Baffle=4 00006353 0.54789507 ScaleAutoThreshRGB=Yes ScaleAutoThreshYUV=No 00006354 0.54799873 CropMode=2(CropMore) Blank=No Align=Yes Show=No Log=No 00006355 0.54801899 Atm=4.000 SampStart=7520 SampEnd=135360 SampRange=127841 00006356 0.54803818 LeftAdd=0 TopAdd=0 RightAdd=0 BotAdd=0 00006357 0.54805768 LeftSkip=0 TopSkip=0 RightSkip=0 BotSkip=0 00006358 0.54807669 ScanPerc=49.000000 00006359 0.54809052 Prefix='ROBOCROP_' 00006361 0.62823510 AutoThresh 1) [ 7520] YPlaneMin = 16 (16) 00006362 0.69479620 AutoThresh 2) [ 7563] YPlaneMin = 16 (16) 00006363 0.75452262 AutoThresh 3) [ 7605] YPlaneMin = 16 (16) # ... 00009366 126.16909790 AutoThresh 3006) [135275] YPlaneMin = 16 (14) 00009367 126.23580170 AutoThresh 3007) [135317] YPlaneMin = 16 (14) 00009368 126.29372406 AutoThresh 3008) [135360] YPlaneMin = 16 (14) # ... 00009370 126.29382324 YPlaneMin=14 : Automatic set Thresh=54.000 00002917 122.82308197 Top 1) [ 7520] AveY= 92.22 Y1= 20 00009373 126.36152649 Bot 1) [ 7520] AveY= 81.78 Y2=1059 00009374 126.36154938 Lft 1) [ 7520] AveY= 90.43 X1= 1 00009375 126.36158752 Rgt 1) [ 7520] AveY= 70.37 X2=1919 00009376 130.46037292 Lft 100) [ 11729] AveY= 77.79 X1= 0 00009378 249.04609680 Active Frames (where image coords first found) = 2 00009379 249.04611206 Sampled ImageEdge: X1=0 Y1=20 X2=1919(W=1920,0) Y2=1059(H=1040,-20) 00009381 249.04624939 Crop(ModW/H): X = 0 Y = 20 W =1920(0) H =1040(-20) 00009382 249.04632568 Input: Width=1920 Height=1080 00009383 249.04640198 Crop(0,20,1920,1040) 00009384 249.04647827 Crop(0,20,0,-20) 00009385 249.04650879 Constructor Scan Total Time=248.555 secs Sample Number Frame Number Scanline_H/V Luma Y Coord Above, Top, Bot, and Right borders found on first sample frame, but Left edge not found until 100'th sample, prior to 100'th sample, best Left border was at X coord 1, at 100'th sample Left X coord found to be 0. The test clip above did NOT reveal any bad decode in current DGS.
__________________
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; 19th September 2022 at 19:42. |
22nd September 2022, 02:09 | #1542 | Link | |
Registered User
Join Date: Oct 2011
Location: Dans le nord
Posts: 65
|
Quote:
I swish d2vsource to lsmash to see if the problem repeated, and it did. So Robocrop is alright! (I think) PHP Code:
Speed was better at first with QTGMCp, but it fills the memory and it gets lower speed over time. I'll ask about this in Dogway's thread, but first I'll make some tests to be sure and better orient the discussion. |
|
29th September 2022, 19:08 | #1543 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
EDIT: Current Pinterf mod TIVTC, Both x64 & x86 versions.
Presume this is some kind of diff overflow bug in FieldDiff(), Code:
#WhateverSource(...) OPT=4 # (default) Auto #OPT=0 # Use C routines FieldDiff(debug=true,display=true,opt=OPT) return last OPT=4 (Default) Code:
00007315 3.68521953 FieldDiff: Frame = 14233 Diff = -207589436161 (sad) 00007316 3.73933315 FieldDiff: Frame = 14234 Diff = -207589439628 (sad) 00007317 3.76845598 FieldDiff: Frame = 14235 Diff = -207589438673 (sad) 00007318 3.81965804 FieldDiff: Frame = 14236 Diff = -207589375022 (sad) 00007319 3.85039353 FieldDiff: Frame = 14237 Diff = -207589400222 (sad) 00007320 3.88973689 FieldDiff: Frame = 14238 Diff = -207589383803 (sad) 00007321 3.93053317 FieldDiff: Frame = 14239 Diff = -207589353349 (sad) 00007322 3.97270870 FieldDiff: Frame = 14240 Diff = -207589428124 (sad) 00007323 4.05432177 FieldDiff: Frame = 14241 Diff = -207589397993 (sad) 00007324 4.05959177 FieldDiff: Frame = 14242 Diff = -207589429589 (sad) 00007325 4.08584976 FieldDiff: Frame = 14243 Diff = -207589433196 (sad) Code:
00000093 12.88996887 FieldDiff: Frame = 14233 Diff = -412316210604 (sad) 00000094 12.89195728 FieldDiff: Frame = 14234 Diff = -412316214071 (sad) 00000095 12.89433861 FieldDiff: Frame = 14235 Diff = -412316213116 (sad) 00000096 12.89671803 FieldDiff: Frame = 14236 Diff = -412316149465 (sad) 00000097 12.89924335 FieldDiff: Frame = 14237 Diff = -412316174664 (sad) 00000098 12.90135288 FieldDiff: Frame = 14238 Diff = -412316158245 (sad) 00000099 12.90339375 FieldDiff: Frame = 14239 Diff = -412316127792 (sad) 00000100 12.90548992 FieldDiff: Frame = 14240 Diff = -412316202567 (sad) 00000101 12.90757942 FieldDiff: Frame = 14241 Diff = -412316172435 (sad) 00000102 12.90983963 FieldDiff: Frame = 14242 Diff = -412316204032 (sad) 00000103 12.91174793 FieldDiff: Frame = 14243 Diff = -412316207639 (sad) [sse=true, = similar results (sum of squared errors, I think)]. Also different result for auto or C. EDIT: PAL DVD source. 720 * 576 * 255 = only 105,753,600. EDIT: Perhaps not limited to 0, after subtract of noise threshold. [avoid -ve addition to unsigned SAD] Something like Abs(a-b) - nt instead of Max(Abs(a-b) - nt, 0), just guessing. Code:
FieldDiff(int nt, bool chroma, bool display, bool debug, bool sse, int opt)
__________________
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; 30th September 2022 at 09:42. |
30th September 2022, 02:24 | #1544 | Link | |
Registered User
Join Date: Jan 2018
Posts: 2,153
|
Quote:
|
|
3rd October 2022, 10:55 | #1545 | Link |
Registered User
Join Date: Aug 2016
Posts: 605
|
Hello, I have some 30p streams which contain a mix of 1:1 (30fps) and 1:1:1:2 (24fps) cadences inside them. Is it possible to use TDecimate to convert these into a 60p stream containing 2:2 (30fps) and 3:2 (24fps)?
The closest I can get is 2:2 and 3:3:2:2 with this bodge: Code:
ChangeFPS(120000,1001) TDecimate(mode=1,hybrid=0,cycle=4,cycleR=2,vidThresh=1.1,display=true) The first 8 seconds are 1:1:1:2 followed by 5 seconds of 1:1. If you are using MPC-HC you can step through each frame with ctrl+arrows to count the cadence manually. |
3rd October 2022, 23:09 | #1547 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Is increasing to 119.880 FPS [NTSC weird 120fps], then decimating to NTSC 60fps. [intention to get smoother playing result without losing any source frames, I think, something like that.] His/her other thread:- https://forum.doom9.org/showthread.php?t=184448
__________________
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 ??? |
|
4th October 2022, 17:46 | #1548 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
Code:
Trim(0,274).TDecimate().ChangeFPS(60000,1001) ++ \ Trim(275,0).ChangeFPS(60000,1001) Variable frame rate easier? Code:
# Analysis pass (comment out any filters after TDecimate so they don't run) # TFM(Output=FTFM()).TDecimate(Mode=4, Hybrid=2, Output=FTDec()) # Encoding pass (uncomment any filters after TDecimate) TFM(Input=FTFM()).TDecimate(Mode=5, Hybrid=2, Input=FTDec(), TFMIn=FTFM(), mkvOut=FTC()) x264.exe --level 4.1 --preset slow --tune film --crf 18.0 --tcfile-in "D:\VFR_TIMES.txt" --output "D:\VFR.mkv" "D:\VFR.avs" VFR.mkv Functions for automatic file name creation based on the script name. Creates files in the script folder. If no script exists (ie before saving a script when using AVSPMod) they're configured to save to the root of drive D, but without using the script name (obviously). Code:
# =============================================================================== function FTFM() { Try{ ScriptName = ScriptFile() EndLength = FindStr(LCase(ScriptName), ".avs") - 1 FileName = ((EndLength > 0) ? LeftStr(ScriptName, EndLength) : ScriptName) + "_TFM.txt" } catch(err){ FileName = "D:\_TFM.txt" } return FileName } # ------------------------------------------------------------------------------- function FTDec() { Try{ ScriptName = ScriptFile() EndLength = FindStr(LCase(ScriptName), ".avs") - 1 FileName = ((EndLength > 0) ? LeftStr(ScriptName, EndLength) : ScriptName) + "_TDecimate.txt" } catch(err){ FileName = "D:\_TDecimate.txt" } return FileName } # ------------------------------------------------------------------------------- function FTC() { Try{ ScriptName = ScriptFile() EndLength = FindStr(LCase(ScriptName), ".avs") - 1 FileName = ((EndLength > 0) ? LeftStr(ScriptName, EndLength) : ScriptName) + "_TIMES.txt" } catch(err){ FileName = "D:\_TIMES.txt" } return FileName } # =============================================================================== Last edited by hello_hello; 4th October 2022 at 17:57. |
|
5th October 2022, 03:06 | #1550 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
At one stage TDecimate required a TFM metrics file for mode=5, but the help file now says:
As of version 0.9.11.8 of TDecimate, an input and tfmIn file are no longer required for mode 5. If an input file is not specified then a value of ULLONG_MAX-1 (the maximum value tdecimate has) is assigned to all metrics. Likewise, if a tfmIn file is not specified then all matches are assigned as 'c', not combed, and not a d2v duplicate. I'm not sure I fully understand that though. Including TFM shouldn't do any harm. |
5th October 2022, 10:54 | #1551 | Link | |
Registered User
Join Date: Aug 2016
Posts: 605
|
Quote:
Code:
TDecimate(mode=3, hybrid=2, viddetect=2, cycle=5, cycleR=1, mkvOut="TIMES.txt") Anyway I did manage to get ffmpeg crunching with this: Code:
ffmpeg -i "VFRpass1.avs" -threads 4 -f null NUL && ffmpeg -i "VFRpass2.avs" -threads 4 -f null NUL VFRpass1.avs: LWLibavVideoSource(source="1112-11.mkv", cache=false) TDecimate(mode=4, hybrid=2, viddetect=2, cycle=5, cycleR=1, output="FTDEC.txt") VFRpass2.avs: LWLibavVideoSource(source="1112-11.mkv", cache=false) TDecimate(mode=5, hybrid=2, viddetect=2, cycle=5, cycleR=1, input="FTDEC.txt", mkvOut="TIMES.txt") ffmpeg says it supports vfr encoding with "-vsync vfr" but I couldn't get it to work. ffmpeg doesn't seem to support matroska timecode files either but hoping someone can correct me on that. Last edited by flossy_cake; 5th October 2022 at 11:06. |
|
5th October 2022, 12:21 | #1552 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
I'm hopeless with ffmpeg so hopefully someone else can help you there. Although.... The first line of the timecodes file should be # timecode format v1 This is just a guess, but try changing it to # timestamp format v1 to see if ffmpeg will play with it then. Last edited by hello_hello; 5th October 2022 at 12:41. |
|
5th October 2022, 13:25 | #1553 | Link |
Registered User
Join Date: Aug 2016
Posts: 605
|
Nevermind I was mistaken about that. The default is 3 which requires both TFM matches and TDecimate metrics to recognise it as "video". Since I never used TFM it would always fail this condition and that's why the stairs section wouldn't switch to blend. And in your example it didn't fail since you were feeding it TFM matches via the txt file.
Problem is I can't even find any ffmpeg argument relating to mkv timestampcode files. The ffmpeg GUI XMediaRecode also has no such option and no control over framerate mode. Seems like ffmpeg doesn't support it at all but hoping I'm mistaken. |
6th October 2022, 00:57 | #1554 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
If you're not married to XMediaRecode but want to use a GUI, try MeGUI. You can just add the timecodes file in the x264 encoder configuration. https://i.ibb.co/QvhkcMG/1.png
I still don't know if x265 has a VFR mode and MeGUI's x265 encoder configuration is pretty basic anyway. I'm not sure I understand the "linear access" problem you mentioned earlier, but the TIVTC plugin has a RequestLinear() function if that's any help. |
6th October 2022, 03:52 | #1555 | Link | |
Registered User
Join Date: Aug 2016
Posts: 605
|
Quote:
If you wouldn't mind, could you split it up into: VFR pass1.avs VFR pass2.avs Inputfile for x264.avs edit: also this is my VFR_TIMES.txt, it seems correct though as I've stepped through the video and identified frame 219 is the last of the 24p section Code:
# timecode format v1 Assume 29.970030 # TDecimate v1.0.8 by tritical # Mode 5 - Auto-generated mkv timecodes file 0,219,23.976024 # vfr stats: 51.02% film 48.98% video # vfr stats: 275 - film 264 - video 539 - total # vfr stats: longest vid section - 0 frames # vfr stats: # of detected vid sections - 0 Last edited by flossy_cake; 6th October 2022 at 04:05. |
|
6th October 2022, 04:17 | #1556 | Link | |
Registered User
Join Date: Aug 2016
Posts: 605
|
Quote:
Code:
CreateTimestampFile.avs: file = "clips\1112-11.mkv" LWLibavVideoSource(source=file, cache=false) TDecimate(mode=3, hybrid=2, viddetect=2, cycle=5, cycleR=1, mkvOut="TIMES.txt") RequestLinear() To run it from ffmpeg: ffmpeg -i "CreateTimestampFile.avs" -threads 4 -f null NUL btw I tried mkvtoolnix and handbrake without success but I'm probably doing something wrong, just can't figure out what. I'm still not clear on what the input file is when encoding the new VFR file -- is it the original 1112-11.mkv or the TDecimated version of it? Last edited by flossy_cake; 6th October 2022 at 04:23. |
|
6th October 2022, 04:18 | #1557 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
When I'm doing a bunch of VFR encodes I often add the same scripts to MeGUI twice, once as an analysis pass and then again as an encoding job, modifying MeGUI's encoder configuration to adjust the name of the timecodes file each time if need be. The encoding pass would be commented out at that stage. Once all the analysis passes have finished I open the scripts and comment out the analysis pass and uncomment the encoding pass, then let MeGUI run the encoding jobs. As soon as MeGUI opens each script for encoding it's timecodes file is created and as long as the name of the timecodes file added to the x264 command line matches, the encodes run normally. If you're running the encodes via the command line yourself or using a batch file etc, you should still be able to do much the same thing. Each script can use the same name for the timecodes file, if you prefer, because as soon as you open the 2nd pass script the existing timecodes file will be over-written, but I tend to give them unique names when encoding a bunch of scripts. PS. The first pass files are similar. As soon as you open the 1st pass script any existing metrics files with the same names will be over-written with blank ones and you'll have to run the analysis pass again, so once it's run, be careful about opening the 1st pass script again. Last edited by hello_hello; 6th October 2022 at 05:07. |
|
6th October 2022, 04:29 | #1558 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
If you're encoding at a CFR (and probably when x264 is writing to a raw AVC stream) you'd add the timecodes to MKVToolNix under the Timecodes tab, assuming it hasn't changed (I'm using a pretty old version as I mostly use XP). Make sure the video track is the one selected when you add it. https://i.ibb.co/WKC3fh2/Clipboard01.jpg I don't think Handbrake will use a timecodes file for encoding. Does it accept Avisynth scripts as the input video anyway? The original for encoding and the decimated/re-encoded version for muxing. Last edited by hello_hello; 6th October 2022 at 05:17. |
|
6th October 2022, 04:37 | #1559 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
Edit: Here's the timecodes file I extracted from VFR.mkv. It's extracted as version 2 timecodes, but line #222 seems to be where it changes from 42ms between timestamps to 33ms. Subtract two from that because the first line isn't a timecode and the first frame is zero rather than one, and the video section starts on frame #220 (I think that's right). VFR_track1__eng_.tc.txt Last edited by hello_hello; 6th October 2022 at 05:41. |
|
6th October 2022, 05:25 | #1560 | Link | |
Registered User
Join Date: Aug 2016
Posts: 605
|
Quote:
But in your case mode5 seems to be taking the TFM metrics and immediately generating the TIMES.txt file from it. I got your code working on my end and the result is good. I tested the VFR file on my set top box @ 60hz and to my surprise it does actually manage it correctly, although there is a slight pause on the rate change. I'm seeing some comments that VFR may not be a good idea as many devices don't handle it correctly. Given those comments I'm leaning towards the 60p CFR solution again but there doesn't seem to be a way to automate it. Last edited by flossy_cake; 6th October 2022 at 06:29. |
|
Tags |
tdeint, tivtc |
Thread Tools | Search this Thread |
Display Modes | |
|
|