ffmpeg - whatsapp: video format not supported

Santhosh picture Santhosh · Oct 6, 2016 · Viewed 16.7k times · Source

I have two videos (.mp4) files. One uploads to whatsapp and another does not.

Using ffmpeg I checked their properties:

a) Properties of video which uploads:

  Duration: 00:00:56.45, start: 0.148000, bitrate: 1404 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x1080, 1359 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 47 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified

b) video which does not upload to whatsapp (because its says format not supported)

  Duration: 00:00:56.10, start: 0.000000, bitrate: 543 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 1080x1080 [SAR 1:1 DAR 1:1], 464 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 47.95 tbc
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 56 kb/s

The difference in video I noticed:

(avc1 / 0x31637661) vs (H264 / 0x34363248)

1359 kb/s vs 464 kb/s

90k tbn vs 23.98 tbn

What can be the reason?

Also the second video is not being played in Android.

The link for the video is https://drive.google.com/open?id=0B4UM6vTHw4pyMExQQ1lxZGp0N2c

Answer

Mario Mey picture Mario Mey · Aug 25, 2017

There are some options for a better compatibility:

ffmpeg -i broken.mp4 -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p working.mp4

With -profile:v baseline -level 3.0 you make the file more compatible with most older players, including WhatsApp ;). Although, this disables some advanced features.

-pix_fmt yuv420p is necessary to compile to baseline (YUV planar color space with 4:2:0 chroma subsampling).

Also, you can adjust other options as bitrate, framerate, audio, etc.

Source: H.264 docs