0

Is it possible to open two instances of VLC media player, with one displaying the source video file and the other displaying the encoded handbrake result. And then to extract the frame from each player and walk through each pixel value summing the absolute difference and eventually dividing that sum of the frame height times width?

Something like

v1 = new VLC("filename1.mkv");
v2 = new VLC("filename2.mkv");
long long F = 0;
double S = 0;

/* initialize the media players here to begin getting frames */

while (v1.HasNextFrame() && v2.HasNextFrame()) {
    img1 = v1.getFrame();
    img2 = v2.getFrame();

    int H = img2.getHeight();
    int W = img2.getWidth();
    int D = 0;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            D += Math.Abs(img1[i][j].pixelValue - img2[i][j].pixelValue);
        }
    }

    if (S == 0) {
        S = (D / (H * W) );
    } else {
        S = (S + (D / (H * W) ) / 2);
    }

    v1.getNextFrame();
    v2.getNextFrame();
    F++;
}

Eventually S should have a value that represents the average difference of all pixels between the two video files. Right?

  • 1
    Are you trying to define a metric which evaluates the encoding quality? Have you heard of PSNR, SSIM and so on? – damjeux Dec 18 '15 at 13:58
  • Use ffmpeg to convert you files to YCbCr 4:2:0 and then compare that using PSNR, SSIM etc (wikipedia is your friend) – Fredrik Pihl Jan 12 '16 at 07:29

0 Answers0