VideoHelp Forum
+ Reply to Thread
Results 1 to 30 of 30
Thread
  1. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I have a few Anime episodes only available in 480p (old) and I want them to be 1080p. I've tried Avisynth, Video Enhancer & After Effects. Problem is, when the quality is good, it takes like 5~8 hours to encode, which is wayyy too long for me.

    What can I do to preserve as much quality as possible? Size doesn't matter to me, quality and encode time do.

    Here's a MediaInfo of a file I want to encode as an example:

    Code:
    General
    Unique ID                   : 244857016911356285905704324365619845703 (0xB835BF002AA2BFC2A7EC2B3A78105A47)
    Complete name               : C:\Users\Jeroen\Videos\TEST\480.mkv
    Format                      : Matroska
    Format version              : Version 2
    File size                   : 140 MiB
    Duration                    : 22mn 36s
    Overall bit rate            : 864 Kbps
    Encoded date                : UTC 2012-10-02 19:42:08
    Writing application         : mkvmerge v5.2.0 ('I can't explain') built on Dec 18 2011 18:12:03
    Writing library             : libebml v1.2.3 + libmatroska v1.3.0
    Attachements                : Amira-Semibold.otf
    
    Video
    ID                          : 1
    Format                      : AVC
    Format/Info                 : Advanced Video Codec
    Format profile              : Main@L3.1
    Format settings, CABAC      : Yes
    Format settings, ReFrames   : 6 frames
    Codec ID                    : V_MPEG4/ISO/AVC
    Duration                    : 22mn 36s
    Nominal bit rate            : 768 Kbps
    Width                       : 848 pixels
    Height                      : 480 pixels
    Display aspect ratio        : 16:9
    Frame rate mode             : Constant
    Frame rate                  : 23.976 fps
    Color space                 : YUV
    Chroma subsampling          : 4:2:0
    Bit depth                   : 8 bits
    Scan type                   : Progressive
    Bits/(Pixel*Frame)          : 0.079
    Writing library             : x264 core 120 r2120 0c7dab9
    Encoding settings           : cabac=1 / ref=6 / deblock=1:1:1 / analyse=0x1:0x111 / me=umh / subme=8 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=768 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=1536 / vbv_bufsize=3840 / nal_hrd=none / ip_ratio=1.40 / aq=1:0.60
    Default                     : Yes
    Forced                      : Yes
    
    Audio
    ID                          : 2
    Format                      : AAC
    Format/Info                 : Advanced Audio Codec
    Format profile              : LC
    Codec ID                    : A_AAC
    Duration                    : 22mn 36s
    Channel(s)                  : 2 channels
    Channel positions           : Front: L R
    Sampling rate               : 44.1 KHz
    Compression mode            : Lossy
    Default                     : Yes
    Forced                      : Yes
    
    Text
    ID                          : 3
    Format                      : ASS
    Codec ID                    : S_TEXT/ASS
    Codec ID/Info               : Advanced Sub Station Alpha
    Compression mode            : Lossless
    Default                     : Yes
    Forced                      : Yes
    Quote Quote  
  2. Too long to upscale or too long to encode? Are you performing any other filtering?
    Quote Quote  
  3. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    Encode, I guess. I execute the filter using Virtualdub, and it takes 5h to render the file.

    As for filtering, I'm using this (Avisynth):

    Code:
    import("c:\Program Files (x86)\AviSynth\plugins\GradFun2DBmod.avs")
    LoadPlugin ("C:\Program Files (x86)\AviSynth\plugins\RemoveGrainSSE2.dll")
    LoadPlugin ("C:\Program Files (x86)\AviSynth\plugins\dfttest.dll")
    LoadPlugin ("C:\Program Files (x86)\AviSynth\plugins\gradfun2db.dll")
    
    ffvideosource("480.mkv")
    nnedi3_rpow2(rfactor=2,cshift="spline64resize")
    spline64resize(1696,960)
    crop(8,6,-8,-6)
    spline64resize(1920,1080)
    crop(0,120,-0,-120)
    dfttest(sigma=8.0)
    aWarpSharp2(depth=20)
    Gradfun2dbmod(str=0,radius=1,range=1, adapt=1, temp=20, thr=2)
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Why need it STORED as 1080p? Why not just leave it as is and let your TV scale it on playback?

    Scott
    Quote Quote  
  5. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I want to watch the video on my tablet, not my TV, as my family is using it. And my tablet has a 1600p resolution, so scaling looks horrible.

    On a side note: Does it matter if you use a TV, Computer or Tablet when talking about resizing? How does the device influence the resize?

    Edit: Got to go, I'll return tomorrow.
    Last edited by fighuass; 4th Sep 2015 at 15:07.
    Quote Quote  
  6. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    please don't say resizing if you mean scaling and vise versa, it confuses the issue (at least for me)

    resize is when you are processing /encoding to a new file

    scaling is what the TV or video player does to display it

    and if your tablet does a bad job of upscaling the video, maybe you should try a different "player" app/program on your tablet
    Quote Quote  
  7. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I'm using mxplayer, and I don't think there is a better one.
    Quote Quote  
  8. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    "ffvideosource("480.mkv")
    nnedi3_rpow2(rfactor=2,cshift="spline64resize")
    spline64resize(1696,960)
    crop(8,6,-8,-6)
    spline64resize(1920,1080)
    crop(0,120,-0,-120)"

    if i'm reading this correctly your resizing TWICE aka 2 times

    what the heck for ?

    resize it one time, it won't take as long and the quality will be better
    Quote Quote  
  9. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I'm using this script from a blog, but I believe it's done to get the correct aspect ratio. I'll try just resizing it once tomorrow.
    Quote Quote  
  10. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    why crop away video top an bottom to make it fit the 16:9 screen, thats a waste

    resize once once to double height and width, it will almost fill the screen, black bars on the side, but you will have the full frame
    nothing removed

    and BTW if your forcing Mxplayer to stretch the original video to 16:9
    that is why it looks bad
    Quote Quote  
  11. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    Good point, but is there a way to put the black bars on the top and bottom of the video instead of the sides?
    Quote Quote  
  12. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    that depends on the aspect of the source file
    4:3 is almost square, 16:9 is wide, you can't but bars on top an bottom, with out cropping away video
    unless you want to hold your tablet vertical
    if your tablet is truly HD 1920/1080
    and you resize to 1080/ XX, where 1080 is the width
    and play the video with the tablet vertical
    you will have bars top and bottom
    Me i would prefer just double size, and watch normal, with bars on the side
    just like watching an old TV show on a new TV
    Quote Quote  
  13. Crop before any scaling. Then scale only once. But none of those filters is especially slow. Your problem is the encoding time. Use faster settings in the encoder.

    nnedi3 is probably the best upscaler for AviSynth -- better than any media player or TV can do. Sometimes upscaling in two steps with an aWarpSharp() and Sharpen() in between can give sharper results with animation.
    Quote Quote  
  14. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I'll change the script to

    Code:
    ffvideosource("480.mkv")
    nnedi3_rpow2(rfactor=2,cshift="spline64resize")
    crop(0,120,-0,-120)
    spline64resize(1920,1080)
    What do you mean by using faster settings in the encoder? As changing the x264 settings in virtualdub?
    Quote Quote  
  15. Originally Posted by fighuass View Post
    I'll change the script to

    Code:
    ffvideosource("480.mkv")
    nnedi3_rpow2(rfactor=2,cshift="spline64resize")
    crop(0,120,-0,-120)
    spline64resize(1920,1080)
    Crop before scaling. Resize only once with nnedi3 to the correct size.

    Originally Posted by fighuass View Post
    What do you mean by using faster settings in the encoder? As changing the x264 settings in virtualdub?
    Yes. Though AVI isn't a good container for AVC.
    Quote Quote  
  16. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    Hmm, I think I'd best drop the cropping entirely and seeing how it works out. On a side note, what's the most lightweight anti aliasing filter?
    Quote Quote  
  17. Originally Posted by fighuass View Post
    Hmm, I think I'd best drop the cropping entirely and seeing how it works out.
    Why? The equivalent using your crop values are:

    Code:
    ffvideosource("480.mkv")
    crop(0,60,-0,-60)
    nnedi3_rpow2(rfactor=4,cshift="spline64resize", fwidth=1920, fheight=1080)
    I haven't seen your source so I don't know if that crop or resize is appropriate. But it has the same effect as your two step resize.

    Or in two steps:

    Code:
    ffvideosource("480.mkv")
    crop(0,60,-0,-60)
    nnedi3_rpow2(rfactor=2,cshift="spline64resize", fwidth=1280, fheight=720)
    aWarpSharp(depth=2)
    Sharpen(0.2)
    nnedi3_rpow2(rfactor=2,cshift="spline64resize", fwidth=1920, fheight=1080)
    aWarpSharp(depth=2)
    Sharpen(0.2)
    Though with Spline64Resize and the extra sharpening that will probably produce oversharpening halos.

    Originally Posted by fighuass View Post
    On a side note, what's the most lightweight anti aliasing filter?
    I don't know which is the lightest weight but I usually use Santiag() when I need antialiasing. It does a reasonable job without causing too much damage.
    Last edited by jagabo; 4th Sep 2015 at 17:37.
    Quote Quote  
  18. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I don't think the cropping's that necessary, but as I said, I'll test it.
    Quote Quote  
  19. Member
    Join Date
    Nov 2009
    Location
    United States
    Search PM
    The frame size and bit rate you are starting with doesn't seem like it could be very good quality to start.
    That may be the main reason it looks like crap on your tablet, I could be wrong it's according to the content.

    If it needs denoising that should be done before the re-sizing, that's one reason the script was taking so long to render, you were denoising after the resize.
    Spline64 has no big advantage over spline36, but spline36 is faster and about the same quality the difference between the two is hardly noticeable at all.

    If it were me I would denoise, maybe a light awarpsharp, and then nnedi3_rpow2(rfactor=2).
    If you leave out the cshift parameter it speeds up nnedi3, thats just to correct the center shift that nnedi3 introduces, it's not noticeable unless you compare screenshots.
    There's really no benefit to resizing it to 1080p unless your tablets upscaling is utter crap, it will just waste time re-encoding and sd/hdd space.
    But if you have to I would do it in one step with
    nnedi3_rpow2(rfactor=2,cshift="Spline36Resize", fwidth=1920, fheight=1080)

    Or
    nnedi3_rpow2(rfactor=2,cshift="Lanczos4Resize", fwidth=1920, fheight=1080)


    edit: I meant to type spline36, all corrected.
    Last edited by gregalan; 5th Sep 2015 at 12:06. Reason: Corrections
    Quote Quote  
  20. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    Whoa, after tweaking the script quite a lot, it's now only 50 minutes. That's fast.

    What the script now looks like:

    Code:
    ffvideosource("480.mkv")
    aWarpSharp(depth=40)
    Toon(strength=1)
    nnedi3_rpow2(rfactor=2,cshift="Lanczos4Resize", fwidth=1920, fheight=1080)
    Also, what would be the "best" android video player for upscaling, if there's a better one than MX?
    Quote Quote  
  21. Somehow I missed the full script in post #3 and only saw the partial script quoted by thewizard in post #8. dfttest(sigma=8) is the biggest CPU hog in the full script. As gregalan pointed out, calling dfttest after cropping but before upscaling will be much faster.

    aWarpSharp(depth=40) is really going to distort the picture and create a lot of buzzing edges.

    Since we haven't seen your source it's hard to recommend particular settings. But try something like:

    Code:
    ColorMatrix(mode="rec.601->rec.709")
    Santiag()
    UnDot()
    TemporalDegrain(SAD1=200, SAD2=150, Sigma=8)
    nnedi3_rpow2(2,cshift="Spline36Resize", fwidth=1440, fheight=1080)
    MergeChroma(aWarpSharp(depth=10),  aWarpSharp(depth=20))
    Sharpen(0.2)
    You can get even better denoising using DeDup() to remove duplicate frames before denoising. But then you'll have to encode VFR.
    Quote Quote  
  22. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    If your resizing, you don't need to up scale while playing
    If you want to let the player upscale, you don't need to resize
    Just remember Not to stretch the video to 16:9, let it play in the original aspect 4:3 / 5:4 ?
    Do a test, compare the new video in mx player to the source,not stretched
    And go with want looks best to you
    With a clean clear crisp quality source, there is probably little difference
    But with an Iffy source, the re-encoded resized file will probably look better
    Last edited by theewizard; 5th Sep 2015 at 12:21.
    Quote Quote  
  23. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    Here's a short part of the source: https://vid.me/ktPG
    Quote Quote  
  24. That's about the most annoying clip you could have uploaded.
    Quote Quote  
  25. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    Except for the shifting focus, it looks good, and does not needed be resized
    I don't think You are not going to fix the focus problem by resizing, or sharpening
    That will be a tedious frame by frame processes
    Somebody else might know a short cut, but that is beyond me

    When recording a screen with a camera, Turn Off Auto Focus
    Set it manually and leave it
    Quote Quote  
  26. Originally Posted by theewizard View Post
    Except for the shifting focus, it looks good, and does not needed be resized
    He's claiming his player has poor upscaling.
    Quote Quote  
  27. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    I'm not sure if it's my tablet or the player, and the shifting focus is intended to be a part of the video's "intro". Later on it disappears.
    Quote Quote  
  28. Member
    Join Date
    Jan 2007
    Location
    United States
    Search Comp PM
    then I would just do the test I mentioned above
    But I think you will see little difference,
    Unless your tablet is really poor at upscaling
    Quote Quote  
  29. It's annoying trying to work with that video because there are so few clear frames between the blurred sections. Noise reduction, halo reduction, etc. mostly just made it worse so I left it at this:

    Code:
    ColorMatrix(mode="rec.601->rec.709")
    aWarpSharp(depth=2)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1920, fheight=1080)
    MergeChroma(aWarpSharp(depth=5), aWarpSharp(depth=20))
    Sharpen(0.2)
    That should be pretty fast as long as you don't use slow compression settings. I get about 25 fps with x264 at the veryfast preset, 6 fps at slow (i5, 2500K).
    Quote Quote  
  30. Member
    Join Date
    Oct 2014
    Location
    The Netherlands
    Search Comp PM
    ^I get an error when opening the script,

    "Script error: expected a or )
    line 3 column 38


    EDIT: Nevermind, it should be
    Code:
    ColorMatrix(mode="rec.601->rec.709")
    aWarpSharp(depth=2)
    instead of

    Code:
    ColorMatrix(mode="rec.601->rec.709aWarpSharp(depth=2)
    As for the speed and quality of the script? The quality is great, and the speed equals 1 hour at 10~13fps for a 24 min video. That's good for me!
    Last edited by fighuass; 6th Sep 2015 at 06:36.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!