Learning patterns/Uploading videos to Wikimedia Commons
What problem does this solve?
[edit]You want to upload videos to Wikimedia Commons. These videos may be on YouTube, or on your own hard drive.
Problem: Wikimedia Commons only takes videos in Ogg Theora and WebM formats. Most videos are not in these formats, although WebM has some traction as a web standard.
What is the solution?
[edit]video2commons on WMF tools labs alows for an easy transfer of videos from various sources, and should serve most users.
We convert the videos to WebM and upload them to Wikimedia Commons.
A fair warning: this is a pretty technical learning pattern. This should not be used if you are not comfortable with command-line interfaces. (If you are at least somewhat comfortable with command-line interfaces, I do tell you exactly what to do.) There are more user-friendly approaches that involve online tools, but doing this kind of thing through a website is a pretty difficult technical challenge and I'm not sure those things work properly. This is a bit harder but is very effective.
Copyright status?
[edit]Ensure that the videos meet Wikimedia Commons' licensing requirements: videos must be reusable by anyone for any reason. The best licenses for this purpose are Creative Commons Attribution ShareAlike (CC-BY-SA), Creative Commons Attribution (CC-BY), and the CC0 Dedication (effectively public domain). Some works are automatically in the public domain; for instance, if they were published before 1923, or are a work of a U.S. government employee in the course of their official duties. There are other criteria and gotchas, so be sure of the copyright status (or lack thereof) before embarking on video conversion.
ffmpeg
[edit]The only roguelike that ever really captured my imagination was ffmpeg
— Electronic Frontier Foundation activist Parker Higgins, https://twitter.com/xor/status/779495748916224000
ffmpeg
is a very complicated software application; bewildering, even. But I am going to tell you exactly what you need to do.
- Install
ffmpeg
withlibvpx
andlibvorbis
.ffmpeg
manages the encoding process;libvpx
andlibvorbis
are libraries that handle the video, and audio encoding itself.- On macOS, the Homebrew package manager is the easiest option:
brew install ffmpeg --with-libvorbis --with-libvpx
If you are not familiar with Homebrew, set it up by following the instructions on the Homebrew website. - On Debian Linux, or a Debian-based system like Ubuntu or Mint, follow the Ubuntu instructions. Make sure you install
libvpx
andlibvorbis
in particular. - There are similar instructions for CentOS, RHEL, and Fedora
- There are Windows instructions, if you can make head or tail of any of that.
- On macOS, the Homebrew package manager is the easiest option:
- If you are converting videos already on your computer, the command to do so (assuming you're starting with an MP4 file):
ffmpeg -i FILENAME.mp4 -c:v libvpx -c:a libvorbis -qmin 0 -qmax 50 -crf 10 -b:v 2M -q:a 4 NEWFILE.webm
- Wait a long time. Video conversion is a slow process.
Downloading from YouTube
[edit]If you are downloading videos from YouTube, you will need ffmpeg
as described above and another utility called youtube-dl
, a delightful utility for downloading YouTube videos over command line. There are installation instructions for youtube-dl
.
Once you have that installed, the command to download and convert is as follows:
youtube-dl https://www.youtube.com/watch?v=VIDEO_ID -f bestvideo+bestaudio --merge-output-format webm --prefer-ffmpeg --postprocessor-args '-c:v libvpx -c:a libvorbis -qmin 0 -qmax 50 -crf 10 -b:v 2M -q:a 4'
This will download the highest quality video and audio stream and convert it in ffmpeg
using the parameters described above.
Alternative utility : yt-dlp
[edit]If you have Python and PIP already installed, try this.
pip install -U yt-dlp
Once you have that installed, the command to download and convert is as follows:
yt-dlp https://www.youtube.com/watch?v=VIDEO_ID -f bestvideo+bestaudio --merge-output-format webm --prefer-ffmpeg --postprocessor-args '-c:v libvpx -c:a libvorbis -qmin 0 -qmax 50 -crf 10 -b:v 2M -q:a 4'
for better quality
yt-dlp https://www.youtube.com/watch?v=VIDEO_ID -f bestvideo+bestaudio --merge-output-format webm --prefer-ffmpeg --postprocessor-args '-c:v libvpx-vp9 -b:v 0 -c:a libopus -b:a 320k -crf 15'
Uploading to Wikimedia Commons
[edit]You can upload many videos at once using UploadWizard. UploadWizard will let you upload 50 media files at a time.
Unfortunately, the YouTube downloading process does not preserve metadata. You will have to input that by hand, for now.
Downloading captions from YouTube and adding them to Commons
[edit]YouTube videos often feature closed captioning, whether automatically generated or supplied by the original uploader.
Wikimedia Commons supports closed captioning for videos through the standard SRT format. YouTube videos, however, store captions in their own format. If you are inclined, this sketchy-looking website lets you input a URL to a YouTube video and gives you the captions in the desired SRT format, but inside a zip file. Unzip the file; the SRT file will be inside. Open it with your favorite text editor and delete the lines where the guy plugs his website (we don't need that) while leaving the rest intact.
From there, go to the video files on Wikimedia Commons. Don't remember where you put it? On the top-right of your screen is a link to "Uploads" that lists all your recent uploads. Once you have found your video, navigate to the tab that says "TimedText," next to "File" and "Discussion." Select the language, and dump the contents of your lightly edited SRT file in there. Save the page, and you're set!
Endorsements
[edit]- This is a useful LP. I particularly found the subtitle downloader very useful. --Subhashish Panigrahi (talk) 03:57, 29 May 2017 (UTC)