Facebook-owned WhatsApp is the most popular messaging platform with over 2+ billion monthly active users worldwide. It allows us to send text and voice messages, share audios and videos, share documents, and even transfer money to other WhatsApp users. At times, I share some cool, funny and inspirational videos to all my WhatsApp contacts. I also set them as my WhatsApp status message. The other day I received the error "Video is not supported" when I tried to share a video to my WhatsApp status. After going through FFmpeg manual pages and bit of trial and error, I found a workaround to convert videos to WhatsApp video format with FFmpeg in Linux.
If you don't know already, FFmpeg is one of the best multimedia framework which is used to encode, decode, transcode, mux, demux, record, stream, filter, and play any type of media files. It is completely free, open source and cross-platform multimedia framework, which supports Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc.
Of course, there are many video converters freely available on the Internet to convert videos to whatsapp supported format. However, converting videos to whatsapp supported format with FFmpeg is very easy and fast in my opinion.
Convert videos to WhatsApp video format with FFmpeg
I tried different container format (video codec + audio codec) videos with various resolutions as listed below.
- MP4 MPEG4 480x360, 640x360
- MP4 MPEG4 720P
- MP4 MPEG4 + AAC
- MP4 H264 + AAC
- Matroska MPEG4 + AAC
- AVI MPEG4 + AAC
- AVI H264 + AAC
- AVI 720P XVID
- AVI 720P MPEG4
- AVI 480x360 XVID
- AVI 360P XVID
- AVI 320x240 AVC
The following container format worked just fine.
- MP4 (H264 + aac)
If you want to share a video to your contacts or set it as your WhatsApp status, convert it to the above container format.
Make sure you have installed FFmpeg on your Linux system. If haven't installed it yet, refer the following guide.
After installing FFmpeg, go to the location where the videos are stored and run the following command to convert videos to WhatsApp format:
$ ffmpeg -i ostechnix.mp4 -vcodec libx264 -acodec aac whatsapp.mp4
That's it. Now you can able to share the resulting output video via WhatsApp without any issues.
-i ostechnix.mp4- the input file to be converted to whatsapp video format.
-vcodec libx264- supported video codec format by whatsapp.
-acodec aac- supported audio codec format by whatsapp.
whatsapp.mp4- the output file.
You can check the details of output media file details using Mediainfo program.
$ mediainfo whatsapp.mp4
I converted and shared many videos with this format in WhatsApp. All of them worked as expected. And also I could share videos with 1280x720 resolution.
I guess any video resolution should work with this setting. If you have time and patience, you can check more combinations with different audio/video codecs, bit rate, resolution, aspect ratio etc., and choose which one works and which one does not.
More FFmpeg command examples are given in the following link.