I've captured a few streams from my Slingbox, one of them has some sort of interlacing I can't figure out.
MediaInfo says it uses MBAFF interlacing:
I tried two AviSynth scripts, but they both don't get me what I want. Script 1 results in smooth edges but blended frames during motion. Script 2 has no blended frames but also no smooth edges. The motion is not perfect either. I would get the same result as Script 2 if I use QTGMC +SelectEven instead of TFM. Using another resizer (e.g. Spline64Resize) doesn't help.Code:Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : Yes Format settings, ReFrames : 2 frames Codec ID : V_MPEG4/ISO/AVC Duration : 21mn 20s Bit rate : 3 912 Kbps Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:10 Original display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : MBAFF Bits/(Pixel*Frame) : 0.075 Stream size : 597 MiB (89%) Default : Yes Forced : No
Script 1:
Script 2:Code:LoadCplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\masktools2-25.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dgmpgdec158\DGDecode.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\decomb\Decomb.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\BlendBob.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\LeakKernelDeint.dll") Import("C:\Program Files (x86)\AviSynth 2.5\plugins\QTGMC-3.32.avsi") DirectShowSource("C:\recording\stream.mkv") ConvertToYV12() QTGMC( Preset="Slower" ) BlendBob(show=false,badFrames=0) Crop(84,0,-82,-2) LanczosResize(1052,720)
The results in VLC:Code:LoadCplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\masktools2-25.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dgmpgdec158\DGDecode.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\decomb\Decomb.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\BlendBob.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\LeakKernelDeint.dll") Import("C:\Program Files (x86)\AviSynth 2.5\plugins\QTGMC-3.32.avsi") DirectShowSource("C:\recording\stream.mkv") ConvertToYV12() TFM() Crop(84,0,-82,-2) LanczosResize(1052,720)
Source:
Script 1:
Script 2:
Source:
Script 1:
Script 2:
Anyone with any help or tips on how to handle this?
Bonus question: Can I add something to my x264.exe line to later cut on frames instead of keyframes?
Code:x264.exe --profile high --preset slower --crf 18 --output output.mkv script.avs
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 43
Thread
-
-
You should post an unprocessed sample of the source
You should cut and do the edits in the avs script instead of after encoding
You can add --keyint 1 for intra encoding - which will allow splitting afterwards with frame accuracy - but compression will be severely impaired. (You will need much larger filesize for similar quality) -
Since the output of DirectShowSource() is interlaced you need to convert to YV12 in interlaced mode: ConvertToYV12(interalced=true). But why isn't the output of DirectShowSource() YV12? There may be a problem there.
TFM() sometimes make mistakes, try using TFM(mode=0, pp=0). See if that helps. Also, be sure the field order is correct before TFM() with AssumeTFF() or AssumeBFF().
For more definitive help you'll need to upload a sample of your source. -
Script 1 results in smooth edges but blended frames during motion.
Since you 're cropping left 84, right 82, You can speed up the script by doing a horizontal crop (by mod4) before QTGMC. Add the finishing vertical and horizontal crop after . This is assuming QTGMC or any bobber is even needed in the first place. "PAL area" broadcasts with progressive content are often encoded MBAFF , PAFF or "interlaced." It 's unclear how you took the screenshots - for example VLC can be set to "blend". So the blend in the "source" in the 2nd set of screenshots might or might not actually be there. It's entirely possible you might have to deblend the source with another approach like srestore(). This is why an actual video sample is preferredLast edited by poisondeathray; 13th Feb 2015 at 13:46.
-
And if this is a film source you want to decimate back to 23.976 fps. Call TDecimate() after TFM().
-
You HAVE to cut on key-frames or else re-encode, there's no way around that.
However, you can use the qpfile option to deliberately place keyframes where ever you think you may like to cut it.
I have my files in mkvs so I add a series of chapters at all the points where I need key frames to be, then before encoding my batch files will find the source file, extract the chapters using MKVExtract then convert the chapter time codes to frame numbers and build a QPFile from them to feed to x264. -
I've attached a 10 second clip cut from the source (first batch of screenshots). I took the screenshots with VLC without any deinterlacer on
I don't mind cutting it in the AVS script, I need to get rid of the first ~5 seconds and the last ~4 seconds
Really appreciate the quick reactions. -
Oooooo. This is a problem, if I run the thing through TFM with deinterlacing turned off it still kind of looks interlaced, despite the fact that the frames match, so it obviously shouldn't look interlaced.
That's why the lines look so bad, they're there in the source, but the deinterlacing is deleting them.
-Edit- it was upscaled from SD in interlaced mode, so each interlaced line is actually half a line from the original SD source.Last edited by ndjamena; 13th Feb 2015 at 14:52.
-
This doesn't completely fix it but you get the idea:
Code:FFVideoSource("D:\Ins\source\Video 1.h264") SeparateFields() NNEDI3_Resize16(720, 240) Weave() TFM() NNEDI3_Resize16(1280, 720)
-
-
That would be NNEDI3_Resize16, you can use any resizer you like. (I just never use anything else.)
-
It looks like my script 2, but with a lower resolution and the edges are a bit smoother.
What should I change to crop it and change it into 16:10? Using this?
Code:FFVideoSource("D:\Ins\source\Video 1.h264") Crop(84,0,-82,-2) SeparateFields() Spline64Resize(1078, 360) Weave() TFM() Spline64Resize(1576, 886)
-
It IS your script 2 with lower resolution and better edges. It was originally upscaled to 1080i from 480i (or from 576i, or possibly 480i to 576i to 1080i) in interlaced mode, if you can picture what that would entail you'll realise why the lines are so screwed. The easiest way to rectify that is to resize it back down to SD and THEN deinterlace it and THEN resize it up again. But upscaling and then downscaling, then upsizing again IS going to lose resolution, especially since two of those resizes were done while interlaced AND the deinterlacing process itself effectively halves the resolution. There might be better ways of going about it that may result in a better picture, but it's still proof of concept and gives you an idea of what the problem is and what needs to be done to fix it.
-
Hmm, maybe dup in blend mode would work better than BlendBob. Assuming it was ever implemented.
Or maybe one of the decimator functions has a blend mode... -
What a screwed up video. So far the best thing I've found for most of the clip is:
Code:BilinearResize(720, 480) Sharpen(0.3) nnedi3_rpow2(4, cshift="Spline36Resize", fwidth=1920, fheight=1080)
I also tried something similar to what you guys did but including a downward shift of one of the fields:
Code:Bob() e=SelectEven() o=SelectOdd().Crop(0,0,-0,-2).AddBorders(0,2,0,0) Interleave(e,o) BicubicResize(720,240) AssumeFieldBased() Weave() TFM() # then upscale
One thing I might note is that the opening credits are often different than the body of the video. So the body might be simpler. Or different. -
EDIT: nevermind. Grr. bad source
I was going to suggest a simple
Code:AssumeTFF() Crop(80,0,-78,0,true) tfm(pp=0) spline36resize(768,480)
-
It's not natively 25FPS I'm not entirely sure what the frame rate is, 24/1.001 didn't work. 30? 24? It could be anything... does anyone want to waste their time figuring it out?
-
I think this is what you needed:
http://pan.baidu.com/s/1Bt2fY#path=%252FAviSynth%2520Plugins
You downscaled it to 720i then upscaled it to 1080p???
And that's 16:9. There wasn't much point in downscaling horizontally anyway, it's just that the original source would have been 720 wide so that's what I did. -
I'm not sure if I understand you or if I asked wrong, but this is what I would like to do besides the deinterlacing/smoother/etc:
Crop the black bars (L: 84, R: 82, B: 2)
Unstretch the image (1754 to 1576, but I can also add flags for that. I've compared it to DVD rips of Season 3 (4-6 are not on DVD) and it should look 1578x1080/1052x720/748x512.
In the Season 3 DVD and in other sources, they're blended as well when deinterlaced, so I think that's normal (the Producers/Art Director/etc text)
I'm going to test a few things mentioned here, see if any of them produce a good result, thanks again! -
Here's my latest attempt:
Code:AssumeTFF() Crop(80,0,-80,-0) # 1760x1080 SeparateFields() PointResize(720,258) # cleanest height I could get Weave() QTGMC() # titles are animated 50 fields per second, cleans up some of the edges Spline36Resize(720,288) # more edge cleanup nnedi3_rpow2(2, cshift="Spline64Resize", fwidth=720, fheight=496) # used compass in frame 219 for AR
-
Normal? Generally "blending" is caused by frame rate conversions or bad processing. It's generally the goal on these forums to UNDO blending whenever possible. I've been trying to figure out what the country of origin is so we can have some idea of what the target frame rate should be, but it's a French/Canadian production so it could be anything. There's actually no blending at all in the sample you provided, and generally the frames exist in pairs for large stretches, but every now and then you'll get frames in three's and some of these three are too close together to make any actual sense from an original frame rate perspective.
Fields 338, 339 and 340 then 347, 348 and 349 are an example, that may be caused by a scene cut. There's even a section where each field is unique (the moving text). Still it's unpredictable and that makes it difficult to work with, add to that the fact that the state of source is so bad decimate functions don't work properly and fixing it properly (to our standards) would require some extensive scripting.
272, 273, 274 -- 281, 282, 283... and yet there are no single frames to go with them, unless 274 and 283 cancel each other out, but why would that be? -
You could probably mix & match and put in some manual work to fix the intro. If it's the same intro for each season, it wouldn't be a lot of work. But what does the actual episode look like ?
-
Code:
FFVideoSource("D:\Ins\source\Video 1.h264") qtgmc() DUP(copy=true, blend=true, threshold=15) Crop(84,0,-82,-2) NNEDI3_Resize16(1052,720)
And 1052 is 3:2, which is the NTSC aspect ratio before anamorphic is applied... 16:10? You do know about non-square (anamorphic) pixels don't you? -
Thanks! I'll try it for the entire episode, see if it looks as good as the 10sec clip.
Sorry, I meant 16:10 flags before the cropping (1920x1080 with 16:10 flags for a unstretched image), but I'll try that script
I've attached a few samples I could find. I didn't encode them, except for the 25 DVD x264 (spedup version of 23.976 DVD x264. -
I've attached a clip from the output (outputclip.mkv) and the source of that output (slingbox2.mkv). It seems like there is some ghosting in the credits (I can live with that). But this also happend:
Is this also ghosting, bad chroma, or has it to do with the missing noise reductions/level/colors adjustments?
I've also attached slingbox3.mkv, a clip with interlacing not taken from the intro. After encoding (new3.mkv) it has some ghosting(?) and during movement, the edges of the hair are not very smooth.
-
I downloaded slingbox2.mkv and slingbox3.mkv and applied my script. I saw no artifacts like that at all, including all five of the frames you pictured. It looks like source decoding errors to me. What source filter are you using? I'm using ffVideoSource, from the ffmpeg source plugin:
Code:ffVideoSource("slingbox2.mkv") AssumeTFF() Crop(80,0,-80,-0) # 1760x1080 SeparateFields() PointResize(720,258) # cleanest height I could get Weave() QTGMC() # titles are animated 50 fields per second, cleans up some of the edges Spline36Resize(720,288) # more edge cleanup nnedi3_rpow2(2, cshift="Spline64Resize", fwidth=720, fheight=496) # used compass in frame 219 for AR
-
That worked, I used DirectShowSource before. The edges look perfect, but sometimes the eye color looks watered down (or whatever the proper term is).
Should I use Tweak() to change the brightness? At least if that's what's wrong with the color comparing to another source (the 25 HDTV x264.mkv):
For cutting the first few and last seconds in the script: How do I get the right framenumbers?
And are these lines right? *frame* is to be replaced with the framenumber
Code:Trim(0,*frame*,false) # cuts first ~5 seconds Trim(*frame*,*last frame*,false) # cuts final ~4 seconds
-
Since you are converting from HD to SD (or are you going to scale back up to HD?) you should convert the colors from rec.709 to rec.601. The best way to do that is with:
Code:ColorMatrix(mode="Rec.709->Rec.601")
Code:Trim(first_frame_to_keep, last_frame_to_keep)
Code:Trim(4*framerate, framecount-(4*framerate))
Code:ColorMatrix(mode="rec.709->rec.601") # HD to SD color ColorYUV(gain_y=50, off_y=-10) # more contrast, a little darker MergeChroma(last, aWarpSharp(depth=20)) # sharpen colors ChromaShift(l=-2) # shift colors up two scan lines Trim(int(4*framerate), int(framecount-1-(4*framerate))) # remove first and last 4 seconds
That does leave some illegal colors in a few shots, especially in dark areas. Some more tweaking should help.Last edited by jagabo; 15th Feb 2015 at 18:07.
-
Code:
LoadCplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\masktools2-25.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dgmpgdec158\DGDecode.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\decomb\Decomb.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\Dup.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\LeakKernelDeint.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\ffms2.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\ColorMatrix.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\AWarpSharp.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\ChromaShift.dll") Import("C:\Program Files (x86)\AviSynth 2.5\plugins\QTGMC-3.32.avsi") ffVideoSource("slingbox.mkv") AssumeTFF() Crop(80,0,-80,-0) # 1760x1080 SeparateFields() PointResize(720,258) # cleanest height I could get Weave() QTGMC() # titles are animated 50 fields per second, cleans up some of the edges SelectEven() # back to 25fps Spline36Resize(720,288) # more edge cleanup nnedi3_rpow2(2, cshift="Spline64Resize", fwidth=720, fheight=496) # used compass in frame 219 for AR ColorMatrix(mode="rec.709->rec.601") # HD to SD color ColorYUV(gain_y=50, off_y=-10) # more contrast, a little darker MergeChroma(last, aWarpSharp(depth=20)) # sharpen colors ChromaShift(l=-2) # shift colors up two scan lines Trim(2970, 34623)
-
That's probably FFVideoSource, try adding AssumeFPS(25) and see if the end result syncs up.