3 - [Remote tools](#remote-tools)
4 - [import-videos.js](#import-videosjs)
5 - [upload.js](#uploadjs)
6 - [Server tools](#server-tools)
7 - [parse-log](#parse-log)
8 - [create-transcoding-job.js](#create-transcoding-jobjs)
9 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
10 - [prune-storage.js](#prune-storagejs)
14 You need at least 512MB RAM to run the script.
15 Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
16 You need to follow all the following steps even if you are on a PeerTube server.
20 Install the [PeerTube dependencies](dependencies.md).
24 Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
27 $ git clone https://github.com/Chocobozzz/PeerTube.git
28 $ CLONE="$(pwd)/PeerTube"
40 $ npm run build:server
45 You can use this script to import videos from all [supported sites of youtube-dl](https://rg3.github.io/youtube-dl/supportedsites.html) into PeerTube.
46 Be sure you own the videos or have the author's authorization to do so.
49 $ node dist/server/tools/import-videos.js \
52 --password "PEERTUBE_PASSWORD" \
56 * `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re
57 * `PEERTUBE_USER` : your PeerTube account where videos will be uploaded
58 * `PEERTUBE_PASSWORD` : password of your PeerTube account (if omitted, you will be prompted for it)
59 * `TARGET_URL` : the target url you want to import. Examples:
61 * Channel: https://www.youtube.com/channel/ChannelId
62 * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
63 * Video https://www.youtube.com/watch?v=blabla
64 * Vimeo: https://vimeo.com/xxxxxx
65 * Dailymotion: https://www.dailymotion.com/xxxxx
67 The script will get all public videos from Youtube, download them and upload to PeerTube.
68 Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
70 Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
75 You can use this script to import videos directly from the CLI.
77 Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
81 $ node dist/server/tools/upload.js --help
87 These scripts should be run on the server, in `peertube-latest` directory.
91 To parse PeerTube last log file:
94 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level info
97 `--level` is optional and could be `info`/`warn`/`error`
99 ### create-transcoding-job.js
101 You can use this script to force transcoding of an existing video.
104 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
107 Or to transcode to a specific resolution:
109 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID] -r [resolution]
112 ### create-import-video-file-job.js
114 You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video.
117 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
122 Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
123 To delete them (a confirmation will be demanded first):
126 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
131 If you started PeerTube with a domain, and then changed it you will have invalid torrent files and invalid URLs in your database.
132 To fix this, you have to run:
135 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host