Torrent Invites! Buy, Trade, Sell Or Find Free Invites, For EVERY Private Tracker! HDBits.org, BTN, PTP, MTV, Empornium, Orpheus, Bibliotik, RED, IPT, TL, PHD etc!



Results 1 to 2 of 2
Like Tree7Likes
  • 7 Post By Ronin21

Thread: Screenshot Comparison Guide [Windows]

  1. #1
    Donor
    Ronin21's Avatar
    Reputation Points
    139211
    Reputation Power
    100
    Join Date
    Apr 2014
    Posts
    2,450
    Time Online
    207 d 15 h 10 m
    Avg. Time Online
    1 h 21 m
    Mentioned
    916 Post(s)
    Quoted
    560 Post(s)
    Liked
    3610 times
    Feedbacks
    135 (100%)

    Screenshot Comparison Guide [Windows]

    This guide is designed to describe the process of generating comparison screenshots between multiple releases of same movie including the source.

    1- Apps needed

    AviSynth - http://www.videohelp.com/tools/Avisynth
    AvsP - http://www.videohelp.com/tools/AvsP
    ffms2 - https://github.com/FFMS/ffms2/releases

    2- Installation

    - Download AviSynth exe file and install it.
    - Download ffms2 and put the ffms2.dll, FFMS2.avsi & ffmsindex.exe files in the AVISynth plugins folder, usually: C:\Program Files (x86)\AviSynth\plugins.
    - AvsP is portable. Just extract and run!


    3- Generating Screenshots

    1- Simply, open AvsP. Editor will show up. At this editor we will write simple lines including commands and functions called to generate our screenshots. Going line by line, we have to import our targets to capture their screenshots. For example

    a=import("source.avs")
    b=ffvideosource("Encode1.mkv")
    c=ffvideosource("Encode2.mkv")

    Replace "source.avs" with the full path to your AVS file (example, "C:\foldername\source.avs"). This one represents the .avs script file which you've generated during the encoding process of the source BD. So this considered the source BD.
    Replace "Encode1.mkv" with the path to the first encode and "Encode2.mkv" with the path to the second encode. These are two encodes, could be your encode vs scene release for example. You can add more !!

    Notice how the variable "a" uses import (Rather than ffvideosource, which is a video opener that uses a more powerful video parser, ffmpeg. Which also is what you should use for the encoded MKV) and refers to the .avs file (which is the "source" file code you made/had earlier during the encoding process). Also notice that a, b and c are variable represents the imported target to use in the rest of the script !!

    I don't have a ready source.avs so, I'll work with two encodes and everything is the same for all targeted content from this point. The first lines of the code would be

    a=ffvideosource("Encode1.mkv")
    b=ffvideosource("Encode2.mkv")


    2- Simply Press F5 or go to the menu at the top and click on Video >>> Refresh preview. The app will freeze and may take long time depending on you machine and HDD specifications. One it's unfreeze you'll see a red text message at the preview area says "Not a clip". That happens once.

    http://s14.postimg.org/cvu2mi7n5/201...9_21_23_16.jpg


    3- Now we add the interleave() function which interleaves frames from several clips on a frame-by-frame basis. And pressing F5 will show the image.

    interleave(a,B)

    http://s14.postimg.org/6lyszi88h/201...9_21_35_18.jpg

    For example, if we 2 video streams like we already have here then Interleave(a, B) will give you a single video stream with the first frame of a >> first frame of b >> second frame of a >> second frame of b >> and so on to the end. The way that Avisynth works is that since no variable has been assigned to interleave’s return value, any filters/functions that are called afterwards without an explicit stream will be applied to this interleaved stream.

    Another example, let's say we have a source which is a and three encodes which are b, c and d. Putting them in the interleave function like interleave(a,b,a,c,a,d) will present the source frame before every encode frame.


    4- Now we may add the spline36resize function which is resize filter to re-scale the input video frames to an arbitrary new resolution. You can put numbers to upscale your videos manually but I prefer let it as it is.

    spline36resize(converttorgb,ffsar>1?round(width*ff sar):width,ffsar<1?round(height/ffsar):height)

    Since we compare two identical resolution encodes with correct aspect ratio, you wouldn't see any difference after adding this line and pressing F5.

    Also note that this function applied to the interleaved stream. So it's applied on a and b. If you want to apply it one by one then add it after each variable assigning like this one for a

    a=import("Source.avs").converttorgb()
    a=a.spline36resize(ffsar>1?round(a.width*ffsar):a. width,ffsar<1?round(a.height/ffsar):a.height)

    Do not use this with HD. I put it there just for knowledge and info. Use it with DVDs.


    5- Now we will add some info by adding the FFInfo() function which shows general information about the current frame.

    http://s14.postimg.org/9hbw6dc8h/2015_09_30_0_24_52.jpg

    And to control what info you'd like to see, simply, add the arguments of the function and change their default values.

    FFInfo(framenum=true,frametype=true,cfrtime=false, vfrtime=false, version=false, colorspace=false, colorrange=false, cropping=false, sar=false)

    http://s14.postimg.org/kd3a1px69/2015_09_30_0_29_16.jpg

    Some of these arguments are different in each version so you may want to try FFInfo() clean at first to see what info are there then disable whatever you want.

    You can use ffinfo function for each targeted clip to show some optional info on each frame like this

    a=ffvideosource("Encode1.mkv").subtitle("Encode1", align=9).ffinfo(framenum=true,frametype=false,cfrt ime=false,vfrtime=false)
    b=ffvideosource("Encode2.mkv").subtitle("Encode2", align=9).ffinfo(framenum=fasle,frametype=true,cfrt ime=false,vfrtime=false)


    6- Now we will add subtitles only to show which image is for which encode. The subtitle() function which add single line of text would be added to each of the targeted content because it would be different for each release. So we will add it on the variables assignments before the interleave function like this

    a=ffvideosource("Encode1.mkv").subtitle("Encode1", align=9)
    b=ffvideosource("Encode2.mkv").subtitle("Encode2", align=9)

    And I'll add some arguments to one of the frames (only Encode2) to change the color, text .. etc of the text like this

    a=ffvideosource("Encode1.mkv").subtitle("Encode1", align=9)
    b=ffvideosource("Encode2.mkv").subtitle("Encode2", align=9, font="Cambria", size=29, text_color=$ff0000)

    http://s14.postimg.org/yksyqd9v5/2015_09_30_0_44_22.jpg

    http://s14.postimg.org/j5txn8wfl/2015_09_30_0_44_28.jpg


    7- To save the image, click Video -> Save image as.... and make sure that the file type is Portable Network Graphics (*.png) and click save.

    http://s14.postimg.org/5nifx7uwh/2015_09_30_1_27_02.jpg



    4- Additional Info


    1- You'll also notice the Picture Type as P, B, or sometimes I. You want to find positions where the source frame is P and the encode frame is B or only B for both the source and encode.

    Why ?

    mael from TC wrote:
    Frame types
    I-frame or Intracoded frame -> Simply put - this frame is an independent frame, that does not use any information from frames that precede or succeed it. A rough analogy would mean this is our reference frame. They consume the most space.

    P-frame or Predicted frame -> These types of frames use information from the previous frame. In other words p-frames basically encode how the current image is different from the preceding image. For this reason [presumably] they are also called as Delta-frames. Delta in calculus indicates change. They consume less space than I, but more than B.

    B-frames or Bi-predictive frames -> These frames are the most interesting ones.They experience most compression and have the lowest space allocation.

    Transparency
    A source can be defined as a set of images/frames – B, P, and I.

    An encode can be defined as a set of images/frames – B, P, and I that are supposed to represent the source. Encodes are invariably smaller than the sources.

    A transparent encode is defined as an encode that represents the source accurately enough – so that the differences between the encode and the source are indiscernible. That is, if I play the source and encode alongside you shouldn’t be able to tell which is which. So how do we test for transparency?

    Well, if you take a particular I-frames of the encode and compare them with the corresponding source frames – you won’t learn a thing. That is because, I-frames are treated with great sanctity; and thus the encoder tries replicates these frames as faithfully w.r.t. the source as possible even when you use a relatively bad setting.

    A B-frame, on the other hand, takes advantage of compression techniques the most – so B-frames are the best indicators.

    When a frame that was P-frame in source [P-frames are space-heavier than B-frames]; but is encoded as a B-frame in encode – such a frame best indicates how much work [or damage] your encoder has done.

    When a frame that was P in source and B in encode resemble each other – that means that your encoder has created an encode that is very faithful to the source. You have achieved transparency.

    If you could have achieved transparency at a significantly lower bit-rate, your encode is termed bloated.


    2- If you faced error says that there is no function named ffvideosource then make sure you downloaded the full ffms2. There should be an ffms2.dll and ffms2.avsi file in your Avisynth plugins directory. Also, Make sure that the path of Avisynth plugins at AvsP is correct (AvsP -> Options -> Program Settings -> Plugins Autoload Directory). If that still didn't solve the issue then import the plugin manually by adding these lines to the top of your code
    LoadCPlugin("C:\Program Files (x86)\AviSynth\plugins\ffms2.dll")
    import("C:\Program Files (x86)\AviSynth\plugins\ffms2.avsi")

    Try LoadPlugin instead of LoadCPlugin if that doesn't work

    3- You can edit ffms2.avsi to add the text color, size .. etc to the script. Simply, find the >> function FFInfo >> and add to its argument >> int "text_color" >> Then go to the >> return scriptclip >> and add before it the checking of the existence of argument

    text_color_string= (Defined(text_color)) ? "text_color="+string(text_color)+"," : ""

    and add >> "+text_color_string+" >> before >> lsp = 1 >> at the end line so it becomes like this

    return scriptclip("subtitle(fftempstring,"+text_color_str ing+"lsp = 1)", after_frame=true)

    Save ffms2.avsi and you can now add text_color to the ffinfo function to change the color like this

    FFInfo(text_color=$ff0000)

    http://s14.postimg.org/ki71be4hd/2015_09_30_1_46_02.jpg

    4- If you got desynced frames then make sure your source.avs has the properly demuxed video stream (*.mkv). After that, ensure that the framerates for your source and encode match up. If they don’t, make sure that you properly deinterlaced/detelecined them in your source.avs. If you are sure you properly did that but they still don’t match up, then you should check is if the desync is a constant amount (e.g. source is always 3 frames behind encode). If this is the case, then you will have to use the trim function to get rid of the extra frames. Let’s say that the encode has 3 extra frames at the beginning. In your compare.avs file where b is the variable for your encode video stream, you should add this line right above the interleave() call:
    b=b.trim(3,b.framecount)
    Keep in mind that some sources/encodes are finnicky and it might be that the frames desync by different amounts throughout the movie (like the first third of the movie was synced if i had trim(2) but the last third needed trim(3) to be synced). If this is the case, the easiest is probably to find the proper syncs/trims at the various parts and just extract the frames you need and be done with it. If you want to get super fancy, you can play around with SelectRangeEvery() and make them match up like that (which is honestly not worth the effort imo).

    5- If you have three files to compare with each other, all have different resolution then you can try something like this

    a=import("/home/user/movie.avs").subtitle("Source, 720×576", align=9)
    b=ffvideosource("/home/user/movie.encode1.mkv").subtitle("encode1, 712×572", align=9)
    c=ffvideosource("/home/user/movie.encode2.mkv").subtitle("encode2, 716×572", align=9)
    a=a.Spline36Resize(712,572)
    b=b.Spline36Resize(712,572)
    c=c.Spline36Resize(712,572)
    interleave(a,b,c)
    spline36resize(converttorgb,ffsar>1?round(width*ff sar):width,ffsar<1?round(height/ffsar):height)
    ffinfo(framenum=true,frametype=true,cfrtime=false, vfrtime=false)

    Or you can add

    .crop(left,top,-right,-bottom)

    before the .subtitle() of a and c to get those dimensions equal to b

    Also, Alternatively, you could add a border to each source to get them to match like this

    a=import("/home/user/movie.avs").subtitle("Source, 720×576", align=9)
    b=ffvideosource("/home/user/movie.encode1.mkv").subtitle("encode1, 712×572", align=9).ffinfo(framenum=true,frametype=true,cfrti me=false,vfrtime=false).addborders(4,2,4,2) #or by whatever amount you cropped
    c=ffvideosource("/home/user/movie.encode2.mkv").subtitle("encode2, 716×572", align=9).ffinfo(framenum=true,frametype=true,cfrti me=false,vfrtime=false).addborders(2,2,2,2)
    interleave(a,b,c)
    spline36resize(converttorgb,ffsar>1?round(width*ff sar):width,ffsar<1?round(height/ffsar):height)

  2. #2
    User cagriu1905's Avatar
    Reputation Points
    934
    Reputation Power
    36
    Join Date
    Dec 2016
    Posts
    68
    Time Online
    5 d 12 h 10 m
    Avg. Time Online
    2 m
    Mentioned
    15 Post(s)
    Quoted
    6 Post(s)
    Liked
    31 times
    Feedbacks
    7 (100%)
    So clear, thank you


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •