livestream_saver
livestream_saver copied to clipboard
Unable to start livestream_saver on Ubuntu
I'm getting this error (below) when i try to initialize it.
I followed the install instructions.
python3.8 livestream_saver.py monitor --help Traceback (most recent call last):
File "livestream_saver.py", line 12, in
What I did do wrong?
Please, let me know
I suspect that you have a /home/hobbes/livestream_saver/
directory alongside your /home/hobbes/livestream_saver.py
which confuses python. If that is the case, delete or move that directory (better yet, move everything inside that directory instead).
I moved everything into a new directory called livestream. To no avail.
ls livestream/ livestream_saver.py requirements.txt
~/livestream$ python3.8 livestream_saver.py monitor --help
Traceback (most recent call last):
File "livestream_saver.py", line 12, in
Doing the requirements part I noticed that this error happened:
Traceback (most recent call last):
File "/tmp/pip-build-9vmxvr2s/Pillow/setup.py", line 995, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-9vmxvr2s/Pillow/setup.py", line 1012, in <module>
raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:
The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;file='/tmp/pi p-build-9vmxvr2s/Pillow/setup.py';f=getattr(tokenize, 'open', open)(file);co de=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec') )" install --record /tmp/pip-d3g7d0hv-record/install-record.txt --single-version -externally-managed --compile --user --prefix=" failed with error code 1 in /tmp /pip-build-9vmxvr2s/Pillow/
Any ideas?
There is something wrong with your setup.
You might want to look into setting up a virtual environment as is described in the Readme, then install dependencies in that virtual environment with pip.
Can you confirm you have the exact same directory structure as in this here repository? Beyond that I don't know why this is occurring.
I did a clean install of Raspberry Pi OS on a new SDCard.
The only thing I installed was python-pip. Nothing else.
hbs@raspberrypi:~/livestream $ python3.9 -m pip install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pytube==10.9.2 in /home/hbs/.local/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (10.9.2) Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (8.1.2)
When I tried to run, the same thing happened.
hbs@raspberrypi:~/livestream $ python3.9 livestream_saver.py download --cookie cookie.txt https://www.youtube.com/watch?v=86YLFOog4GM
Traceback (most recent call last):
File "/home/hbs/livestream/livestream_saver.py", line 12, in
This is what is inside my home user:
I managed to reproduce this by not having a livestream_saver directory alongside livestream_saver.py. You need to have the same directory structure as is in the repository and I suspect you are missing files for some reason. How have you cloned the repository? You need to have all files:
~/livestream/livestream_saver.py
~/livestream/...
~/livestream/livestream_saver/
~/livestream/livestream_saver/__init__.py
~/livestream/livestream_saver/...
I was able to fix it.
It started downloading a live stream but at a certain point, it stopped with an error. This was on a Ubuntu machine. The first one i mentioned above.
python3.8 livestream_saver.py download --log-level CRITICAL --cookie ~hbs/cookie.txt https://www.youtube.com/watch?v=V9rlTQCg0Ow 2022-11-18 01:30:09,325 - CRITICAL - livestream_saver.request - We are not logged in. Check the validity of your cookies!
2022-11-18 01:11:16,648 - CRITICAL - download.V9rlTQCg0Ow - Some kind of error occured during download? Stream format mismatch after update of base URL.
What it is missing?
The path to your cookie.txt file is wrong, it should be ~/hbs/cookies.txt
.
The error you got is a known issue.
You can circumvent the problem by using the --ignore-quality-change
argument. It's not documented in the Readme yet, because it might not work reliably. There is still some work to be done.
For the last week up to today, I've been using this option trying to salvage my live streams on YouTube to no avail
All of them ended with an error right in the middle saying that a mismatch occurred. Nothing could be saved.
I tried to concatenate another live stream that I captured that I did only for testing purposes which also ended in a mismatch. I ended up canceling the action because even on my remote server it took more than a day to end.
I must apologize because I don't have any logs to show as of now. I deleted the whole thing to start over.
But tomorrow and on I will be able to provide some. I've left livestream_stream saver monitoring a YouTube channel. The same one and the only one that I am trying to capture since the very beginning.
I've used this; python3 livestream_saver.py monitor --ignore-quality-change -d --scan-delay 30 URL
I did a git pull and everything seems to be up-to-date.
Yeah, I had that error come up randomly but it seems to occur more with certain streamers than others. Not sure why exactly but I'll try to handle it better in future versions.
Another thing you might want to do is automatically start a side-car application to record your live streams, like yt-dlp for example. You can use the hooks described in "hooks on event" section in the Readme.