Needless to say it was exciting for us as well. When we heard of the automation scenario to compare source and destination video files, it was quite interesting as videos are moving visual media which varies in resolution and various other factors. The objective of the automation scenario is to find any jitters in the videos and to ensure the quality of the destination video is same as the source video.
What videos are under discussion? What should be its characteristics?
Keeping these questions in mind, we assumed videos are nothing but an illusion of moving still images and started exploring it. Below are characterises of videos to be understood, before knowing the solution.
Videos are determined by:
- The number of frames shown per second. These frames are nothing but the still pictures per unit time of actual video. The frame rate is importantly achieved to make an illusion of moving image.
- Next comes the aspect ratio that talks about the dimension of moving picture elements
- The world of color, color space and bit ratio that becomes the aesthetic characteristic of videostalks about the number of bits per pixel in the images and number of distinct colors a pixel can represent in images.
- Finally on quality of videos, an important characteristic of video is determined by understanding the distortion that gets introduced while playing videos. It negatively impacts the user perception of the system if there is distortion in videos.
Aren’t we right with our assumptions? Yes we are. So now our job becomes easier to derive the solution. We derived two techniques to compare source and destination videos that apply to any automation tool and any scripting language:
Binary File Technique: The concept of converting video files into machine readable languages is called binary file technique. Any file in the system can be converted as binary files and those binary files can be compared to understand the similarities of both source and destination video files. Below steps provide clarity of implementing this technique:
- Read Source video file as binary file and store it.
- Read destination video file also as binary file and store it.
- We have now two binary files for comparison, compare each byte in both source and destination files
- Any difference is marked while comparing these binary files.
- Cumulative differences indicate the presence of jitters in the destination video file with its position.
Any technique that evolves has pros and cons and the same applies here as well:
- It has good accuracy and consistent results as it compares each and every byte at both source and destination.
- It consumes extra time by 50-75% (based on video size) more than the length of the video as it compares every byte.
Image Sampling Technique
Having discussed videos to be the illusion of moving still images, taking those still images at regular intervals is called Image sampling technique. Capturing the images at both source and destination videos with same regular interval for comparison would help to spot any difference among both the files. Given below are steps in detail to implement this technique:
- Input the sampling second, consider ‘5’ as sampling second here.
- Capture image at the source video file at the interval of multiples of sampling second i.e., capture images at 5th, 10th, 15th, (multiples of 5) seconds.
- Store those images by naming with its index.
- Capture image at the destination video file with same technique of source video file and store those images in the same way
- Compare both the images at every index of both source and video to understand if any jitters are introduced.
The pros and cons of this technique are:
- It consumes less time to compare the video files.
- It has less accuracy with inconsistent results as performance of this technique depends on various attributes and also video needs to be played several times.
The technique which is to be adopted is purely based on the objective of leveraging the automation scenario.
- Why You Must Adopt Automation Testing For Mobile Apps - August 30, 2017
- Leverage Test Automation to compare downloaded video files - August 3, 2016
- Know Your Cost of Quality - July 29, 2016