Skip to content

Commit 8b19a2a

Browse files
committed
Update readme
1 parent ce0a36c commit 8b19a2a

File tree

1 file changed

+96
-1
lines changed

1 file changed

+96
-1
lines changed

README.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,97 @@
11
# youtube-drive
2-
Store files as YouTube videos == infinite disk space. Rewrite by Python 3.
2+
3+
youtube-drive is totally inspired by [YouTubeDrive](https://github.com/dzhang314/YouTubeDrive), a Wolfram Language (aka Mathematica) package. I read the source code of **YouTubeDrive** and write a Python version with a little change for fun.
4+
5+
**youtube-drive** is a Python library encodes/decodes arbitrary data to/from simple RGB videos which are automatically uploaded to/downloaded from YouTube. Since YouTube imposes no limits on the total number or length of videos users can upload, this provides an effectively infinite but extremely slow form of file storage.
6+
7+
youtube-drive is a silly proof-of-concept, and I do not endorse its high-volume use either.
8+
9+
## Usage Example
10+
11+
**Upload**: Encode a file to video and upload to YouTube:
12+
13+
```sh
14+
python -m youtube_drive upload examples/BesselJ.png
15+
YouTube Video ID: EzqstWlMXyk
16+
YouTube: https://youtu.be/EzqstWlMXyk
17+
18+
```
19+
20+
**Retrieve**: Download the video from YouTube and decode to a file:
21+
22+
```sh
23+
python -m youtube_drive retrieve --video-id=EzqstWlMXyk -o BesselJ-retrieved.png
24+
/var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.mp4
25+
[youtube] EzqstWlMXyk: Downloading webpage
26+
[youtube] EzqstWlMXyk: Downloading MPD manifest
27+
[download] Destination: /var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.f136.mp4
28+
[download] 100% of 1.74MiB in 00:25
29+
[download] Destination: /var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.mp4.f140
30+
[download] 100% of 58.70KiB in 00:03
31+
[ffmpeg] Merging formats into "/var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.mp4"
32+
Deleting original file /var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.f136.mp4 (pass -k to keep)
33+
Deleting original file /var/folders/md/dnr_ryfs2_x128p26xx2pnnc0000gn/T/tmp6qfm_msc.mp4.f140 (pass -k to keep)
34+
```
35+
36+
The video, video ID is **EzqstWlMXyk**, youtube-drive produces in this example can be viewed at https://youtu.be/EzqstWlMXyk. The video is encoded from the image [BesselJ.png](https://github.com/lewangdev/youtube-drive/blob/main/examples/BesselJ.png). A 62KB image file will produce a video of size 10+MB.
37+
38+
Another file I uploaded to YouTube is [painting.jpg](https://github.com/lewangdev/youtube-drive/blob/main/examples/painting.jpg), it produces a video of size 127.5MB, and the original size is 476KB. The video can be viewed at https://youtu.be/gKhXk3IGW2s.
39+
40+
## Installation
41+
42+
```sh
43+
git clone https://github.com/lewangdev/youtube-drive.git
44+
cd youtube-drive
45+
python -m venv .venv
46+
. .venv/bin/activate
47+
pip install -r requirements.txt
48+
```
49+
50+
## Usage
51+
52+
**Commands:**
53+
54+
```sh
55+
python -m youtube_drive -h
56+
usage: youtube-drive [-h] {upload,up,retrieve,r} ...
57+
58+
optional arguments:
59+
-h, --help show this help message and exit
60+
61+
Commands:
62+
{upload,up,retrieve,r}
63+
upload (up) Upload a file to YouTube
64+
retrieve (r) Retrieve a video from YouTube save as <filename>
65+
66+
```
67+
68+
**Upload:**
69+
70+
```sh
71+
python -m youtube_drive upload -h
72+
usage: youtube-drive upload [-h] filename
73+
74+
positional arguments:
75+
filename Encode file <filename> to a video and upload to YouTube
76+
77+
optional arguments:
78+
-h, --help show this help message and exit
79+
80+
```
81+
82+
**Retrieve:**
83+
84+
```sh
85+
python -m youtube_drive r -h
86+
usage: youtube-drive retrieve [-h] [--video-id video_id] [-o filename]
87+
88+
optional arguments:
89+
-h, --help show this help message and exit
90+
--video-id video_id Download YouTube video with <video_id>
91+
-o filename Save file to <filename>
92+
93+
```
94+
95+
## The difference between **youtube-drive** and **YouTubeDrive**
96+
97+
I add 4 bytes at the beginning for the file for easily padding to video frames

0 commit comments

Comments
 (0)