Add raw video documentation

This commit is contained in:
calzoneman 2016-05-19 21:07:42 -07:00
parent b35b2a6e7e
commit d357b30f9d
2 changed files with 61 additions and 3 deletions

57
docs/raw-videos.md Normal file
View File

@ -0,0 +1,57 @@
# Raw Videos / Audio #
Want to host your own video/audio files for use on CyTube? For servers with the
ffprobe module enabled, CyTube supports this! However, in order to provide a
consistent experience, there are limitations.
## Hosting the File ##
CyTube requires a direct link to the file in order to query it for metadata such
as duration and encoding. The website where you host the file needs to be able
to serve the video directly (rather than embedding it in a flash
player/iframe/etc.). It also needs to serve the correct MIME type for the video
in the `Content-Type` HTTP header, e.g. `video/mp4`.
I don't recommend hosting videos on Dropbox-type services, as they aren't built
to distribute video to many users at a time and often have strict bandwidth
limits. File hosting sites such as Putlocker also cause problems due to being
unable to serve the file directly, or due to binding the link to the IP address
of the user who retrieved it. For best results when using raw video, host the
video yourself on a VPS or dedicated server with plenty of bandwidth.
Note that CyTube only queries the file for metadata, it does not proxy it for
users! Every user watching the video will be downloading it individually.
## Encoding the Video ##
Current internet browsers are very limited in what codecs they can play
natively. Accordingly, CyTube only supports a few codecs:
**Video**
* MP4 (H.264)
* WebM (VP8)
* WebM (VP9)
* Ogg/Theora
**Audio**
* MP3
* Ogg/Vorbis
If your video is in some other format (such as MKV or AVI), then it will need to
be re-encoded. There are plenty of free programs available to re-encode video
files, such as [ffmpeg](http://ffmpeg.org/) and
[handbrake](http://handbrake.fr/).
For best results, encode as an MP4 using H.264. This is natively supported by
many browsers, and can also be played using a fallback flash player for older
browsers that don't support it natively. Always encode with the
[faststart](https://trac.ffmpeg.org/wiki/Encode/H.264#faststartforwebvideo)
flag.
### Subtitles ###
Unfortunately, soft-subtitles are not supported right now. This is something
that may be supported in the future, but currently if you need subtitles, they
will have to be hardsubbed onto the video itself.

View File

@ -93,7 +93,7 @@ function testUrl(url, cb, redirCount) {
return cb("The request for the audio/video file has been redirected " + return cb("The request for the audio/video file has been redirected " +
"more than twice. This could indicate a misconfiguration " + "more than twice. This could indicate a misconfiguration " +
"on the website hosting the link. For best results, use " + "on the website hosting the link. For best results, use " +
"a direct link."); "a direct link. See https://git.io/vrE75 for details.");
} }
return testUrl(fixRedirectIfNeeded(data, res.headers["location"]), cb, return testUrl(fixRedirectIfNeeded(data, res.headers["location"]), cb,
redirCount + 1); redirCount + 1);
@ -107,7 +107,8 @@ function testUrl(url, cb, redirCount) {
return cb("Expected a content-type starting with 'audio' or 'video', but " + return cb("Expected a content-type starting with 'audio' or 'video', but " +
"got '" + res.headers["content-type"] + "'. Only direct links " + "got '" + res.headers["content-type"] + "'. Only direct links " +
"to video and audio files are accepted, and the website hosting " + "to video and audio files are accepted, and the website hosting " +
"the file must be configured to send the correct MIME type."); "the file must be configured to send the correct MIME type. " +
"See https://git.io/vrE75 for details.");
} }
cb(); cb();
@ -386,7 +387,7 @@ exports.query = function (filename, cb) {
cb(null, data); cb(null, data);
} else { } else {
return cb("File did not contain an acceptable codec. See " + return cb("File did not contain an acceptable codec. See " +
"https://git.io/va9g9 for details."); "https://git.io/vrE75 for details.");
} }
}); });
}); });