infernix
26th June 2007, 00:02
Hi all,
I am having the hardest time trying to decimate an ABC stream capture. It's 59.94 fps, it's an animation film and it does not decimate in a proper fashion with any of the decimaters I've tried.
I've tried the following:
tdecimate(mode=0,cycleR=1,cycle=2)
AssumeFrameBased().SelectOdd().tdecimate()
and all kinds of variations that I could find in the documentation. None worked.
FDecimate()
FDecimate looked like it would do the trick, but only after I had cropped the frame and disregarded the noise in the left and mostly right border. However, it didn't suffice as it still had dupes depending on the frame differences, and sectioning the entire film for threshold values is incredibly hard to do.
So I went and tried:
MultiDecimate(pass=2)
I generated the 1stpass files and tried all the various combinations with different thresholds, but none of them yielded proper frame decimation for this stream.
On top of that, I had already written a piece of avs to crop the frame properly. If you play the sample, you'll notice that the frame judders 1px up and down at completely random intervals. The only possible way to identify this would be the bottom left line, which is broken at about the 300th pixel from the left. If you watch closely you can see that it either fills a pixel line or doesnt. So I wrote a detection routine that checks whether this single line is black or is filled with video, and decide the proper crop based on that:
# s is the final output frame which we only postprocess once
s = ColorMatrix(d2v="lionking.d2v").BlindPP(quant=4,cpu2="ooooxx"). \
deblock_qed_mt2( quant1=30,quant2=45, aOff1=4,bOff1=8,aOff2=8,bOff2=12). \
hqdn3d(1,2).fft3dfilter(sigma=1). \
vmToon(ssw=3,ssh=3,strength=44,xstren=128)
# a is the frame cropped with 1 line difference to b; in essence we just crop within the juddering
# frame and crop away the line that judders at the bottom and top.
a = converttorgb(s).crop(34,1,1212,716)
b = converttorgb(s).crop(34,0,1212,716)
# here's where the crop detection routine starts. first we crop the relevant two pixel lines. the upper
# line here is always filled with video, the bottom line only is when the frame is juddering downwards;
# otherwise it is (nearly) black.
crop(34,718,464,2)
# next we add some borders to make it larger for resizing. we now have a 464x14 image.
addborders(0,0,0,12)
# use the most simple and non-smearing/aliasing resizer to blow it up to 464x140. in this image, the
# top 10 lines are the enlarged pixel line a and the next 10 lines are b. the other 120 lines are
# black and unused.
PointResize(464,140)
# change the contrast to make the difference between the two enlarged pixel lines much clearer
Levels(0, 5.3, 255, 0, 255)
# awf is the pixel line for crop A, bwf for B. we crop the rescaled 10px lines A and B and
# convert to rgb for comparison with rgbdifference.
awf = crop(0,0,464,10).ConvertToRGB()
bwf = crop(0,10,464,10).ConvertToRGB()
# here the magic happens. if the difference between line A, which is always filled with video,
# and line B, which is filled with video when we need crop A and black if we need crop B, is
# smaller than 11.5, we use crop A, else we use crop B.
c = ConditionalFilter(a, b, "RGBDifference(awf, bwf)", "<", "11.5").converttoyv12(). \
lanczos4resize(1216,720)
I might have the order wrong here, it's been a while since I wrote this avs, but you get the general idea. Anyway, this is not that relevant to the frame decimation problem, but you'll see that I've already put in a lot of effort. A sample of this code in action can be downloaded at http://dx.infernix.net/lionking/lktest.mkv and you can find the source for this sample here as well: http://dx.infernix.net/lionking/ (lionkingproblem.ts or tlk_decimate_nightmare.ts)
Right now I'm at a point where I am changing the values in mfile.txt by hand. I'm at frame 1293 of ~290000 and I don't think I have the willpower to finish it.
I've read through a lot of threads here already, and this one might be relevant: http://forum.doom9.org/showthread.php?t=122841 but it didn't help me in solving it. So my question is, is there a kind soul out there that has more knowledge of frame decimation who could look at this, please? I'm at my wit's end here. I would really appreciate it. If a longer sample is required just let me know :)
:thanks:
I am having the hardest time trying to decimate an ABC stream capture. It's 59.94 fps, it's an animation film and it does not decimate in a proper fashion with any of the decimaters I've tried.
I've tried the following:
tdecimate(mode=0,cycleR=1,cycle=2)
AssumeFrameBased().SelectOdd().tdecimate()
and all kinds of variations that I could find in the documentation. None worked.
FDecimate()
FDecimate looked like it would do the trick, but only after I had cropped the frame and disregarded the noise in the left and mostly right border. However, it didn't suffice as it still had dupes depending on the frame differences, and sectioning the entire film for threshold values is incredibly hard to do.
So I went and tried:
MultiDecimate(pass=2)
I generated the 1stpass files and tried all the various combinations with different thresholds, but none of them yielded proper frame decimation for this stream.
On top of that, I had already written a piece of avs to crop the frame properly. If you play the sample, you'll notice that the frame judders 1px up and down at completely random intervals. The only possible way to identify this would be the bottom left line, which is broken at about the 300th pixel from the left. If you watch closely you can see that it either fills a pixel line or doesnt. So I wrote a detection routine that checks whether this single line is black or is filled with video, and decide the proper crop based on that:
# s is the final output frame which we only postprocess once
s = ColorMatrix(d2v="lionking.d2v").BlindPP(quant=4,cpu2="ooooxx"). \
deblock_qed_mt2( quant1=30,quant2=45, aOff1=4,bOff1=8,aOff2=8,bOff2=12). \
hqdn3d(1,2).fft3dfilter(sigma=1). \
vmToon(ssw=3,ssh=3,strength=44,xstren=128)
# a is the frame cropped with 1 line difference to b; in essence we just crop within the juddering
# frame and crop away the line that judders at the bottom and top.
a = converttorgb(s).crop(34,1,1212,716)
b = converttorgb(s).crop(34,0,1212,716)
# here's where the crop detection routine starts. first we crop the relevant two pixel lines. the upper
# line here is always filled with video, the bottom line only is when the frame is juddering downwards;
# otherwise it is (nearly) black.
crop(34,718,464,2)
# next we add some borders to make it larger for resizing. we now have a 464x14 image.
addborders(0,0,0,12)
# use the most simple and non-smearing/aliasing resizer to blow it up to 464x140. in this image, the
# top 10 lines are the enlarged pixel line a and the next 10 lines are b. the other 120 lines are
# black and unused.
PointResize(464,140)
# change the contrast to make the difference between the two enlarged pixel lines much clearer
Levels(0, 5.3, 255, 0, 255)
# awf is the pixel line for crop A, bwf for B. we crop the rescaled 10px lines A and B and
# convert to rgb for comparison with rgbdifference.
awf = crop(0,0,464,10).ConvertToRGB()
bwf = crop(0,10,464,10).ConvertToRGB()
# here the magic happens. if the difference between line A, which is always filled with video,
# and line B, which is filled with video when we need crop A and black if we need crop B, is
# smaller than 11.5, we use crop A, else we use crop B.
c = ConditionalFilter(a, b, "RGBDifference(awf, bwf)", "<", "11.5").converttoyv12(). \
lanczos4resize(1216,720)
I might have the order wrong here, it's been a while since I wrote this avs, but you get the general idea. Anyway, this is not that relevant to the frame decimation problem, but you'll see that I've already put in a lot of effort. A sample of this code in action can be downloaded at http://dx.infernix.net/lionking/lktest.mkv and you can find the source for this sample here as well: http://dx.infernix.net/lionking/ (lionkingproblem.ts or tlk_decimate_nightmare.ts)
Right now I'm at a point where I am changing the values in mfile.txt by hand. I'm at frame 1293 of ~290000 and I don't think I have the willpower to finish it.
I've read through a lot of threads here already, and this one might be relevant: http://forum.doom9.org/showthread.php?t=122841 but it didn't help me in solving it. So my question is, is there a kind soul out there that has more knowledge of frame decimation who could look at this, please? I'm at my wit's end here. I would really appreciate it. If a longer sample is required just let me know :)
:thanks: