The quality of encoded video is mainly affected by three characteristics. These are as follows:
Video bitrate - the number of bits per second the video is encoded at.
Video frame size - the actual size of the video in pixels.
Key frame rate - how compressed the video is in terms of how often a key frame (a video frame with all of the pixels) is displayed between compressed reference frames.
Bitrate to Frame Size Relationship
The relationship between the bitrate and the frame size are inversely related. This means that for any given bit rate, the quality will go down as the resolution goes up, and vice versa. Likewise, for any given resolution, the quality will go up as the bit rate goes up. Generally speaking, the more motion there is in the video, the higher the bitrate needs to be to accommodate all the changing pixels in faster motion. At the same time, higher bitrates in live streams will use more bandwidth to deliver to viewers and may cause problems for viewers to watch on slower network connections. Encoding videos for on-demand viewing at higher bitrates will also increase the file size of the videos thereby using more space on the server or computer's hard drive which, in turn, reduces the number of videos that can be stored for on-demand viewing. For these reasons, the rule of thumb should be to encode the video at the lowest possible bitrate and frame size the produces the quality that is acceptable and best meets the expectations of viewers.
When viewers watch video in a webpage, they are watching it in a player which itself can have its size defined by the webpage code. Changing this size, however, will not change the actual resolution of the video. If a video is encoded at 1280x720, for example, setting the size of the player in the page to a different size than the video will change how big the video is in the page, but the video itself will still be 1280x720, which means there will still be 1280 pixels across the width of the video and 720 pixels from top to bottom. The player will either expand or reduce the size of the pixels to display in the size set for the player. Expanding the player size larger than the actual video will therefore reduce the quality of the image, as each pixel is enlarged providing less detail, and shrinking the video may then do the opposite and improve the quality of the image. Generally, it is best practice to never set the player size to larger than the video for this reason. Also, if the size of the player is set to a different aspect ratio (the ratio of height to width), the player code will determine whether the video will either stay at its original aspect ratio and either cut off portions of the video or stretch the video image to fill the screen or maintain the aspect ratio and fill the excess space with black bars.
For the same reason, when encoding video, it is best practice to never encode the video at a higher resolution than the source being encoded. For example, if the source is a standard definition camera (which in typically 720x480 resolution), then encoding the video at 1280x720 will not only reduce the quality of the video image by expanding the size of each pixel, but it would also change the aspect ratio of the image thereby distorting it by stretching it.