Auto Video Editor

Project Details

Platform:

-PC

Engine/Language:

-C++

Project:

-Individual project

-Personal

GitHub Link:

About

Auto Video Editor

Auto Video Editor is a small application with the purpose of removing frames which have a big difference between them such as when the camera is being panned around quickly.

Challenges

The main challenge which came with this project was using a new 3rd party library, ffmpeg. This was because I have never used this library, or any image/video processing library with C++ before. It was an enjoyable challenge to overcome. I learnt about the library by reading through the example code which was provided which contained all the relevant steps I wanted for this project.

Frame compare

for (int y = 0; y < m_decCtx->height; y += prec)
	{
		for (int x = 0; x < rgbWidth; x += precWidth)
		{
			uint8_t r = tempFrame->data[0][y * tempFrame->linesize[0] + x];
			uint8_t g = tempFrame->data[0][y * tempFrame->linesize[0] + x + 1];
			uint8_t b = tempFrame->data[0][y * tempFrame->linesize[0] + x + 2];

			rD += r / (double)255;
			gD += g / (double)255;
			bD += b / (double)255;
		}
	}

    // Normalise the red, green and blue values of the whole frame by the number of samplers taken.
	rD /= numSamples;
	gD /= numSamples;
	bD /= numSamples;

	if (a_compare)
	{
        // Get the difference between this frame and last frame.
		double rDiff = abs(rD - m_oldR);
		double gDiff = abs(gD - m_oldG);
		double bDiff = abs(bD - m_oldB);
		double diff = (rDiff + gDiff + bDiff) / 3;

		if (diff < m_minDiff)
		{
			m_minDiff = diff;
		}
		else if (diff > m_maxDiff)
		{
			m_maxDiff = diff;
		}

		m_avgDiff += diff;

		if (diff > m_frameCompare)
		{
			result = true;
		}
	}
Shown above is a code snippet of how two frames are compared. This will return a single double value which is then checked to see if it meets a threshold. If the different value is greater than the threshold then the frame is discarded.

If you have any question or suggests about this project or any other project please do not hesitate to contract me. This is an area in which I would like to learn more in.

About

Programmer who has worked at Sumo Digital Nottingham/Leaminton, Playground Games and Unity.