I wanted to create a looped video. I also find that the videos created are large even for just a few minutes. Moreover, knowing how to convert videos between different formats can be useful or essential for a solo video creator like myself. The solution should be free and powerful if possible. I remembered FFMPEG, a powerful command-line program I knew years back but never really got into it beyond the raw basics.
Let us explore how we can use this powerful program that even beginners can understand. This guide will assume your original video file has no watermarks, to begin with, and no watermarks will be added. This guide is not about removing watermarks.
Note: This post will cover video conversion, loop, and compression with FFmpeg. Handbrake for simple use to convert and compress video will be covered as well, but not looping.
What is ffmpeg? How to install ffmpeg? How to update ffmpeg?
For example, download the Mac zip file, and open and run it. You may have to open up System Preferences -> Security & Privacy and -> General and allow the app to be opened.
Another example is to paste the below code as recommended from the ffmpeg download page into your terminal and enter. This can be the easiest way to both install and update your ffmpeg file.
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
How to convert a video for free without watermarks?
I have chosen the recommended or common settings for conversion e.g MP4 and H.265. Below is the ffmpeg command, you may read more here. Here we will just assume we leave the audio intact.
Let us use a MOV file with the name SampleMOV.mov for example. Open the terminal, type in the following line with the changes, and enter.
$ffmpeg -i IN -c:v libx265 -c:a copy -x265-params crf=25 OUT.mp4 Example $ffmpeg -i SampleMOV.mov -c:v libx265 -c:a copy -x265-params crf=25 ProcessedMOVToMP4.mp4
We just need to change the INPUT and OUT.
INPUT – the name of the file to be converted.
OUT.mp4 – the name of the resultant MP4 file.
Note: The parameter for an output file without (or removing) audio or soundless is ‘-an’. To have audio or sound, please replace ‘-a’ with “-c:a copy”.
That is a reduction of 35.48% for this small file.
How to quickly play a media with FFmpeg?
If the QuickTime Player is not playing the new media file, then we can test play it with the below command. Aso, I tested the ffmpeg processed files to be working well for YouTube. A clear advantage of using the ffplay is that it can quickly play large files that may take a long time to load with graphical programs.
Included in the ffmpeg utility, there is a fast and useful tool for playing a media file. The command is ffplay followed by a space and the filename before type enter. Ffplay can also play sound files including mp3 format.
How to loop a video for free with ffmpeg without watermarks?
We can loop a base video file a designated number of times to one output file.
For example, we have a file with the name ShortMP4.mp4 of 31 seconds long and we want to loop it 2 times to make it about one and half minutes long. More information can be found here.
ffmpeg -stream_loop 3 -i input.mp4 -c copy output.mp4 Example: Desktop $ffmpeg -stream_loop 2 -i ShortMP4.mp4 -c copy Loop2.mp4
Again, we can test view the video with ‘ffplay Loop2.mp4’ from the command line.
How long does ffmpeg take to loop the video?
This may depend on the file size. But for this file of about 3.1MB, it takes about some seconds or less.
How to compress a video for free without watermarks?
Let us use an MP4 file for example. Open the terminal, type in the following line with the changes, and enter.
How to compress an MP4 file with ffmpeg?
$ffmpeg -i IN.mp4 -c:v libx265 -c:a copy -x265-params crf=25 OUT.mp4 Example: $ffmpeg -i Flowers.mp4 -c:v libx265 -c:a copy -x265-params crf=25 ProcessedWithSound.mp4
That is a whopping huge 89.74% savings in compression!
Below is the uploaded YouTube video of the ffmpeg compressed sound video file. You may compare it with the uncompressed YouTube version here.
ffmpeg -i INPUT -c:v libx265 -c:a -x265-params crf=25 OUT.mp4
To compress into a soundless file:
ffmpeg -i INPUT -c:v libx265 -an -x265-params crf=25 OUT.mp4
The compression is an impressive 92.31%, from 78MB to 6MB!
How to compress and convert a video with Handbrake – free GUI (graphical user interface) software?
I read that Handbrake uses Ffmpeg behind the scene. Thanks to the author of HandBrake, a free cross-platform open-source transcoder software that can help to convert and compress large video sizes to much smaller ones. For example, I compressed quite a number of large videos of about 64GB to about 9 to 38 GB which may work out to be an 80% reduction (may depend on how much motion is in the video) for some videos!
The compression settings I use also convert from the Mov to Mp4 file formats. It looks complicated but fears not, there is not much to set for each compression. How long may Handbrake convert or compress a video? That obviously will also depend on how big is the file. For example, a 64GB source file may take about 6-8 hours to process. Once done, there will be a faint tick sound, and the percentage progress display will be gone.
Please note that Handbrake can be quite resource-intensive. Once Handbrake is running for some time, I would expect the desktop to be running quite slow for other active tasks. My advice is to leave it till the last to run overnight after you have completed other shorter and important stuff.
Simple steps for Handbrake video compression and conversion:
- Launch Handbrake and select the video for compression
- Use the default preset – Fast 1080p30
- Under the summary tab, enable Web Optimized (optional)
- Under the video tab, adjust RF to 25 and enable Constant framerate (optional)
- Change the directory and the new filename to save as at the bottom
- Click Start above to start processing and wait to finish with the percentage progress displayed
Note: If you are using Handbrake numerous times, it can be worth it to Save New Preset, and select it from the Preset dropdown every time.
What to do if HandBrake is too CPU intensive and made the system slow?
That is a valid concern. Unrestrained, Handbrake CPU resources can go up to almost 400%, leaving the system slow to do anything else. There are at least 2 solutions to go about it.
One, you can click the pause button in Handbrake, and finish up other stuff before coming back to resume it.
You have to know to click App Police (a little icon in the menu near the top right) after installing and launching.
And go to Preferences and enable Show System Processes. Go to Running Apps, locate HandBrakeXPCService, click it and control how much CPU usage to allocate it. If there are too many processes to view, know that it is in alphabetical order so scroll quickly to H.
Your system should be faster even with Handbrake running. I believe we should switch back after so that Handbrake will not take too long to complete.
App Police is a free but very useful to help curb the CPU hungry HandBrake app so you can do other work e.g. setting it to 100 or less for limit. Users can also choose to Pause All Limits from the icon dropdown to let the system resume its default usage.
Bonus: How to combine an image with an audio file with ffmpeg?
There may be situations when we simply want an image joined with an audio file for the whole duration as one video file. This can be done with the command line with ffmpeg as well.
ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 96k -pix_fmt yuv420p -shortest out.mp4
The above command will create the video file with an audio bitrate of 96kbps. I found and modified the above command from here.
Converting, looping, and compressing video files may seem mundane or insignificant, but it can matter in terms of saving time, energy, and bandwidth. FFmpeg is a free and powerful solution for this and more.
FFmpeg is a complex program but anyone with basic knowledge of the command line should be able to perform the basic ffmpeg commands outlined in this post.
Converting from one media to another can save about a third in file size in an example test. However, it is the compression test in the same MP4 formats that is surprising with over 90% size savings.
Looping a video can be essential in some cases, for example, in some YouTube niches. Though I have been looping my videos with iMovie currently, ffmpeg looping can still be an option for those who prefer it.
Handbrake can be a really convenient and useful gem of a free tool to help convert and compress videos.
FFmpeg or Handbrake takes too long. Is there a faster method?
If you are on Windows, you may be in luck. I read on Quora that WinAVi can compress/convert in 10 minutes what Handbrake does in 4 hours! But I have not tested it nor sure it can work with YouTube.
Why choose MP4 and H.265 for YouTube video format?
In addition to MP4, H.265, please take note to use the same recording frame rate for the export frame rate. More information can be found below.
How large is ffmpeg?
Not large at all. For example, it is only about 23.2MB for a Mac zip download.
How to convert an audio file with FFmpeg? How to convert aac or wav files to mp3 format with ffmpeg?
We can easily convert between audio file formats with FFmpeg as well. Here is one working example I used recently to convert an old format to a new one.
$ffmpeg -i input_file.ogg new_file.mp3
This was done within minutes.
Below is an example of converting from aac to mp3 format by specifying an option
ffmpeg -i input.aac -acodec libmp3lame output.mp3
Another option is to convert with more options e.g. converting to a 96kbps audio bitrate that may result in smaller file size.
ffmpeg -i input.wav -vn -ar 44100 -ac 2 -b:a 96k output.mp3
You may read more about it here.
Are there any basic Mac terminal commands tutorials for beginners?
If you are new to Mac command lines, you may want to watch the below or any related videos there. Windows and Linux commands can be the same or similar as well.
You may find these commands helpful as well:
ls -hl will display the files’ sizes in the human-readable format in the current directory.
open . will launch the file explorer graphical window for the current directory so we can do more.
How to quickly play or preview a (large) video or image file on a Mac desktop?
Select the mp3 or mp4 or image file e.g. jpeg, and simply press the Spacebar to start playing or preview. It should launch quickly, as fast, or even faster than ffplay. Pressing the Spacebar again will stop and quit. This function is beneficial and will even launch large files quickly e.g. 64GB. I use it to check or capture screenshots for cover design.
Note: Did you know we users also click the pen tip icon while viewing the image with Spacebar, and make simple edits without launching Preview?
How to compress or convert images for free with the terminal or command line?
For command line users, this can easily and quickly be done with the free and powerful Image Magick program with just a single line, for example we want to convert a png to a much smaller jpg file:
magick input_file.png -quality 85% output_file.jpg
Do not worry about the reduction in quality in general, it is usually imperceptible to the average eye.
For more information about what else Magick can offer, please read 13 ImageMagick Features: Free Image Greyscale, Convert, Watermark, & More.
For Mac desktop users, you may also explore Preview (How To Annotate Images & PDFs In Mac Preview And More) for exporting the image to another format.
How to know if a song or music is allowed , restricted, or copyrighted for YouTube use?
It is important we keep our YouTube channel in good status. There are tons of information regarding what music or song are safe or not, however, I learned and agree that perhaps the best approach is to let YouTube’s robust checking system to verify and check for video creators.
We can choose to upload a short video with the music and song, and let YouTube check for free to know. YouTube may take hours or few days before reporting copyright claims.
We can also view any copyright issue or information in YouTube Studio -> Channel Content as shown.
If you get a copyrighted claim, do not panic. It may be a case of copyrighted content that is allowed by the owner for YouTube use. In any case, research and use content that you believe is safe for YouTube use and does not blatantly infringe someone else’s rights.