Setting up Detectron2 and Youtube downloader

1 minute read

At the ECCV 2020 I came across FAIR’s latest platform for object detection Detectron2. The repository includes instructions for installing with pip. Past experience with messing up an Anaconda installation by using pip taught me to exclusively use conda.

To install Detectron2 with Anaconda, just run

conda install -c conda-forge detectron2

To learn how to use Detectron2 see the documentation.

Youtube Downloader

In the Detectron2 tutorial the authors use two great tools to get an extract from a youtube video. First, to download a video for YouTube you can use the command line tool. Just run

conda install -c conda-forge youtube-dl 

to download and install the YouTube downloader. To cut the downloaded video you can use the command line tool ffmpeg which you can get with

conda install -c conda-forge ffmpeg

Once both are installed you can download a part of video like so:

!youtube-dl <youtube-link> -f 22 -o video.mp4
!ffmpeg -i video.mp4 -t 00:00:10 -c:v copy video-clip.mp4

This downloads the video <youtube-link> as file video.mp4 in the format -f 22. The second line extracts a 10 second clip from the video which will not be re-encoded and saves it as video-clip.mp4. For more information on how to use both of these tool see the website and ffmpeg documentation.

Tags:

Updated: