- How to Create a Video From Images in Linux
- Images Founded Videos
- Measuring Videos Using Images
- Using ffmpeg for Images-to-Video Creation in Linux
- Install FFmpeg in RHEL, CentOS, Rocky, and AlmaLinux
- Install FFmpeg in Fedora Linux
- Install FFmpeg in Debian, Ubuntu, and Mint
- Install FFmpeg in Arch Linux
- Install FFmpeg in OpenSUSE Linux
- How to Use FFmpeg for Images-to-Video Creation in Linux
- Video Images Preparation
- Creating Video from Images in Linux
- Download YouTube Videos in Linux Command Line Using youtube-dl
- Install youtube-dl to download YouTube videos in Linux terminal
- youtube-dl features
- How to install youtube-dl on Linux
- Using YouTube-dl for downloading videos:
- Download YouTube videos in various formats and quality size
- Download subtitles of videos using youtube-dl
- Download entire YouTube playlist
- Download only audio from YouTube videos
- And a lot more can be done with youtube-dl
How to Create a Video From Images in Linux
Before this article gives us a walkthrough on creating videos from images under a Linux operating system environment, it is important to understand the why before we engage the how.
Images Founded Videos
The concept of integrating images into videos is not rocket science as it logically takes a series of images to compose a video. Every video you watch; even your favorite YouTube videos are just a series of still images undergoing a very quick image-to-image transition. In-between these transitions is a black picture that enables the video being played to switch frames from one still image to the next one.
The image-to-image transition mechanism is too fast for the human eye to notice with optical illusion being one of the contributing factors. These images that define a created video are called frames. When you pause a playing video, you are actually looking at a frame (still image). It is the reason why a paused video might have blurry clarity in comparison to the one playing.
Measuring Videos Using Images
A frame rate depicts how many pictures transition in a single second. So if an image transitions after every 33 milliseconds, that video attributes to 30 frames per second which are somewhat 108,000 frames per hour. This concept should help you understand why 720p, 1080p, and 4K videos vary in size.
As exciting as this images-to-videos relationship is, this article guide needs to redirect its focus from advanced video editing concepts and help you transform your still images into videos.
Using ffmpeg for Images-to-Video Creation in Linux
This ffmpeg free software with its publicly available source code will help us achieve this article’s objective.
Choose one of the following installation options in relation to the Linux operating system distribution you are using.
Install FFmpeg in RHEL, CentOS, Rocky, and AlmaLinux
$ sudo dnf install epel-release $ sudo yum config-manager --set-enabled PowerTools $ sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo $ sudo dnf install ffmpeg
Install FFmpeg in Fedora Linux
$ sudo dnf install \ https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm $ sudo dnf update $ sudo dnf install ffmpeg
Install FFmpeg in Debian, Ubuntu, and Mint
$ sudo apt-get install sshpass [On ]
Install FFmpeg in Arch Linux
$ sudo pacman -S git $ git clone https://aur.archlinux.org/snapd.git $ cd snapd $ makepkg -si $ sudo systemctl enable --now snapd.socket $ sudo ln -s /var/lib/snapd/snap /snap $ sudo snap install ffmpeg
Install FFmpeg in OpenSUSE Linux
$ sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy
Swap out openSUSE_Leap_15.2 with your openSUSE version e.g. openSUSE_Tumbleweed, openSUSE_Leap_15.0, or openSUSE_Leap_15.1.
Next, run the series of commands to install it.
$ sudo zypper --gpg-auto-import-keys refresh $ sudo zypper dup --from snappy $ sudo zypper install snapd $ sudo systemctl enable snapd $ sudo systemctl start snapd
The following additional commands apply to Tumbleweed users.
$ sudo systemctl enable snapd.apparmor $ sudo systemctl start snapd.apparmor
How to Use FFmpeg for Images-to-Video Creation in Linux
Coming up with time-lapse movies and stop-motion photography are some key benefits of creating a video from a series of provided still images.
Video Images Preparation
The naming convention of your input images should be sequential since ffmpeg follows a string-matching rule to properly identify and line up these images.
Your image file-naming convention should adhere to either of the following three ffmpeg supported filename patterns.
- With leading zeroes – The ffmpeg command segment ‘filename-%03d.png’ will look for image files with names ranging from filename-001.png to filename-999.png.
- Without leading zeroes – The ffmpeg command segment ‘filename-%d.png’ will look for image files with names ranging from filename-1.png to filename-999.png.
- Without a regular naming pattern – The ffmpeg command segment ‘filename-*.png’ will not follow any sequential order while looking for image files.
Creating Video from Images in Linux
The ffmpeg syntax for images-to-videos creation for image filenames with leading zeroes looks something like the following:
$ ffmpeg -framerate 10 -i filename-%03d.png output.mp4
From the above command syntax, you can set the frame rate to the desired figure and specify the output video file name.
Let us try to create a video from the following images.
Since the naming convention of these image files is sequential but without leading zeroes, we will use the following ffmpeg command:
$ ffmpeg -framerate 25 -i image-%d.png output.mp4
We have set the frame rate to 25.
The expected output video file should be visible:
When the images you are converting to videos do not need to follow a sequential stream; images with random names like image-00.png, image-10.png, and image-30.png, you can use the glob matching pattern as demonstrated by the following syntax:
$ ffmpeg -framerate 10 -pattern_type glob -i "image-*.png" output.mp4
Download YouTube Videos in Linux Command Line Using youtube-dl
There are various ways to download YouTube videos. But when it comes to Linux, nothing beats youtube-dl. In this tutorial, I am going to show the steps for using youtube-dl for downloading videos from YouTube and other websites.
Install youtube-dl to download YouTube videos in Linux terminal
youtube-dl is a Python-based command-line tool that allows downloading videos from YouTube, Dailymotion, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites. It is written in pygtk and requires Python interpreter to run this program, it’s not platform restricted. It should run on any Unix, Windows or in Mac OS X based systems.
The youtube-dl tool supports resuming interrupted downloads. If youtube-dl is killed (for example by Ctrl-C or due to loss of Internet connectivity) in the middle of the download, you can simply re-run it with the same YouTube video URL. It will automatically resume the unfinished download, as long as a partial download is present in the current directory. Which means you don’t need download managers in Linux just for resuming downloads.
youtube-dl features
This tiny tool has so many features that it won’t be an exaggeration to call it the best YouTube downloader for Linux.
- Download videos from not only YouTube but other popular video websites like Dailymotion, Facebook etc
- Allows downloading videos in several available video formats such as MP4, WebM etc.
- You can also choose the quality of the video being downloaded. If the video is available in 4K, you can download it in 4K, 1080p, 720p etc
- Automatical pause and resume of video downloads.
- Allows to bypass YouTube geo-restrictions
Downloading videos from websites could be against their policies. It’s up to you if you choose to download videos.
How to install youtube-dl on Linux
youtube-dl is a popular program and is available in the default repositories of most Linux distributions, if not all. You can use the standard way of installing packages in your distribution to install youtube-dl. I’ll still show some commands for the sake of it.
If you are running Ubuntu-based Linux distribution, you can install it using this command:
sudo apt install youtube-dl
The version in Debian/Ubuntu is usually old and you might face errors while downloading videos. However, I recommend installing it directly from its source repository.
For any Linux distribution, you can quickly install youtube-dl on your system through the command line interface with:
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
After fetching the file, you need to set a executable permission on the script to execute properly.
sudo chmod a+rx /usr/local/bin/youtube-dl
Once installed, you can update it to the latest version using this command. This is helpful when you have been using it for a few months:
Using YouTube-dl for downloading videos:
To download a video file, simply run the following command. Where “VIDEO_URL” is the URL of the video that you want to download.
The video is saved in the directory from where you run the command.
Download YouTube videos in various formats and quality size
These days YouTube videos have different resolutions, you first need to check available video formats of a given YouTube video. For that run youtube-dl with “-F” option. It will show you a list of available formats.
Setting language BlXaGWbFVKY: Downloading video webpage BlXaGWbFVKY: Downloading video info webpage BlXaGWbFVKY: Extracting video information Available formats: 37 : mp4 [1080x1920] 46 : webm [1080x1920] 22 : mp4 [720x1280] 45 : webm [720x1280] 35 : flv [480x854] 44 : webm [480x854] 34 : flv [360x640] 18 : mp4 [360x640] 43 : webm [360x640] 5 : flv [240x400] 17 : mp4 [144x176]
Now among the available video formats, choose one that you like. For example, if you want to download it in MP4 version and 1080 pixel, you should use:
Download subtitles of videos using youtube-dl
First, check if there are subtitles available for the video. To list all subs for a video, use the command below:
To download all subs, but not the video:
youtube-dl --all-subs --skip-download
Download entire YouTube playlist
To download a playlist, simply run the following command. Where “playlist_url” is the URL of the playlist that you want to download.
Download only audio from YouTube videos
If you just want to download the audio from a YouTube video, you can use the -x option to simply extract the audio file from the video.
The default file format is Ogg which you may not like. You can specify the file format of the audio file in the following manner:
youtube-dl -x --audio-format mp3
And a lot more can be done with youtube-dl
youtube-dl is a versatile command line tool and provides a number of functionalities. No wonder it is such a popular command line tool.
I have only shown some of the most common usages of this tool. But if you want to explore its capabilities further, please check its manual.
I hope this article helped you to download YouTube videos on Linux. If you have questions or suggestions, please drop a comment below.