Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Cannot access (download?) to view .mp4 video files.

  • When I attempt to access (presumably to download) an .mp4 video Opera displays screensful of random ASCII characters. As a guess Opera is trying to utilise Windows Media Player. Is there a setting I can make to assist Opera? Windows Media Player as a plugin/addon perhaps?

  • Opera should be able to play a MP4 file, depending on the codec it uses. If it is displaying some weird characters then there is a chance that the site is sending wrong info to Opera.

    Right click on the link, save the file and try to open it in Opera to see if it plays.

    What's your version of Opera, OS and link to the file?

  • @leocg Thank you for your response; it is much appreciated 😄

    (And I have not seen such a comprehensive collection of Emoji. Quite incredible!)

    These two screenshots seem to illustrate what I'm seeing:

    link text

    And version information and OS:

    link text

    The link to the file is:

    link text

    In the past I've used 'MSI Web Video' to produce shockwave flash (.swf) files that rendered okay in Opera. See, for example:

    link text

    Eric Carwardine alias Randomist

  • @leocg The direct link to the file didn't post correctly. It should be:

    link text

    Eric alias Randomist

  • I've downloaded the video and played it in Opera without any problems. It means that the problem is probably on the page itself, maybe the wrong mime type is being sent to Opera.

    BTW, the same problem happens on Edge and Firefox tries to download the file instead of trying to play it.

  • @leocg Streaming video is a complex topic. Simply uploading an .mp4 (or an .avi) file to a website is not sufficient. I'll need to look further.

  • @leocg said in Cannot access (download?) to view .mp4 video files.:

    It means that the problem is probably on the page itself, maybe the wrong mime type is being sent to Opera.

    So what one would do with that?
    I also have that trouble with mime type with some hosts sometimes. Not usually recently, but still. When it happens, the download extension does catch the file to download.

  • If the is on some hosting site you may be stuck with what you have. You can always save the link to a file and view it in an external program (I just did - it's a video of a cat).

  • Close all tabs in Opera so there's only the start page. Ctrl + shift + i to load developer tools. Switch to the Network tab, check "disable cache" and make sure "all" (in this particular case) for the filter. Then, paste the link in the address field and press enter.

    You'll then see a request/repsponse connection being logged. Left-click it and click the "Headers" tab. What you will see is:

    Content-Type: text/plain
    

    That's the reason for the problem as suggested previously.

    Now, browsers could try to sniff the content, figure out that it's actually an mp4 and play it etc. But, the site also sends:

    X-Content-Type-Options: nosniff
    

    that tells the browser not to do that and to treat it as text/plain just like the site says.

    An extension that allows you to modify the content-type in response headers for files with mp4 extensions in the http://www.randomvoting.com/videos/ directory to video/mp4 (with perhaps removing the no-sniff header too) might help if you can't get the site to fix it.

  • Create a folder named "Fix MP4 Type".

    In it, put these files:

    manifest.json:

    {
        "background": {
            "scripts": ["background.js"]
        },
        "incognito" : "spanning",
        "description": "Fix MP4 Type on randomvoting.com", 
        "browser_action": {
            
        },
        "manifest_version": 2, 
        "name": "Fix MP4 Type on randomvoting.com", 
        "permissions": [
            "webRequest", 
            "webRequestBlocking", 
            "http://www.randomvoting.com/videos/*.mp4"
        ],
        "version": "0.1"
    }
    

    background.js:

    chrome.webRequest.onHeadersReceived.addListener(function(details) {
        var headers = details.responseHeaders;
        for (var i = 0; i < headers.length; ++i) {
            if (headers[i].name === "Content-Type") {
                headers[i].value = "video/mp4"
                break;
            }
        }
        return {responseHeaders: headers};
    }, {urls: ['http://www.randomvoting.com/videos/*.mp4']}, ['responseHeaders', 'blocking']);
    

    Then, goto opera://extensions, switch to developer mode, click "load unpacked extension" and point it to the folder.

    Also, adjust opera://flags/#autoplay-policy how you want.

    Then, when navigating to http://www.randomvoting.com/videos/capstick_came_home.mp4, it should play inside Opera once enough of it is buffered. You can then use the download option on the video toolbar to download it if you want.

    Anyway, play with and tweak the extension to your liking.

  • @burnout426
    What is the difference between .js and .json extensions?
    Do you use the Notepad application for that? I used to learn HTML and created some files and saved as .html...🤔 😕

  • @joshl said in Cannot access (download?) to view .mp4 video files.:

    What is the difference between .js and .json extensions?

    .json is for specifying Javascript data objects. .js is for directly executable Javascript code. In this case, think of JSON like an ini file or a prefs file etc.

    @joshl said in Cannot access (download?) to view .mp4 video files.:

    Do you use the Notepad

    Yes. Notepad or any text editor is fine. Notepad++ is what I use in this case.

  • @burnout426, it only fixes stuff on that randomvoting or should one put some list of sites (or hosts?) instead of it there?

  • @joshl said in Cannot access (download?) to view .mp4 video files.:

    it only fixes stuff on that randomvoting

    Yes. You really need to do it on a case-by-case basis, as the fix for each problem site can be different.

    However, you can specify multiple match_patterns in permissions in the manifest file and in the urls array in the listener background.js to make the specific fix apply to more URLs.

    You could set "<all_urls>" in the manifest file and add multiple listeners (one for each site) in background.js where you can then do specific fixes per site.

  • Who's listeners?

  • @joshl I meant to add multiple chrome.webRequest.onHeadersReceived.addListener... in background.js. One for each site you want to handle.