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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th November 2016, 02:04   #941  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
See previous edit feisty.

EDIT: I'de say definite bug, not just the chroma that is screwed up, and temporal chaos.
__________________
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; 6th November 2016 at 02:08.
StainlessS is offline   Reply With Quote
Old 6th November 2016, 02:30   #942  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by StainlessS View Post
See previous edit feisty.

EDIT: I'de say definite bug, not just the chroma that is screwed up, and temporal chaos.
well, I ain't used avisynth for a while but blockfps in vaporsynth mvtools works
give it a go
Code:
import vapoursynth as vs
core = vs.get_core()

clp = blah blah blah
super = core.mv.Super(clp,pel=4,hpad=16,vpad=16,rfilter=4)
bw_1  = core.mv.Analyse(super,isb=True,blksize = 16,overlap=8,search=3,badrange =-24)
fw_1  = core.mv.Analyse(super,isb=False,blksize = 16,overlap=8,search=3,badrange =-24)
clp = core.mv.BlockFPS(clp, super, bw_1, fw_1, num=0, den=0, mode=0, blend=False)

clp.set_output()
feisty2 is offline   Reply With Quote
Old 6th November 2016, 02:47   #943  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I'de love to 'give it a go', unfortunately I is on XP32, and nobody cares bout us lil ol' XP users

With 4 window stack display, Garbage function, Good function, Subract(Garbage,Good), Subract(Garbage,Good),
If I play (in VDUB) say some part of early clip, and then jump to near the end of clip,
and play, then will sporadically show frames from the early part of clip that was recently played. Sometimes it shows
what looks to be frames from a diagnostic Subtract that is showing in one of the windows.
Looks like its totally Mucked up (substitute an alternate first letter of your choice).

EDIT MvTools2 that I'm using is v2.5.11.20.

EDIT: The problem seems to occur if OverLap used in creating final BackWards and Forwards vectors supplied to MBlockFps,
ie MAnalyse(Overlap=whatever) if MRecalculate not used, and in final MRecalculate(Overlap=whatever) if used.

This works ok without Overlap in final vectors
Code:
Function foo2(clip source, int "multi") {
    last       = source
    multi      = default(multi, 2)
    prefilt    = DeGrainMedian()                                        # some smoothing
    superfilt  = MSuper(prefilt, hpad=16, vpad=16)                         # all levels for MAnalyse
    super      = MSuper(source, pel = 2, hpad = 16, vpad = 16, rfilter = 4) # one level is enough for MRecalculate
    bw_1       = MAnalyse(superfilt, chroma = false, isb = true, blksize = 16,  OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    fw_1       = MAnalyse(superfilt, chroma = false, isb = false, blksize = 16, OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    bw_2       = MRecalculate(super, chroma = false, bw_1, blksize = 8, OverLap=4, searchparam = 1, search = 3)
    fw_2       = MRecalculate(super, chroma = false, fw_1, blksize = 8, OverLap=4,searchparam = 1, search = 3)
    bw_3       = MRecalculate(super, chroma = false, bw_2, blksize = 4, searchparam = 0, search = 3)    # No Overlap
    fw_3       = MRecalculate(super, chroma = false, fw_2, blksize = 4, searchparam = 0, search = 3)    # No Overlap
    MBlockFps(source, super, bw_3, fw_3, FramerateNumerator(Source) * multi, FramerateDenominator(Source), mode = 0, Blend=False)
    return last
}
But think I'll be using this until fixed at least.
Code:
Function DoubleRate(clip c,Bool "Blend") {
    c
    Blend=Default(Blend,False)                                      # Avoid blends at scene change (copy previous frame)
    prefilt   = DeGrainMedian()                                     # some smoothing
    superfilt = MSuper(prefilt, hpad=16, vpad=16, rfilter = 4)      # all levels for MAnalyse
    super     = MSuper(pel=2, hpad=16, vpad=16,rfilter=4,levels=1)  # one level is enough for MRecalculate
    bw_1      = MAnalyse(superfilt, chroma = false, isb = true,  blksize = 16, OverLap=2, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    fw_1      = MAnalyse(superfilt, chroma = false, isb = false, blksize = 16, OverLap=2, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    bw_2      = MRecalculate(super, chroma = false, bw_1, blksize = 8, searchparam = 1, search = 3)    # No Overlap (currently broken for final vectors)
    fw_2      = MRecalculate(super, chroma = false, fw_1, blksize = 8, searchparam = 1, search = 3)    # No Overlap
    MBlockFps(super, bw_2, fw_2, num=FramerateNumerator(c) * 2, den=FramerateDenominator(c), mode=0, Blend=Blend)
    Return Last
}
__________________
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; 6th November 2016 at 16:56.
StainlessS is offline   Reply With Quote
Old 6th November 2016, 02:50   #944  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
and BlockFPS is definitely more or less better than FlowFPS in general
FlowFPS
Code:
import vapoursynth as vs
core = vs.get_core()

clp = xxx
clp = core.fmtc.bitdepth(clp,bits=32,fulls=False,fulld=True)
super = core.mvsf.Super(clp,pel=4,hpad=16,vpad=16,rfilter=4)
bw_1  = core.mvsf.Analyze(super,isb=True,blksize = 16,overlap=8,search=3,badrange =-24)
fw_1  = core.mvsf.Analyze(super,isb=False,blksize = 16,overlap=8,search=3,badrange =-24)
clp = core.mvsf.FlowFPS(clp, super, bw_1, fw_1, num=0, den=0, blend=False)

clp.set_output()


BlockFPS
Code:
import vapoursynth as vs
core = vs.get_core()

clp = xxx
clp = core.fmtc.bitdepth(clp,bits=32,fulls=False,fulld=True)
super = core.mvsf.Super(clp,pel=4,hpad=16,vpad=16,rfilter=4)
bw_1  = core.mvsf.Analyze(super,isb=True,blksize = 16,overlap=8,search=3,badrange =-24)
fw_1  = core.mvsf.Analyze(super,isb=False,blksize = 16,overlap=8,search=3,badrange =-24)
clp = core.mvsf.BlockFPS(clp, super, bw_1, fw_1, num=0, den=0, blend=False)

clp.set_output()

feisty2 is offline   Reply With Quote
Old 6th November 2016, 03:07   #945  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Perhaps all posts relating to MvTools2 should be separated into a new thread, Its really about time MvTools2 had a thread in the Avisynth Usage forum,
and Interframe dont need lots of posts about it's competitor.
I suggest from post #915 (to put Groucho2004 in command) and maybe insert the two posts 913 and 914 after the first post, if possible.

All those in favour, say "Aye!".
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 6th November 2016, 15:10   #946  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by StainlessS View Post
The two above Garbage functions still fail with Overlap=8, Green, Pink and Gray frames (sometimes), and jumping backwards and forwards in time.

EDIT: The two Garbage functions above, both work ok if changed to MFlowFps() and removing mode=0 (not an arg to MFlowFps).

Looks like something may be broken in latest (I think) mvtools MBlockFps.
I'm still using mvtools2 v2.5.11.3 since the newer versions crash/throw exceptions when multi-threaded. In this older version, MBlockFps actually throws an error when using "overlap" > 0 in MAnalyse(). So, MFlowFps may be a better choice in this case.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 6th November 2016, 19:05   #947  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Quote:
Originally Posted by feisty2 View Post
and BlockFPS is definitely more or less better than FlowFPS in general
Is -24 for badrange is "better". Default is 24.
kolak is offline   Reply With Quote
Old 6th November 2016, 19:11   #948  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by kolak View Post
Is -24 for badrange is "better". Default is 24.
From MVTools2 doc:
Quote:
badrange: the range (radius) of wide search for bad blocks. Default is 24 (image pixel units). Use positive value for UMH search and negative for Exhaustive search.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 6th November 2016, 19:49   #949  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Yes, rtfm (properly)
kolak is offline   Reply With Quote
Old 8th November 2016, 09:55   #950  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by StainlessS View Post
These two are garbage, I must have screwed up somewhere (weird flashing, EDIT: Green and Pink frames).

Code:
Function DoubleRate3(clip c) {
    c
    prefilt   = DeGrainMedian() # some smoothing
    superfilt = MSuper(prefilt, hpad=16, vpad=16, rfilter = 4)             # all levels for MAnalyse
    super     = MSuper(pel=2, hpad=16, vpad=16,rfilter=4)
    bw_1      = MAnalyse(superfilt, chroma = false, isb = true,  blksize = 16, OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    fw_1      = MAnalyse(superfilt, chroma = false, isb = false, blksize = 16, OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    MBlockFps(super, bw_1, fw_1, num=0, den=0, mode=0, Blend=false)
    Return Last
}

Function DoubleRate4(clip c) {
    c
    super     = MSuper(pel=2, hpad=16, vpad=16,rfilter=4)
    bw_1      = MAnalyse(super, chroma = false, isb = true,  blksize = 16, OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    fw_1      = MAnalyse(super, chroma = false, isb = false, blksize = 16, OverLap=8, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    MBlockFps(super, bw_1, fw_1, num=0, den=0, mode=0, Blend=false)
    Return Last
}
Indeed. There is a missing copy of the 16 bit internal buffers back to 8 bit result when overlap is used. I will fix it in my pfmod branch in the next release.
pinterf is offline   Reply With Quote
Old 8th November 2016, 16:17   #951  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I will fix it in my pfmod branch in the next release.
Oooh, lovely

I'm doing a little bit of work on DoubleRate deinterlace/Interpolation and need the overlap thing. It caught me a bit by surprise that when dealing with
hybrid source (with possibility of single interlaced frame in progressive sequence), that single non-combed status of progressive frame is not enough
to deal with it properly, a third combed status is required. 0)=Interlaced, 1)=Progressive current+progressive next, 2)=Progressive current & Interlaced Next.
If not taken into account, then Interpolated frames will use Progressive current + Interlaced next as sources. Perhaps this was obvious to you lot, but
was not to me. To fix it, I'm using Progressive current + deinterlaced first field of next for interpolation. I guess that QTGMC already copes with this.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 9th March 2020, 21:47   #952  |  Link
DanilaZabiaka
Registered User
 
Join Date: Mar 2020
Posts: 49
My version based on new libraries

https://forum.doom9.org/showthread.p...12#post1903412
DanilaZabiaka is offline   Reply With Quote
Old 17th February 2021, 07:17   #953  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly San Jose, California)
Posts: 277
Unexpected results

Hi Y'all,

I've successfully transcoded 24/1.001fps samples to 60/1.001fps (and also to 120/1.001fps) via the Windows cmd scripts below.
But when I use the same script to transcode SubJunk's 24/1.001fps sample (http://www.spirton.com/uploads/Inter...e-Original.mkv), the transcode comes out unexpectedly and I wonder why.

This transcodes to 60/1.001fps as expected:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=60000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=60000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-60fps.mkv
This transcodes to 60fps instead of to 60/1.001fps:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -filter_complex "tinterlace=mode=drop_odd" -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps-to-60fps.mkv
Of course, the problem could be with 'tinterlace=mode=drop_odd', so I tried it without 'tinterlace':
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps.mkv
but it transcodes to 120fps instead of to 120/1.001fps. Anyone know why? I just can't see it.
markfilipak is offline   Reply With Quote
Old 17th February 2021, 08:30   #954  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,340
Quote:
Originally Posted by markfilipak View Post
Hi Y'all,

I've successfully transcoded 24/1.001fps samples to 60/1.001fps (and also to 120/1.001fps) via the Windows cmd scripts below.
But when I use the same script to transcode SubJunk's 24/1.001fps sample (http://www.spirton.com/uploads/Inter...e-Original.mkv), the transcode comes out unexpectedly and I wonder why.

This transcodes to 60/1.001fps as expected:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=60000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=60000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-60fps.mkv
This transcodes to 60fps instead of to 60/1.001fps:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -filter_complex "tinterlace=mode=drop_odd" -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps-to-60fps.mkv
Of course, the problem could be with 'tinterlace=mode=drop_odd', so I tried it without 'tinterlace':
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps.mkv
but it transcodes to 120fps instead of to 120/1.001fps. Anyone know why? I just can't see it.



It has nothing to do with interframe

When debugging scripts, strip everything down , eliminate variables, and check each step, each output node. Same with ffmpeg. Start with something simple like blankclip(). Label the framenumbers.

vapoursynth and the input pipe into ffmpeg are fine; it's the output in ffmpeg that is the problem - even with NUL - the output is rounded. There might be some switch or command to prevent this, not sure

vspipe --y4m 1.vpy - | ffmpeg -f yuv4mpegpipe -i - -an -f null NUL
Input #0, yuv4mpegpipe, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 640x48
0, 119.88 fps, 120 tbr, 119.88 tbn, 119.88 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Output #0, null, to 'NUL':
Metadata:
encoder : Lavf58.67.100
Stream #0:0: Video: wrapped_avframe, yuv420p(progressive), 640x480, q=2-31, 20
0 kb/s, 120 fps, 120 tbn




Another option is to perform the operations vapoursynth or avisynth

tinterlace=mode=drop_odd is the same thing as selecteven() in avisynth, or clip = clip[::2] in vapoursynth

2.vpy
Code:
import vapoursynth as vs
core = vs.get_core()
clip = core.std.BlankClip(format=vs.YUV420P8, length=240, color=[16, 128, 128])
clip = core.text.FrameNum(clip)
clip = core.std.AssumeFPS(clip, fpsnum=120000, fpsden=1001)
clip = clip[::2]
clip.set_output()
vspipe --y4m 2.vpy - | ffmpeg -f yuv4mpegpipe -i - -an -f null NUL
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 640x48
0, 59.94 fps, 59.94 tbr, 59.94 tbn, 59.94 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Output #0, null, to 'NUL':
Metadata:
encoder : Lavf58.67.100
Stream #0:0: Video: wrapped_avframe, yuv420p(progressive), 640x480, q=2-31, 20
0 kb/s, 59.94 fps, 59.94 tbn


actual encode
vspipe --y4m 2.vpy - | ffmpeg -f yuv4mpegpipe -i - -c:v libx264 -preset:v fast -crf 20 -an 2.mp4


ffmpeg -i 2.mp4
Duration: 00:00:02.00, start: 0.000000, bitrate: 48 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 39
kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)

Looks ok, frames are correct when examined




Also, I would avoid mkv if you want more accurate timestamps. mkv uses a timebase of 1/1000s so there is rounding and some jitter
poisondeathray is offline   Reply With Quote
Old 17th February 2021, 09:30   #955  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly San Jose, California)
Posts: 277
Quote:
Originally Posted by poisondeathray View Post
It has nothing to do with interframe
I agree wholeheartedly. Why? Because it worked for SubJunk. I assume SubJunk didn't pipe to ffmpeg.

I love doom9. You guys are the best. You, and ... well, I'm not going to name names because I fear I would leave someone out. You all are Heroes of the Revolution.

You've given me a lot to examine. Do you think the difference is because ffmpeg works via PTSs instead of frame numbers? I've been getting that feeling but ffmpeg docs hardly even mention "PTS". Certainly the filter docs don't mention what they do regarding either reading or writing PTSs.

It's funny you should mention "tinterlace=mode=drop_odd is the same thing as selecteven() in avisynth" because my first ffmpeg drop_odd approach was to use 'select=eq(mod(n\,2)\,0)' but PTSs don't get updated (as seen in MPV) and the results are unpredictable.

You're obviously well informed. I've been struggling with ffmpeg for half a year but, tell me: Do you think I should abandon ffmpeg?
markfilipak is offline   Reply With Quote
Old 17th February 2021, 09:40   #956  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly San Jose, California)
Posts: 277
Quote:
Originally Posted by poisondeathray View Post
Also, I would avoid mkv if you want more accurate timestamps. mkv uses a timebase of 1/1000s so there is rounding and some jitter
What do you prefer?

Edit: I think MPEG streams use 1/90000s. What transports also use 1/90000s? All my sources will be DVD & BD movies.

Last edited by markfilipak; 17th February 2021 at 09:44.
markfilipak is offline   Reply With Quote
Old 17th February 2021, 15:34   #957  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,340
Quote:
Originally Posted by markfilipak View Post
Do you think the difference is because ffmpeg works via PTSs instead of frame numbers? I've been getting that feeling but ffmpeg docs hardly even mention "PTS". Certainly the filter docs don't mention what they do regarding either reading or writing PTSs.
That's a difference, but not the full explanation here. That rounding observation needs to be investigated farther, it's unexpected

It's avisynth that is CFR only, frame only. vapoursynth is actually both


Quote:
It's funny you should mention "tinterlace=mode=drop_odd is the same thing as selecteven() in avisynth" because my first ffmpeg drop_odd approach was to use 'select=eq(mod(n\,2)\,0)' but PTSs don't get updated (as seen in MPV) and the results are unpredictable.
For frame manipulations like that, they are automatically adjusted in avisynth and mostly in vapoursynth too.

Quote:
Do you think I should abandon ffmpeg?
No.

They are just tools, pros/cons to each of them. Often there are multiple ways to get something done, but certain operations are often better/faster in one or the other.



Quote:
Also, I would avoid mkv if you want more accurate timestamps. mkv uses a timebase of 1/1000s so there is rounding and some jitter
Quote:
Originally Posted by markfilipak View Post
What do you prefer?
For general use MP4, because it's more compatible with devices, web, NLE's - basically all scenarios
poisondeathray is offline   Reply With Quote
Old 17th February 2021, 15:55   #958  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
Quote:
Originally Posted by markfilipak View Post
Hi Y'all,

I've successfully transcoded 24/1.001fps samples to 60/1.001fps (and also to 120/1.001fps) via the Windows cmd scripts below.
But when I use the same script to transcode SubJunk's 24/1.001fps sample (http://www.spirton.com/uploads/Inter...e-Original.mkv), the transcode comes out unexpectedly and I wonder why.

This transcodes to 60/1.001fps as expected:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=60000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=60000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-60fps.mkv
This transcodes to 60fps instead of to 60/1.001fps:
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -filter_complex "tinterlace=mode=drop_odd" -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps-to-60fps.mkv
Of course, the problem could be with 'tinterlace=mode=drop_odd', so I tried it without 'tinterlace':
Code:
ECHO from vapoursynth import core>Mark's.vpy
ECHO video = core.ffms2.Source(source='20130218-Sample-Original.mkv')>>Mark's.vpy
ECHO import havsfunc as havsfunc>>Mark's.vpy
ECHO video = havsfunc.InterFrame(video, Preset="medium", Tuning="smooth", InputType="2D", NewNum=120000, NewDen=1001, GPU=True)>>Mark's.vpy
ECHO video = core.std.AssumeFPS(video, fpsnum=120000, fpsden=1001)>>Mark's.vpy
ECHO video.set_output()>>Mark's.vpy
vspipe --y4m Mark's.vpy - | ffmpeg -thread_queue_size 2048 -i pipe: -i 20130218-Sample-Original.mkv -map 0:v -map 1:a -codec:v libx265 -x265-params "crf=16:qcomp=0.6" -codec:a copy -codec:s copy 20130218-Sample-InterFrame-120fps.mkv
but it transcodes to 120fps instead of to 120/1.001fps. Anyone know why? I just can't see it.
You clearly cant read filter documentation. Drop odd mode of tinterlace filter drops odd fields.
While for some reason unknown to universe you expect it will make video into smaller fps.

First you invent problem that does not actually exist. Then you claim tool have issue.
And the only issue from start is you.
richardpl is offline   Reply With Quote
Old 17th February 2021, 16:25   #959  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,340
Quote:
Originally Posted by richardpl View Post
You clearly cant read filter documentation. Drop odd mode of tinterlace filter drops odd fields.
While for some reason unknown to universe you expect it will make video into smaller fps.
You must not be awake yet, Paul

https://ffmpeg.org/ffmpeg-filters.html#tinterlace
Quote:

‘drop_odd, 2’

Only output even frames, odd frames are dropped, generating a frame with unchanged height at half frame rate.
Drops odd frames, which implies keeps even frames

It also says "half frame rate" , which implies a lower fps

Also, in video world, non ffmpeg, frames are very different than fields.


What do you make of the rounding issue without any filters, without any containers ?
poisondeathray is offline   Reply With Quote
Old 17th February 2021, 19:54   #960  |  Link
markfilipak
Registered User
 
markfilipak's Avatar
 
Join Date: Jul 2016
Location: Mansfield, Ohio (formerly San Jose, California)
Posts: 277
Quote:
Originally Posted by poisondeathray View Post
What do you [Paul Mahol] make of the rounding issue without any filters, without any containers ?
How can MKV affect PTS? PTS (and DTS) are part of the elemental stream, not part of the container. The following is my parse from an MPEG2 movie ('--' is a byte, '----' is a nibble, '[####.#]' is hex offset '.' bit offset). Look:
Code:
             Ref: stnsoft.com/DVD/pes-hdr.html    | ... PES_HEADER_EXTENSION__________________
                  PTS (presentation time stamp)   | ... 31 00 01 5B C9 -- -- -- -- -- -- -- --
[0017]   [0000]   ?????                           |     0011 ---- ---- ---- ---- ---- ---- ---- ---- ----
[0017.4] [0000.4] PTS                             |     ---- 000- 0000 0000 0000 000- 0101 1011 1100 100-   ... = 11748; PTS = (11748)/(90000) seconds = 00:00:00.130533333
[0017.7] [0000.7] (marker bit)                    |     ---- ---1 ---- ---- ---- ---- ---- ---- ---- ----
[0019.7] [0002.7] (marker bit)                    |     ---- ---- ---- ---- ---- ---1 ---- ---- ---- ----
[001B.7] [0004.7] (marker bit)                    |     ---- ---- ---- ---- ---- ---- ---- ---- ---- ---1
                  DTS (decoding time stamp)       | ... -- -- -- -- -- 11 00 01 09 AD -- -- --
[001C]   [0005]   ?????                           |                    0001 ---- ---- ---- ---- ---- ---- ---- ---- ----
[001C.4] [0005.4] DTS                             |                    ---- 000- 0000 0000 0000 000- 0000 1001 1010 110-   ... = 1238; DTS = (1238)/(90000) seconds = 00:00:00.013755555
[001C.7] [0005.7] (marker bit)                    |                    ---- ---1 ---- ---- ---- ---- ---- ---- ---- ----
[001E.7] [0007.7] (marker bit)                    |                    ---- ---- ---- ---- ---- ---1 ---- ---- ---- ----
[0020.7] [0009.7] (marker bit)                    |                    ---- ---- ---- ---- ---- ---- ---- ---- ---- ---1
Am I misinterpreting things?

Last edited by markfilipak; 17th February 2021 at 20:47.
markfilipak is offline   Reply With Quote
Reply

Tags
48fps, 60fps, framedoubling, interframe, smooth motion

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


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