VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. 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")
    AudioDub(a,v)
    ConvertToYV12()
    ColorMatrix(mode="Rec.601->Rec.709")
    ColorYUV(cont_u=15, cont_v=20)
    FastLineDarkenMod()
    dehalo_alpha(rx=2, ry=2)
    Toon(strength=0.8)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1280, fheight=720)
    aWarpSharp(depth=8.0)
    sharpen(0.20)


    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)
    Image Attached Files
    Quote Quote  
  2. 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
    Quote Quote  
  3. 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.
    Quote Quote  
  4. Originally Posted by jagabo View Post
    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.
    well it feels like that

    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
    first
    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
    Quote Quote  
  5. Originally Posted by zanzar View Post
    Originally Posted by jagabo View Post
    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.
    well it feels like that

    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
    first
    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
    Quote Quote  
  6. 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.

    Click image for larger version

Name:	tc.png
Views:	468
Size:	13.2 KB
ID:	36372

    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.
    Quote Quote  
  7. 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
    Quote Quote  
  8. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post
    Originally Posted by jagabo View Post
    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.
    well it feels like that

    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
    first
    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
    Originally Posted by jagabo View Post
    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.

    Image
    [Attachment 36372 - Click to enlarge]


    The left column is the raw timecodes in milliseconds. The right column is the delta from the previous timecode.



    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
    so how can i know if a video will be like this before encoding? i have few videos all variable frame rate but almost all came out fine just a few came like this

    can a video come allright even if it hase variable frame rate?
    Quote Quote  
  9. Originally Posted by zanzar View Post

    so how can i know if a video will be like this before encoding? i have few videos all variable frame rate but almost all came out fine just a few came like this

    can a video come allright even if it hase variable frame rate?

    A video can come out alright if it's minimally variable. ie very small deviations in the framerate. Then you can effectively treat it as CFR
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post

    so how can i know if a video will be like this before encoding? i have few videos all variable frame rate but almost all came out fine just a few came like this

    can a video come allright even if it hase variable frame rate?

    A video can come out alright if it's minimally variable. ie very small deviations in the framerate. Then you can effectively treat it as CFR
    so essentially every video that has a high shift in frame rates would come out like that ?
    how can i know before encoding?
    Quote Quote  
  11. Originally Posted by zanzar View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post

    so how can i know if a video will be like this before encoding? i have few videos all variable frame rate but almost all came out fine just a few came like this

    can a video come allright even if it hase variable frame rate?

    A video can come out alright if it's minimally variable. ie very small deviations in the framerate. Then you can effectively treat it as CFR
    so essentially every video that has a high shift in frame rates would come out like that ?
    how can i know before encoding?
    You look at the timecodes.

    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.
    Quote Quote  
  12. 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
    Quote Quote  
  13. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post

    so how can i know if a video will be like this before encoding? i have few videos all variable frame rate but almost all came out fine just a few came like this

    can a video come allright even if it hase variable frame rate?

    A video can come out alright if it's minimally variable. ie very small deviations in the framerate. Then you can effectively treat it as CFR
    so essentially every video that has a high shift in frame rates would come out like that ?
    how can i know before encoding?
    You look at the timecodes.

    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.
    hmm i now noticed that a lot of the videos are like 14 fps min and 119 max and putting them to 24 fps makes it choppy
    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
    Quote Quote  
  14. Originally Posted by zanzar View Post
    hmm i now noticed that a lot of the videos are like 14 fps min and 119 max and putting them to 24 fps makes it choppy
    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)
    Image Attached Files
    Quote Quote  
  15. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post
    hmm i now noticed that a lot of the videos are like 14 fps min and 119 max and putting them to 24 fps makes it choppy
    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 am not talking about this video i talk about a general thing
    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
    Quote Quote  
  16. 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
    Quote Quote  
  17. Originally Posted by poisondeathray View Post
    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
    it says

    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.
    Quote Quote  
  18. 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.
    Quote Quote  
  19. Originally Posted by poisondeathray View Post
    The actual content frame rate is usually much lower in anime, 23.976 in sections, and even 12 or 6 in others
    And some at 29.97 and 59.94 -- the latter usually titles that are overlaid after the original film has been telecined.
    Quote Quote  



Similar Threads