WWBN / AVideo-Encoder

Encoder Server for AVideo Platform Open-Source
https://platform.avideo.com
GNU Affero General Public License v3.0
151 stars 188 forks source link

Encoder is broken : PermissionError: [Errno 13] Permission denied: '/var/www/.cache' #501

Open gamersalpha opened 1 year ago

gamersalpha commented 1 year ago

Hello i can't encode anymore video do u have information about this error please ?

[29-Mar-2023 21:21:37 Europe/Berlin] youtubeDl::addVideo We could not get the title () of your video (https://www.youtube.com/watch?v=wjNxTyEZBMc&&index=18)
[29-Mar-2023 21:21:49 Europe/Berlin] getTitleFromLink: Get Title Error: LC_ALL=en_US.UTF-8 /usr/local/bin/youtube-dl   --no-check-certificate --no-playlist --force-ipv4 --skip-download -e 'https://www.youtube.com/watch?v=wjNxTyEZBMc&&index=18'
Array
(
    [0] => WARNING: Writing cache to '/var/www/.cache/youtube-dl/youtube-sigfuncs/js_931a8913_106.json' failed: Traceback (most recent call last):
    [1] =>   File "/usr/local/lib/python3.8/dist-packages/youtube_dl/cache.py", line 49, in store
    [2] =>     os.makedirs(os.path.dirname(fn))
    [3] =>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
    [4] =>     makedirs(head, exist_ok=exist_ok)
    [5] =>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
    [6] =>     makedirs(head, exist_ok=exist_ok)
    [7] =>   File "/usr/lib/python3.8/os.py", line 223, in makedirs
    [8] =>     mkdir(name, mode)
    [9] => PermissionError: [Errno 13] Permission denied: '/var/www/.cache'
    [10] =>
    [11] => WARNING: Writing cache to '/var/www/.cache/youtube-dl/youtube-sigfuncs/js_931a8913_102.json' failed: Traceback (most recent call last):
    [12] =>   File "/usr/local/lib/python3.8/dist-packages/youtube_dl/cache.py", line 49, in store
    [13] =>     os.makedirs(os.path.dirname(fn))
    [14] =>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
    [15] =>     makedirs(head, exist_ok=exist_ok)
    [16] =>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
    [17] =>     makedirs(head, exist_ok=exist_ok)
    [18] =>   File "/usr/lib/python3.8/os.py", line 223, in makedirs
    [19] =>     mkdir(name, mode)
    [20] => PermissionError: [Errno 13] Permission denied: '/var/www/.cache'
    [21] =>
    [22] => ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
)

First i update youtube-dll :

sudo pip install -U youtube-dl
Requirement already up-to-date: youtube-dl in /usr/local/lib/python3.8/dist-packages (2021.12.17)

so now i can't understand why Avideo-encoder wants writer in /var/www/.cache

and i also tries this :

stagiaire@srv-web-01:/var/www$ /usr/local/bin/youtube-dl -C  --no-check-certificate --no-playlist --force-ipv4 --skip-download -e 'https://www.youtube.com/watch?v=wjNxTyEZBMc&&index=18'
ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

can u explain me what's is wrong please

thanks

DanielnetoDotCom commented 1 year ago

The error message suggests that the user running the youtube-dl command does not have permission to create directories in the /var/www/.cache directory. You may need to adjust the permissions of this directory to allow the user to create directories and files inside it.

One way to do this is to use the chmod command to change the owner and group of the directory to the user running the youtube-dl command. For example, you can use the following command to change the owner and group of the directory to the user www-data (replace www-data with the appropriate user for your system):

sudo chown -R www-data:www-data /var/www/.cache

This command changes the owner and group of the /var/www/.cache directory and all of its contents recursively (-R option) to www-data. Once the ownership is set correctly, the user running the youtube-dl command should have permission to create directories and files in the directory.

gamersalpha commented 1 year ago

Greetings,

I am facing an issue with my web application which appears to be related to the youtube-dl program installed on my Ubuntu server. This is a known problem that has been reported on the following GitHub pages: https://github.com/yt-dlp/yt-dlp/issues/6247 and https://github.com/ytdl-org/youtube-dl/issues/31530. Fortunately, a solution has been proposed on https://github.com/yt-dlp/yt-dlp/issues/3766.

To resolve this issue, I removed the previously installed youtube-dl program by executing the command: "sudo pip remove youtube-dl". Then, I installed the new program using the following commands:

sudo add-apt-repository ppa:tomtomtom/yt-dlp    # Add ppa repo to apt
sudo apt update                                 # Update package list
sudo apt install yt-dlp                         # Install yt-dlp

I attempted to change the executable name of youtube-dl by searching through several source code files, including videos/configuration.php, objects/Configuration.php, objects/Configuration.php, and objects/include_config.php. Unfortunately, I was unable to locate the specific line of code that would allow me to change the name. Instead, I opted to change the name manually by executing the following command:

sudo mv /usr/bin/yt-dlp /usr/bin/youtube-dl

In the future, I am curious to see if AVIDEO will be able to automatically detect the correct program name installed on the server. Thank you for your attention to this matter.

I hope that this solution can be useful for others who may encounter a similar issue.

DanielnetoDotCom commented 1 year ago

if you install the yt-dlp in your server, AVideo will use it automatically

gamersalpha commented 1 year ago

ok so look what i have : i lunch in comand line :

image

ok now i try to upluoad a video :

image

and like see, Avideo don't detect it

DanielnetoDotCom commented 1 year ago

Run this and try again

sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && sudo chmod a+rx /usr/local/bin/yt-dlp

gamersalpha commented 1 year ago

Looks work but got a new error :/

image

on log i got this :


Array
(
    [0] => Halsey & Kelsea Ballerini Perform 'Without Me' | CMT Crossroads
)

[30-Mar-2023 08:01:45 Europe/Berlin] decideFormatOrder: {"videoURL":"https:\/\/www.youtube.com\/watch?v=Leex4LSf6aY&list=RDLeex4LSf6aY&start_radio=1","audioOnly":"false","spectrum":"false","webm":"false","override_status":"","update_video_id":0,"inputHLS":"false","inputLow":"false","inputSD":"false","inputHD":"false","inputAutoHLS":"false","inputAutoMP4":"false","inputAutoWebm":"false","inputAutoAudio":"true","categories_id":3,"releaseDate":"2023-03-30 08:00","notifyURL":""}
[30-Mar-2023 08:01:45 Europe/Berlin] decideFormatOrder: auto Audio
[30-Mar-2023 08:01:45 Europe/Berlin] AVideo-Encoder Format::getFromOrder(60)
[30-Mar-2023 08:01:45 Europe/Berlin] Encoder::sendFile videos_id=0, format=mp3
[30-Mar-2023 08:01:46 Europe/Berlin] Encoder::sendFile sending file to aVideoEncoder.json from
[30-Mar-2023 08:01:46 Europe/Berlin] sendToStreamer to aVideoEncoder.json
[30-Mar-2023 08:01:46 Europe/Berlin] Encoder::save id=() title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer spectrumimage not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer rawVideo not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer image not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer gifimage not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer webpimage not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer video not set
[30-Mar-2023 08:01:47 Europe/Berlin] sendToStreamer https://youtube.serveur.fr/YouPHPTube/aVideoEncoder.json in 0.096 seconds {"error":false,"target":"aVideoEncoder.json","postFields":{"duration":"EE:EE:EE","title":"Halsey & Kelsea Ballerini Perform 'Without Me' | CMT Crossroads","first_request":1,"categories_id":3,"format":"mp3","resolution":"","videoDownloadedLink":"https:\/\/www.youtube.com\/watch?v=Leex4LSf6aY&&start_radio=1","description":"\"Does it ever get lonely? Thinking you could live without me.\" Yes, queens! \ud83d\ude4c \ud83d\udc51 This is one serious powerhouse performance of 'Without Me' by Kelsea Ballerini and Halsey.\n\n#KelseaBallerini #Halsey #CMT #Crossroads\n\nSUBSCRIBE now for more CMT Crossroads: https:\/\/bit.ly\/2KPSNQD\n\nFor updates on all things country, follow CMT!\nCrossroads on CMT: http:\/\/www.cmt.com\/shows\/cmt-crossroads\nCMT on FB: https:\/\/www.facebook.com\/CMTCrossroads\/\nCMT on Twitter: https:\/\/twitter.com\/cmt\nCMT on Instagram: https:\/\/www.instagram.com\/cmt\/\n\nGreat music knows no boundaries. CMT Crossroads shows the far-reaching roots of country music by pairing country artists with musicians from other genres. Each episode will feature a different set of stars playing together, swapping stories and sharing their common love of music.","downloadURL":"","chunkFile":"","encoderURL":"https:\/\/youtube.serveur.fr\/YouPHPTube-Encoder\/","keepEncoding":"0","streamers_id":"4","user":"issa2020","pass":"_user_hash_dWFDVlB0SWMybFU4WWNMbzVvZ0RZbXRrek1uUnFwNjJCMGdPeFk0Y285MCs4Uld3T2JPeFBoRE9DT2VFOUtoSUxHSUc1WUtOUXMvUnVscDMwaVFFVmc9PQ==","return_vars":"{\"videos_id\":0,\"video_id_hash\":\"\",\"releaseDate\":\"2023-03-30 08:00\"}","releaseDate":"2023-03-30 08:00"},"response_raw":"{\"error\":false,\"video_id\":false,\"video_id_hash\":\"Qnhjb1hiQkRsSjZSYk1FekQ0QWROcVFqWmxOMm1PZ1p1N2J4VjV1QkE2UT0=\",\"releaseDate\":\"2023-03-30 08:00\"}","response":{"error":false,"video_id":false,"video_id_hash":"Qnhjb1hiQkRsSjZSYk1FekQ0QWROcVFqWmxOMm1PZ1p1N2J4VjV1QkE2UT0=","releaseDate":"2023-03-30 08:00"}}
[30-Mar-2023 08:01:47 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:01:51 Europe/Berlin] getReturn_vars {"videos_id":0,"video_id_hash":"Qnhjb1hiQkRsSjZSYk1FekQ0QWROcVFqWmxOMm1PZ1p1N2J4VjV1QkE2UT0=","releaseDate":"2023-03-30 08:00"}
[30-Mar-2023 08:01:51 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:01:51 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:01:51 Europe/Berlin] downloadFile: start queue_id = 17  url = https://www.youtube.com/watch?v=Leex4LSf6aY&&start_radio=1 pathFileName = /var/www/html/YouPHPTube-Encoder/videos/17_tmpFile.mp4
[30-Mar-2023 08:01:51 Europe/Berlin] getYoutubeDl: Getting from Youtube DL /usr/local/bin/yt-dlp   --no-check-certificate --force-ipv4 --no-playlist -k -o /tmp/youtubeDlcN3iXE.mp4 -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' 'https://www.youtube.com/watch?v=Leex4LSf6aY&&start_radio=1' [{"file":"\/var\/www\/html\/YouPHPTube-Encoder\/objects\/Encoder.php","line":470,"function":"getYoutubeDl","class":"Encoder","type":"::"},{"file":"\/var\/www\/html\/YouPHPTube-Encoder\/objects\/Encoder.php","line":968,"function":"downloadFile","class":"Encoder","type":"::"},{"file":"\/var\/www\/html\/YouPHPTube-Encoder\/view\/run.php","line":6,"function":"run","class":"Encoder","type":"::"}]
[30-Mar-2023 08:02:15 Europe/Berlin] getYoutubeDl: Copying [/tmp/youtubeDlcN3iXE.mp4] to [/var/www/html/YouPHPTube-Encoder/videos/17_tmpFile.mp4]
[30-Mar-2023 08:02:15 Europe/Berlin] downloadFile:getYoutubeDl SUCCESS queue_id = 17
[30-Mar-2023 08:02:15 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:02:15 Europe/Berlin] downloadFile: {"error":false,"filename":"17_tmpFile.mp4","pathFileName":"\/var\/www\/html\/YouPHPTube-Encoder\/videos\/17_tmpFile.mp4","msg":"We downloaded the file with success"}
[30-Mar-2023 08:02:15 Europe/Berlin] Original filesize is 98.79MB
[30-Mar-2023 08:02:15 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:02:15 Europe/Berlin] try [1] return_vars->videos_id is empty {"videos_id":0,"video_id_hash":"Qnhjb1hiQkRsSjZSYk1FekQ0QWROcVFqWmxOMm1PZ1p1N2J4VjV1QkE2UT0=","releaseDate":"2023-03-30 08:00"}
[30-Mar-2023 08:02:15 Europe/Berlin] Encoder::save id=(17) title=(Halsey & Kelsea Ballerini Perform \'Without Me\' | CMT Crossroads)
[30-Mar-2023 08:02:15 Europe/Berlin] getReturn_vars {"videos_id":0,"video_id_hash":"Qnhjb1hiQkRsSjZSYk1FekQ0QWROcVFqWmxOMm1PZ1p1N2J4VjV1QkE2UT0=","releaseDate":"2023-03-30 08:00"}
DanielnetoDotCom commented 1 year ago

first, try to update your streamer and encoder.

if still fails share a more complete encoder log.