Recording video streams from Kodi

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
paulbraun
Level 1
Level 1
Posts: 40
Joined: Wed Apr 05, 2017 9:33 am

Recording video streams from Kodi

Post by paulbraun »

I bought a copy of Web User magazine (UK) because it had details of how to record video streams which have no option to download. Part of this article is on http://www.pressreader.com/uk/web-user/ ... 1602966919

Unfortunately, their advice for how to do this within Kodi only applies to the Windows version. Users have to download a script, which I’ve posted below. The script has to be copied into Kodi’s userdata folder, which I’ve done. It includes the location and filename of VLC Media Player. I’ve tried changing this for my Linux Mint 18 KDE installation, but after a few hours working on this, VLC Media Player still won’t launch from inside Kodi, only the default internal player works. An alternative would be for me to copy the URLs for these videos into Kodi, as with YouTube videos, but I can’t see any signs of any URLs for any videos within Kodi. Some videos played by the video add ons are on websites with accompanying URLs, while others may be just streamed from somewhere on the Internet, but not on a website at all.

I hope someone can tell me what changes I need to make to this file to launch VLC from inside Kodi.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
# Goes inside %APPDATA%\kodi\userdata
-->
<playercorefactory>
<players>
<player name="VLC" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Program Files\VideoLAN\VLC\vlc.exe</filename>
<hidexbmc>true</hidexbmc>
<hideconsole>true</hideconsole>
<warpcursor>none</warpcursor>
</player>
<player name="Media Player Classic" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Program Files\MPC-HC\mpc-hc64.exe</filename>
<hidexbmc>true</hidexbmc>
<hideconsole>true</hideconsole>
<warpcursor>none</warpcursor>
</player>
</players>
<rules action="prepend">
   <rule filetypes="avi|mkv|mp4|m4v|mpg|mpeg" player="VLC" />
<!--
   <rule filetypes="avi|mkv|mp4|m4v|mpg|mpeg" player="Media Player Classic" />
-->
</rules>
</playercorefactory>

User avatar
Flemur
Level 20
Level 20
Posts: 10115
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Recording video streams from Kodi

Post by Flemur »

Linux executables aren't name "whatever.exe", just "whatever".
Linux paths are /, windows are \. See the /usr/bin/vlc below
Linux has no C:, etc.
So I just changed the part for vlc in your file, and removed the "Media Player" part.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
# Goes inside %APPDATA%\kodi\userdata
-->
<playercorefactory>
<players>
<player name="VLC" type="ExternalPlayer" audio="false" video="true">
<filename>/usr/bin/vlc</filename>
<hidexbmc>true</hidexbmc>
<hideconsole>true</hideconsole>
<warpcursor>none</warpcursor>
</player>
</players>
<rules action="prepend">
   <rule filetypes="avi|mkv|mp4|m4v|mpg|mpeg" player="VLC" />
<!--
   <rule filetypes="avi|mkv|mp4|m4v|mpg|mpeg" player="Media Player Classic" />
-->
</rules>
</playercorefactory>
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
phd21
Level 20
Level 20
Posts: 10110
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Recording video streams from Kodi

Post by phd21 »

Hi "paulbraun",

I just read your post and the good replies to it. Here are my thoughts on this as well.

1.) Kodi (xbmc) has PVRs/DVRs personal video recorders, digital video recorders, for this...

PVR recording software
http://kodi.wiki/view/PVR_recording_software

Live TV and PVR/DVR Setup Guide
http://kodi.wiki/view/PVR

2.) Another option: kodi playercorefactory.xml players to play and record videos and bash scripts, read link below.
https://github.com/NapoleonWils0n/kodi- ... orefactory

Note: LM18.x users: ffmpeg is already installed, and users could install ffmpeg v3 using a different ppa in link below rather than in this Kodi addon link above.
http://tipsonubuntu.com/2016/11/02/inst ... ntu-16-04/

Code: Select all

sudo apt-get install software-properties-common
reboot afterwards before starting Kodi

Hope this helps ...
Phd21: Mint 20 Cinnamon & xKDE (Mint Xfce + Kubuntu KDE) & KDE Neon 64-bit (new based on Ubuntu 20.04) Awesome OS's, Dell Inspiron I5 7000 (7573) 2 in 1 touch screen, Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, Intel 4 Graphics.
paulbraun
Level 1
Level 1
Posts: 40
Joined: Wed Apr 05, 2017 9:33 am

Re: Recording video streams from Kodi

Post by paulbraun »

Thanks Flemur for your advice. I copied your edited version of the file into the userdata folder. This enabled me to play back streams in VLC. First of all I tried a stream from the video add on "RTLxl" , but although VLC opened, the stream displayed a similar effect to BBC iPlayer videos, meaning that it wouldn't play, then a dialogue box appeared asking me to delete or close. I also tried playing in VLC from a stream in the add on "Video Mediaset", which actually started playing in VLC, but unfortunately I couldn't find any way of saving it. There was no URL I could find for this video, then I found the URL for the previous RTL video within VLC. I found a menu saying something like save/convert, but I didn't know how to tell it what to save or convert. I could probably find this video with a URL on www.mediaset.it and save it from there in VLC by using Open Network Stream, but that wouldn't teach me how to save any videos not available on websites. I plan to have a look round VLC to try and find an option to save and how to tell it what I want to save.
paulbraun
Level 1
Level 1
Posts: 40
Joined: Wed Apr 05, 2017 9:33 am

Re: Recording video streams from Kodi

Post by paulbraun »

Hello phd21. I'm afraid my computer has no hardware installed to receive live TV. I'm just trying to record streams of videos and channels not available where I live, except via satellite. I have no satellite dish installed at the moment.

The file I posted above is actually a playercorefactory file. I'd never heard of them before reading this magazine. Unfortunately, there are lots of these files listed on that site, so I don't know which one to use.
ugly
Level 5
Level 5
Posts: 544
Joined: Thu Nov 24, 2016 9:17 pm

Re: Recording video streams from Kodi

Post by ugly »

I did this a while ago and got it to work. But I don't think it works particularly well.

I figured it out with the help of this video tutorial: https://www.youtube.com/watch?v=JwSRKiVuqZg

I think one of the issues is that if you want to use VLC or any external program to record from Kodi, the programs expect a normal URL. But a lot of streams from Kodi have a user agent string that the external program can't handle.

I don't do it very often, but I found the best way to record a video stream from Kodi was to only use the option to write the URL to a text file (the YouTube video I linked should show you how to do it, it's one of the many options shown in the playercore file). Then open the text file, copy the URL so you don't have the extra user agent information, and then just use an external program like aria2 to download the file using the URL you copied. It's far from a perfect solution, but it's the only one that I've managed to get working with any reliability.
User avatar
phd21
Level 20
Level 20
Posts: 10110
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Recording video streams from Kodi

Post by phd21 »

Hi "paulbraun",

I am not that familiar with Kodi as my ancient underpowered computer cannot run it well. So far, the tests that I have been trying regarding this have caused Kodi to crash on my system.

Perhaps others can help regarding the "playercorefactory" stuff...

As was already stated there are many ways to download YouTube videos, and other videos from other websites, which can then be added to your Kodi player folders.

Good luck and keep us posted...
Phd21: Mint 20 Cinnamon & xKDE (Mint Xfce + Kubuntu KDE) & KDE Neon 64-bit (new based on Ubuntu 20.04) Awesome OS's, Dell Inspiron I5 7000 (7573) 2 in 1 touch screen, Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, Intel 4 Graphics.
paulbraun
Level 1
Level 1
Posts: 40
Joined: Wed Apr 05, 2017 9:33 am

Re: Recording video streams from Kodi

Post by paulbraun »

Thanks for all this information "ugly".

I've just watched the video you suggested and I plan to try those things in the near future. It seems to be the first in a series, so I plan to watch the other videos as well. It seems that I may be able to deal with videos in the add on "RTL.xl", as well as on BBC iPlayer using rtmpe. I'm glad to read that it's a "user agent string" which a lot of Kodi videos have and how to deal with this.
paulbraun
Level 1
Level 1
Posts: 40
Joined: Wed Apr 05, 2017 9:33 am

Re: Recording video streams from Kodi

Post by paulbraun »

Thanks phd21.

What are the specs of your computer?

I have been able to download YouTube videos for a few months now, using a tip from the German magazine "Linux Welt XXL". I think this magazine was dated "02/17". I haven't got this magazine in front of me at the moment, but their method was to get the URL of any YouTube video from within a browser, then copy this URL into VLC and use "Open Network Stream". Obviously, this doesn't work if you can't get a URL, or if the video is encrypted. Read on for an amazing discovery I've recently made about getting access to current and recent magazines, including "Linux Welt XXL".

The latest thing I've done, based on the advice given earlier on in this topic is to try and record some streams from within video add ons. I was able to play videos in VLC, then right click and select Record, later on selecting Stop, when the video got to the end. Unfortunately, as in the video recommended by "ugly" above, I had no opportunity to input a filename. I then found it very difficult, or sometimes impossible to find the recordings I'd made. I can't find any at the moment. From what I remember, these recordings all had the file extension ".crdownload", meaning that they didn't look like video files, the icons looked like archives, and Linux couldn't decide how to open them. I think I had to delete the ".crdownload" extension to get one or two of them to play. At the moment, I can only find a recording from VLC of a few seconds of credits and music from the TV series "Vinyl". I don't remember recording this from VLC at all! The filename starts with "vlc-record-" followed by a date, the name Vinyl and ettv later on, then ends in .mp4.mp4.

Finally, I've recently made an amazing discovery which you could call Spotify or Amazon for magazines. This overcomes censorship of magazines according to what language they're in. There's a site called www.readly.com which seems to allow users to read current and recent back issues of magazines from around the World for a monthly subscription, instead of buying the individual magazines. Subscriptions are €9.99 per month and there's a two week free trial. Users can click the flag in the top right hand corner to select a country they want to read magazines from. So far, I've just been looking at magazine covers from Germany and the Netherlands, where I visited in January and February, but only bought a few German magazines while there. Going into newsagents there was like an Aladdin's cave for me, with something to cover every interest. I was spoilt for choice. Nearly all the magazines available on this site for Germany are in German, with just a few English language magazines. I also looked on the section for the Netherlands, where I found a mixture of Dutch, German, English, and Scandinavian language magazines. I think this service is potentially amazing, because it can override the language censorship where only languages in the local language are available because "most people can't understand it", "there's not enough demand", etc, etc. If these magazines were actually available, then I think lots of people who didn't understand much of the languages they're in would have had bought them, because some of these magazines contain knowledge not otherwise available. A few magazines have different language editions, but most don't. The names of these from this site, are "Closer", "Reader's Digest", "Classic Rock", "Retro Gamer", "Women's Health", "Men's Health", "Cosmopolitan", "Tattoo", and "MagPi". These all seem to be by local publishers and may have different content from the magazines with the same names published elsewhere. Other magazines may have slightly different names, but be local versions of the magazines published elsewhere. I think I'm going to have a lot of fun with this site, although before I had to be satisfied with whatever crumbs were available in London, or actually make a trip onto the Continent just to buy any.
ugly
Level 5
Level 5
Posts: 544
Joined: Thu Nov 24, 2016 9:17 pm

Re: Recording video streams from Kodi

Post by ugly »

Maybe it will help if I post my playercore.xml file:

Code: Select all

<playercorefactory>
 <players>
  <player name="save-url" type="ExternalPlayer" audio="false" video="true">
	<filename>/bin/echo</filename>
     <args>"{0}" > "/home/user/Downloads/video-url-$(date +"%H-%M-%m-%d-%y").txt" &</args>
     <hidexbmc>false</hidexbmc>
   </player>
  <player name="ffmpeg-save" type="ExternalPlayer" audio="false" video="true">
	<filename>/usr/bin/ffmpeg</filename>
     <args>-i "{0}" > -vcodec copy -acodec copy "/home/user/Downloads/video-$(date +"%H-%M-%m-%d-%y").mkv" &</args>
     <hidexbmc>false</hidexbmc>
   </player>   
 </players>
 <rules action="append">
   <rule protocols="nfs|smb" player="dvdplayer"></rule>
   <rule name="rtmp" protocols="rtmp" player="save-url" ></rule>
   <rule video="true" internetstream="true" player="dvdplayer"></rule>
   <!-- change the default player below -->

   <!-- uncomment to make mpv the default player
   <rule video="true" player="mpv"></rule>
    -->

   <!-- uncomment to make play the default player
   <rule video="true" player="play"></rule>
    -->

   <!-- uncomment to make vlc the default player
   <rule video="true" player="vlc"></rule>
    -->

   <!-- uncomment to make record the default player
   <rule video="true" player="record"></rule>
    -->

  <!-- uncomment to make ssh record the default player
   <rule video="true" player="ssh record"></rule>
    -->

   <!-- uncomment to make external player the default player
   <rule video="true" player="external player"></rule>
    -->

   <!-- uncomment to make stream the default player
   <rule video="true" player="stream"></rule>
    -->

 </rules>
</playercorefactory>
Simply change 'user' in args pathname to your own username (or change the pathname entirely to whatever you want).

The only one I really use is the 'save-url'. This gives me a text file with the video URL. I then paste that URL (minus the user agent string) into an external downloader like aria2. It's doesn't work for everything, but it has worked for me sometimes. It's not something I do often, so I didn't bother to spend a lot of time on it to find a perfect solution.
Post Reply

Return to “Software & Applications”