i use this script to upscale some anime stuff
v = LWLibavVideoSource("d:\4.mp4", fpsnum=24000, fpsden=1001, format="YUV420P8")
a = LWLibavAudioSource("d:\4.mp4")
nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1280, fheight=720)
and i noticed after i encode it looks like the result video lags when the whole picture moves (both if i use 264 or 265 encoding with Megui)
+ Reply to Thread
Results 1 to 19 of 19
Original is VFR. fpsnum,fpsden produces an approximate CFR conversion. You add physical frames in approximately the correct locations, but it's not always correct. You might get slightly better results with the directshow method and convertfps=true. If you want it exactly like the original you need to keep it VFR
When I encode your script I get exactly the same frames. But as poisondeathray pointed out, the source is VFR and your conversion to CFR has led to duplicate and missing frames. And your encoding seems to have made things worse.
Last edited by jagabo; 2nd Apr 2016 at 11:21.
how can i know how to use my script
i am generally new to this and i have like 10 videos i need to upscale
what is CFR AND VFR ... and does it mean for the video...
main question is how to what video type i have in my hands and what script use for each because i had upscaled other videos with the same script and no problems were present
mediainfo can sometimes tell you it's VFR , but it's not always accurate - use view=>text
Frame rate mode : Variable
Frame rate : 23.976 (23976/1000) fps
Minimum frame rate : 9.575 fps
Maximum frame rate : 1000 000.000 fps
Original frame rate : 23.976 (24000/1001) fps
VFR = variable frame rate
CFR = constant frame rate
VFR means the FPS changes, goes up and down in sections. Another way of looking at it is the display time per frame is different - some frames are displayed for longer than others
Avisynth is CFR only (most editors are CFR only too) .
Timecodes control the VFR information (the display time per frame). So you would have to extract the timecodes from the original and mux them into the final version to keep the same VFR timing. THe script cannot use fpsden,fpsnum, because you're inserting frames in the approximate locations. You need a 1:1 frames version. The encode will be out of sync until you add in the timecodes
You can extract timecodes from MP4 with mp4fpsmod. It's a command line tool. FFMS2/ffindex in avisynth can do it too.
MKVToolNix has a special box for importing timecodes if you wanted MKV output, or you can use mp4fpsmod again to insert the timecodes if you wanted MP4 output. x264 can accept timecodes also with --tcfile-in
The time codes in before.mp4 are screwed up. It will never play smoothly. If you step through the video frame by frame (ignoring the timecodes) you'll see there is smooth motion in the middle section. But if you step through the time codes in that panning shot you'll see they are displayed for random times ranging from 1 microsecond to 74 milliseconds.
The left column is the raw timecodes in milliseconds. The right column is the delta from the previous timecode.
Last edited by jagabo; 2nd Apr 2016 at 12:54.
Yes, but it will be as "smooth" as the original - which wasn't that "smooth" to begin with.
It will still be smoother than what he's doing now converting to CFR
You could manually edit timecodes in sections to get slightly smoother. But you have to be careful, or it will become out of sync
Mediainfo can sometimes be a good enough indicator but it's not always accurate - if you look at the min/max rates and they are very close like 23.8 and 24.1 or something like that, it should be close enough to treat as CFR . When you get a min rate of something like 9 like in your video, you can't treat it as CFR
If you want the timing to be the same as source, everytime no fuss, you have to use VFR.
Anime "groups" tend to use VFR because it's slightly more efficient for encoding (fewer frames are encoded), but the benefit is tiny - maybe a few % at most. It often causes more problems - especially if you want to edit it, and for people who don't know it's VFR or how to handle it.
OT: why is there always a mandatory upskirt shot in anime videos?
I'm looking at some fan / user productions like MMD videos etc... and it's like always there hahaha
It's like part of the culture or something
but setting it to 29.970 it makes it ok
just checked the same video i posted and it goes from 8 fps to 1000000 lol while the other from 14-119 max i guess setting the fps from 29.970 would make it ok i guess
i all ready checked and there is no chopping
Nah, it will still be choppy, maybe a bit better, but still worse than the original
Again - the only way you can keep the original timing is with VFR, or if the "source" was minimally variable, you can treat it as CFR
Here are 3 encodes, CFR @ 23.976, CFR @ 29.97, VFR . They are straight encodes (none of the filtering) with audio copied , just to test the motion/smoothness . Watch them back to back. The 29.97 is still choppy. Only the VFR keeps the original smoothness (which wasn't that smooth to begin with, but still is better than the alternatives)
i had taken a video where the min is 14 and max 119 fps and setting them to 29.970 works fine where 24 can be some times problematic
this video is done it goes from 8 fps to 1,000,000 a million ! no kidding
for other videos that are 14 to 119 works fine setting it to 29.970
Feel free to do whatever you want - I'm just providing facts and info
When you set it to 29.97 , the CFR conversion will insert duplicate frames in approximate locations. It will not be perfect. For some videos, some sections, you might luck out and it might be close enough to notice. You would have to check the entire video, to make sure. But others will be noticably off in some sections. Just like this sample video. It won't be the same as the source unless you use VFR. If you have VFR sources and are not editing them in terms of trimming or adding segments, I would keep it VFR. As a general rule you should do as less damage as possible. Personally I would have kept it CFR (I mean when processing the original, original source). Fewer problems with devices, equipment, editing etc.. But you're out of luck because your "source" is VFR now
Frame rate mode : Variable
Frame rate : 25.240 fps
Minimum frame rate : 14.985 fps
Maximum frame rate : 119.880 fps
Original frame rate : 29.970 (30000/1001) fps
most of the videos i have have this and some dont the original line
what does original frame rate means ?
Last edited by zanzar; 2nd Apr 2016 at 14:33.
Original frame rate (as read by mediainfo) is the rate entered into the encoder. The header in the video will say 29.97 and mediainfo is just reading it. Almost all these anime sources come from NTSC DVD's which have a frame rate of 29.97 on the DVD. The actual content frame rate is usually much lower in anime, 23.976 in sections, and even 12 or 6 in others, consisting of duplicate fields and frames
Many anime encoders decimate duplicate frames (animation often has many duplicates), and the VFR timecodes keep the timing and everything in sync.
Some videos might not have that category "original frame rate" because some muxers or encoders might remove it
I wouldn't rely on mediainfo too much, because it can be inaccurate.