Apache - Streaming HTML5 video without making a webpage for each video

12,672

The Playstation 4 will play a HTML5 video if it's in the correct format, as you noticed above.

The specs for MP4 are:

Video: H.264/MPEG-4 AVC High Profile Level4.2
Audio: AAC LC, AC-3 (Dolby Digital)

In addition you'll have to make sure the moov atom is at the start of the file to be able to start the playback immediately

With Apache you can do redirects. Eg. http://example.com/play/video_id can be redirected to a scripted page that uses the video ID to generate a HTML5 player on the fly.

If you want to avoid creating a script (eg: PHP) that generates the HTML page dynamically based on the MP4 files in a directory the alternative is to use an open-source media server.

An example is the Plex Media Server. It has a Linux version and there are articles on how to stream to PS4. There's also RasPlex and OSMC and others if you fail to install Plex on Raspberry Pi.

As a bonus you get a nice interface.

Share:
12,672
Rontron
Author by

Rontron

Updated on June 04, 2022

Comments

  • Rontron
    Rontron about 2 years

    I have an Apache 2.2.22 webserver running on Raspbian (RasPi Debian). I have .mp4 files in a folder that I can stream flawlessly to my web browser locally or over the internet.

    My Playstation 4, however, won't take a link to a file and stream it; It needs an HTML player to stream the video. I don't want to create a player for every video. I can't make a player where you type the video name and hit play, because the names are too long and there are too many of them.

    I don't know any way to get passed this without having to create an HTML page for every video, or at least an HTML page that includes every video.

    EDIT:

    I noticed when I viewed the source of a video in Google Chrome, this came up:

    <html>
    <head>
    <meta name="viewport" content="width=device-width">
    <style type="text/css">
    </style>
    </head>
    <body>
    <video controls="" autoplay="" name="media">
    <source src="http://10.0.0.21/media/blahblahblah.mp4" type="video/mp4">
    </video>
    </body>
    </html>
    

    Is there a way to force the Playstation (or any browser?) to use this? Instead of the browser (google chrome) automatically applying this HTML to the MP4 video?