Can I download video streams to disk in OSMC?

I often download children’s programs from play channels to use off-line when grandchildren visit.
They are downloaded as mp4 files using an application on Windows, which uses ffmpeg.
Since ffmpeg is also available on Linux I wonder if there is some way to directly download the streams from say an SSH command line session in OSMC?
Ideally it should also download the subtitle files if available.
I have a 1TB USB drive connected to my OSMC Pi2 as a media disk shared with Samba and it would be great if I could shortcut the Windows step to get the video on to the media disk.
Any suggestions?

I think only if the addon supports it (or if its a torrent addon, they usually have download options).
One addon that had download option, (the 4.8.5 version though not the current 5.0) is called…(cant say the name here, so i’ll describe it…it has the same name as the band that Phil Collins had in the 80’s). :stuck_out_tongue:
You can still install the 4.8.5 version…but eventually the links will get outdated and you also have to disable the autoupdate function from its Settings, otherwise it will update to version 5 and you’ll lose the download option.

I also posted over at the RaspberryPi forum and the advice I got there was to use youtube-dl.
However going forward on thta revealed lots of recent problems with it and also a completely different install method from what I have used previously…
Can youtube-dl be installed in OSMC and if so are there any detailed instructions specific for OSMC anywhere?

Its a command line tool so you need to ssh to your device to use it.

Instructions found here: Downloading Youtube Videos to your Raspberry Pi | REUK.co.uk

I went there and had a look at how to install.
First item I needed to do was:

sudo apt-get install youtube-dl

Inside that was this message:

Recommended packages: libav-tools ffmpeg mplayer2 mplayer rtmpdump The following NEW packages will be installed: youtube-dl ... Setting up youtube-dl (2014.08.05-1+deb8u1) ...

Of these I recognize ffmpeg so I tried to install it:

[code]osmc@osmc:~$ sudo apt-get install ffmpeg
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package ffmpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘ffmpeg’ has no installation candidate[/code]

This looks like a problem to me…
Also look at the date of youtube-dl, it is over a year old and by what I read the youtube-dl is updated at least weekly…

So reading further it states that I should run youtube-dl to get it to update itself:

osmc@osmc:~$ sudo youtube-dl -U It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.

What do I do now? It does not want to update itself…

hmm this is a tricky one…one solution would be to recompile it yourself. OwenAshurst.com
the other solution would be to wait for an OSMC representative to answer this thread cause maybe they know a way…

From this thread here: No ffmpeg available
i see that there is an alternative…but like i said…i am not sure…better wait for someone who knows this…worst case scenario you reinstall osmc…if you cant wait and want to ‘play’ with it :slight_smile:

I might add that I tested it anyway on a very short (5 min) Youtube video (Pingu) and it downloaded it, but it took probably about 20 minutes! Note that I am on a 100 Mbps fiber connection,
Also the mp4 file is 1.2 GB in size! That is way too large for a 5 min show.
When I tested it on a SVTPlay webpage containing also a 5 min Pingu show it failed:

osmc@osmc:/media/MEDIADRIVE/VIDEO/TST$ youtube-dl http://www.svtplay.se/video/313334/pingu/avsnitt-3 [generic] avsnitt-3: Requesting header WARNING: Falling back on generic information extractor. [generic] avsnitt-3: Downloading webpage [generic] avsnitt-3: Extracting information ERROR: Unsupported URL: http://www.svtplay.se/video/313334/pingu/avsnitt-3; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
As we know running it with the -U switch fails so it is a misguidance.

Try to install svtplay-dl instead (from the standard repository in OSMC).
Works like a charm on my Vero.

That worked, but it results in a TS file rather than mp4…
But this brought up another thought train and I remembered a thread in the RPi forum I created a year or so ago.
In this I was after about the same thing but using ffmpeg (I did not know at the time about youtube-dl or svtplay-dl).
So now I again tried to install ffmpeg in OSMC, but it failed miserably (I made a sudo apt-get update first):

osmc@osmc:/media/MEDIADRIVE/VIDEO/TST$ sudo apt-get install ffmpeg Reading package lists... Done Building dependency tree Reading state information... Done Package ffmpeg is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'ffmpeg' has no installation candidate
QUESTION:
Is there some way to install ffmpeg into OSMC?

OK - but what’s in the TS file (its just a packaging format)?
Derek

I think that a TS file contains the Transmission Stream data of the video.
As an example my Topfield PvRT records the TV programs off the air as TS files. They are basically just the streamed data from the broadcast over the air and probably most often in MPEG2 format. This results in rather big files, like 15 Mbytes per minute for a cartoon type show (Pingu).
MP4 would be at least smaller by 50%.
VLC on Windows can play TS files all right, but there are other players that have problems with that.
In my application I need the video to be as small as possible and therefore I want MP4 format. I can use Handbrake or something else (ffmpeg…) to re-encode as MP4, but that is an additional step that I would rather not use.
I will check the efficiency by downloading a larger program, which I have already downloaded using my PC (to MP4) and see how it looks.

By the way, I have found another OSMC thread about the download problems.
Apparently they favour avconv over ffmpeg and it is available with apt-get.
I installed it but I have not yet been able to figure out how to command it to download a stream to disk…

OK, now I got it and it turned out to be smaller than the file I got on my PC.
OTOH it also seems to be of inferior quality, I have to check up on that.
But for the time being this works:

svtplay-dl <URL to page holding the play button>

One has to be located in the directory where the download file will be written.

It seems like your original problem was not having ffmpeg. Here’s an easy way I found to install it.

Add the following line to your sources.list (I edited out the sources that will already be there.)

osmc@osmc:~$ cat /etc/apt/sources.list
deb http://www.deb-multimedia.org jessie main non-free

Then

sudo apt-get install deb-multimedia-keyring

Then

sudo apt-get update

You should then be able to install ffmpeg in the normal way.

sudo apt-get install ffmpeg

Please note that I’m getting most of this from memory, sorry if I’ve left something out. I found this information here.

Thanks, I tried the following:

osmc@osmc:~$ sudo nano /etc/apt/sources.list osmc@osmc:~$ sudo apt-get install deb-multimedia-keyring Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package deb-multimedia-keyring osmc@osmc:~$
Inside nano I added your source line at the bottom so it now reads:

deb http://ftp.debian.org/debian jessie main contrib non-free deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free deb http://security.debian.org/ jessie/updates main contrib non-free deb http://apt.osmc.tv jessie main deb http://www.deb-multimedia.org jessie main non-free
Seems like the keyring step does not work properly…
Should the new source be listed in another place in the sources list?
Or am I supposed to completely replace the sources in the original list with that single line?
In that case would not apt-get be broken for all other purposes?
The page you linked to says:

Isn’t that dangerous if one needs to use apt-get in the future too?

The page is saying to replace the old repository with the new one as the repo moved. As you don’t have the old repo you just need to add it to the bottom of your existing sources.lst, do NOT change any other lines. To add the key I quote this from the linked page:

06/02/2015 :

Maybe I went too quickly to my new GPG key.

If apt-get don’t find the new key, do that :

wget http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2015.6.1_all.deb

sudo dpkg -i deb-multimedia-keyring_2015.6.1_all.deb

apt-get update

apt-get should be happy now.

1 Like

Thanks a bunch!
Now the ffmpeg install went OK.
Have to rush off now so I can test it only tomorrow.

I use svtplay-dl this way and get an mp4-file:

svtplay-dl -o rapport-10-9-09-30.mp4 Rapport – Avsnitt 135 | SVT Play

I am now really remote from the Pi (6000 km away), but I can access it via OpenVPN and PuTTY…
I have tried the ffmpeg commands to download different resolutions to mp4 files and it seems to work just fine.
So now I can command a download of a SVTplay stream in the way I intended it.
Thanks to all that helped in this thread!

1 Like

I have an RPi2 with a 1TB hard drive and OSMC - Kodi. This works quite well with some recent glitches regarding the Youtube add-on. Not the topic of this thread.
Instead I would like to know if there is some way to record a play stream to disk for later playback. I know that ffmpeg is capable of doing this provided one can create the extremely complex command line for ffmpeg…
I would like to see an option when selecting a program on say SVTplay where one can either play it directly or save it to disk for later playback. The use case would be for example when one can load these programs to disk before traveling to a place with no or very expensive Internet access.

I am not talking about a PVR type system where real time transmissions are saved to file, rather this is about being able to load up the disk with material to watch say in the vacation home on an isolated island or such. No Internet availability at required speeds.