I have a collection of mp4 videos on my Linux server.
They are children’s recorded programs and own video footage etc.
They can be played in any web browser by navigating to the base page and clicking a link to the listed video.
But this plays the video on my computer or phone or similar…
I would like to be able to access these video files on a TV through OSMC/Kodi media center (Raspberry Pi) to get a larger image.
Is this possible? I have searched for a solution but not found any suitable…
I can modify the storage on my website if needed or create some special link files on the Kodi disk if that would be possible.
Any ideas?
(What I don’t want to do is to duplicate the video store from my Linux server onto each of my OSMC media centers. That would work but is wasteful of space and also problematic with limited data bandwidth.)
Is the server on your LAN? Just share the folder with NFS.
Is the server on your LAN? Just share the folder with NFS.
No, the server is on the Internet and the places I have the media centers are on my summer home, my daughter’s home and my own home. I want to access the files over the internet.
It is a regular Apache webserver and requires login to view the content.
Unfortunately Kodi is very picky about the format of the page with the listing of files to play on an http server.
I too have tried adding some servers that I can see in web browsers fine but not in Kodi. The servers simply don’t use regular apache listings but custom ones.
If you’re sure the apache webserver is using the default listing, then add the servers as http/https web server network locations using http(s)://[user]:[pass]@ip
and they should work fine.
Check out the suggestion from @TheHacker66 alternatively you could also enable webdav on apache that could help your cause.
This is the use case where a VPN fits 100% better than a Apache Server
Do you mean that the OSMC units should have a VPN plugin to Kodi, which connects to the network where the video server is located and then use network file sharing to access the video files?
That would be my recommendation as it should be the safest and easiest way to operate that.
You basically can configure OpenVPN on the Vero to automatically connect to the VPN Server so your individual OSMC box acts exactly the same where ever your bring it.
OK, but that would mean that each OSMC box (they are Raspberry Pi 2 and 3 units by the way) must have a VPN connection active to the Linux server…
I have just tested an alternate “solution” for playing content via the webserver:
- On the OSMC I created a strm file named after the video to play
- In this file I have https://user:password@video.mydomainname.com/subfolder/videoname.mp4
- Now in Kodi I can navigate to the folder containing the strm file videoname.strm and select it
- And now the video plays after a delay with the animated OSMC symbol showing (probably during buffering)
Of course the strm files will have to reside on the Linux server since that is where the videos are located and maintained.
If I have a website folder containing strm files is there any way Kodi can be made to navigate these to select them (without using VPN)?
Otherwise I need to find some way to duplicate the strm folder to the OSMC boxes…
With ssh, which you probably setup to get scp, sftp, rsync working, you can also create a SOCKS proxy to allow TCP access through a tunnel to other locations. This can be scripted.
I prefer to use Chromium-browser because it supports command line options to set a proxy server, unlike firefox which demands we setup a different profile for with and without proxy setup.
The VPN is good when ssh tunnels aren’t possible.
Please be very careful putting content on the internet without using outside encryption. HTTPS alone isn’t sufficient security. There are so many ways for people to get around that for an attacker with a committed desire.
client —> VPN —> remote system
client —> SSH SOCKS Proxy —> remote system
client —> sshfs —> remote system
sshfs is really easy to connect. Is it an end-user mount, but suffers from poor performance. It is worth a try, but don’t expect a miracle. I use it only when I need to process data on a different system, but the tools necessary to do that processing are complex to setup and I already have them working on another box.
mkdir ~/hadar-storage
sshfs hadar:/path/to/directory ~/hadar-storage
The SOCKS proxy is easy to setup between 2 Unix systems. It is just ssh with a tunnel and some detail tracking.
#!/bin/bash
PORT=64001
SSH_SRV=remote.example.com
# Only start SOCKS proxy if necessary
if [ $(/bin/ps -eaf |/bin/grep ssh |/bin/grep -c $PORT ) = 0 ] ; then
# Setup SOCKS proxy through home server
echo "Starting ssh SOCKS Proxy"
/usr/bin/ssh -f -C -D $PORT $SSH_SRV -NT &
fi
# Star private firejail with chromium, going through
# just setup SOCKS proxy
sleep 3;
echo "Starting Firejail chromium with private & proxy "
export http_proxy="socks5://localhost:$PORT ";
/usr/bin/firejail --private chromium-browser \
--proxy-server="socks5://localhost:$PORT " &
exit;
I like to use firejail for untrusted web browsing.
For other devices, say a phone, then a VPN is much easier to use, but harder to setup. Wireguard is the easiest VPN to setup today.
Or if you want to be really nerdy, there is NFSv4 with Kerberos and encrypted tunnels. There are a few guides for doing this. It is server-to-server Kerberos ticket-based authentication with strong encryption. I’ve never set this up, though I use NFSv4 all the time, just not over the internet.
Lots of options. I have no idea whether OSMC/Kodi knows anything about these. Doubtful. These are normal Unix techniques and they will work on Raspberry Pis. ssh into the 2 systems and get typing.
If you don’t want to integrate into the Kodi library it should be relatively simple
Setup up apache to create directory listings. Something like:
<Directory /usr/local/apache2/htdocs/XXXX>
Options +Indexes
</Directory>
Configure new Video Source in Kodi. Select Add network location and specify Protocol ‘Web server directory’. Fill in the relevant details of the base directory.
Important note: Kodi only reads HTML output of directory listings made by Apache, Nginx and a few other webservers. It won’t be able to read custom HTML format.
Leave the content set as ‘None’ (i.e. don’t integrate into library).
Once done, you can click on the new video source and it will show all the video files in that directory.
If you do want to integrate into the kodi library you may need to add additional .nfo files to help Kodi index the metadata. This will take more work. See Kodi Wiki
Would something like Plex be helpful here?
I have scripted the creation of the strm files on the server.
Then I have used manual file system access (VPN from Windows) to retrieve them and put them onto the two OSMC boxes at my current location.
This makes them visible and playable on these OSMC devices.
But it is only a temp workaround because the new video content that is constantly created on the server and saved as strm files too is not accessible until I do the manual intervention…
Have you tried any of the other suggestions above?
If you using Apache in std configuration you don’t need to setup strm files.
No, I don’t want to reconfigure my Apache server…
It is set up to prohibit all dir listings etc and it requires login to reach the video store. And there is a php script that renders a selection webpage for each video directory. The selection invokes a video player loaded with the selected video. What I have done is to create the strm files and these are not browse-able, but if I download them behind the scenes and put them into Kodi, then the videos can be played.
So I have to create a server side php script that can send a complete list of strm files and then use wget or similar to retrieve it on OSMC.
I haven’t done that before, though.
I ended up writing scripts to:
- Create the strm files on the server by scanning the video folders according to my wish and putting the strm files in a stream folder. It also uses tar to make a tgz file containing all of the strm files.
- On the client OSMC boxes I wrote a script that uses wget to retrieve the tgz file and expand it in my “streams” folder.
This works well manually so I have added on the server a call to this script in the scripts used to retrieve videos to do it automatically when a new video is retrieved.
But on the OSMC box I could not use “at” to schedule running the retrieve script because apparently on OSMC the “at” command is not available…
How could I install at on the OSMC? Googling does not find anything, probably because “at” is such a common word…
All of my Raspberry Pi boxes running Raspbian and Pi-OS as well as my Ubuntu boxes include “at” in the operating system…
A command to install “at” would be welcome for OSMC (or better yet: include “at” in the standard distribution).
EDIT
Found it:
sudo apt update
sudo apt install at
I see you already found the at package but to clarify things, OSMC uses the Debian operating system. As such, if it’s on Debian, you can (usually) install it on OSMC. If you’re unsure of the package name, you can usually find it from https://packages.debian.org
I checked a Pi ZeroW I have running RaspiOS Lite. Nope, it’s not there, as standard.
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17+ #1421 Thu May 27 13:58:02 BST 2021 armv6l GNU/Linux
pi@raspberrypi:~ $ which at
pi@raspberrypi:~ $ dpkg -l at
dpkg-query: no packages found matching at
I have now installed cron on OSMC so I could set it to run the script that downloads a strm files tarball and expands it into the streams dir on my media disk at an hourly schedule.
On the server that tarball is created every time it finishes downloading a video so in effect the OSMC box is about 10 minutes later updated with the most current video content.
Concerning the at command non-existence I am probably wrong, but I can’t remember having to install it.
In any case cron was not present on my OSMC box either.