I'm having a problem viewing a mp4 file with Google Chrome using HTML5 video tag. The video starts playing just fine and jumping to different position on the timeline also works just fine.
However, I get ERR_CONTENT_LENGTH_MISMATCH
error, if I keep watching the video long enough. I noticed that this happens almost every time exactly when the browser has downloaded 124MB (only once at 252MB) of the video. It doesn't matter do I watch the video from the very beginning or do I jump to somewhere on the timeline and start watching, it stops at 124MB. It also doesn't seem to matter what video file I'm using.
The HTML I'm using is quite basic:
<video width="1280" height="720" controls>
<source src="videos/testvid.mp4" type="video/mp4">
</video>
ERR_CONTENT_LENGTH_MISMATCH appears each time the browser gets from a file more bytes than the reported on Content-Length HTTP response header
There is a few bugs about apache and big files regarding deflating (gzip) and Content-Length header.
We've set up Apache to deflate most web content it serves with gzip, to make file transmission faster with smaller file sizes. This is great for HTML files, CSS and JS files, but for binary files, such as images and media files, or PDFs it can cause problems. For PDFs the problems are that Acrobat can't read PDFs that have been gzipped, so it must be turned off for them.
Source: http://www.beetlebrow.co.uk/what-do-you-need/help-and-documentation/unix-tricks-and-information/apache-gzip-compression-and-binary-files
<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:mp3|wav|wma|au|m4p|snd|mid|wmv|mpg|mpeg|mp4|qt|mov)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|gz2|sit|rar)$ no-gzip dont-vary
</Location>
The solution is to disable compression for certain file types (e.g *.mp4), using rules like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With