Ffmpeg mp4 upload to Twitter - Unsupported Error


I have created a screencast, it was saved as webm. Using ffmpeg I converted it to a mp4:

That kind of file isn’t supported yet. Try uploading a gif, video, or picture instead.

ffmpeg -f input.webm -pix_fmt yuv420p -strict -2 output.mp4

I use yuv420p as that is what this topic says for twitter - Unable to upload video to twitter

However when I open a new tab, go to twitter, click the photo icon, clicking upload instantly gives me error “That kind of file isn’t supported yet. Try uploading a gif, video, or picture instead.”. It cant check the pix format that fast. Anyonek now what can be going on here?

Here is a screenshot:


I’m not sure that command line will actually convert the content to h.264 video and AAC audio. You may need to add in flags explicitly for that:
-vcodec libx264
Will force transcode to h.264 video, and:
-acodec aac
Will force transcode to AAC audio.

So try this command line:
ffmpeg -i input.webm -vcodec libx264 -pix_fmt yuv420p -strict -2 -acodec aac output.mp4


Oh wow I didn’t expect such a fast reply! Thank you so much! I will test now and report back.


Oh shoot I am getting Unknown encoder 'libx264' here is my output:

ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  9 2014 20:01:41 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
  configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
[vp8 @ 0xdde460] Warning: not compiled with thread support, using thread emulation
Input #0, matroska,webm, from 'input.webm':
    encoder         : QTmuxingAppLibWebM-0.0.1
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p, 1920x1200, SAR 1:1 DAR 8:5, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Unknown encoder 'libx264'

Ah shoot I use ffmpeg.js which has x264 here - https://github.com/bgrins/videoconverter.js/tree/master/build

But I don’t think it was compiled with it per here he says - http://bgrins.github.io/videoconverter.js/

Processing Additional Codecs

       This isn't yet compiled with support for additional codecs 

like zlib, x264, libvpx, etc. It should be possible to do.

Do you know of a non-libx264 command line method? Or are you familiar with ffmpeg.js?

Excuse that, I am just a browser extension developer making a screencast addon that converts to mp4 and gives to user to upload to twitter.


Oh weird, his commits show he did add x264 support:

Are you familiar with ffmpeg.js?


Ok this error is on me somewhere, they do seem to support libx264 - http://bgrins.github.io/videoconverter.js/demo/ he has a H.264 tab there. That’s weird i’ll keep digging at it and let you know how it goes. :slight_smile:


Try “h264” instead of “libx264”? I’m not familiar with ffmpeg.js, sorry! If you can look at the terminal output for your ffmpeg command, you should be able to see what video and audio codecs are used for your output file. You can alternatively use a tool like MediaInfo to inspect. For upload to twitter, you want h.264 video and AAC-LC audio.


Thank you sir so much! I really appreciate your try!
It turned out i was using ffmpeg.js and I had to use ffmpeg-all-codecs.js which did have libx264. It worked perfectly thank you so much!


Hello everybody

for me those conversations did not help.
I am trying to upload test video: http://sample-videos.com/video/mp4/720/big_buck_bunny_720p_5mb.mp4

sample video could not be uploaded too (befoce converting).
tried this combinations:

ffmpeg -i SampleVideo_1280x720_5mb.mp4 -vcodec libx264 -pix_fmt yuv420p -strict -2 -acodec aac output.mp4

ffmpeg -i SampleVideo_1280x720_5mb.mp4 -vcodec libx264 -pix_fmt yuv420p -strict -2 -acodec aac -profile:v baseline output2.mp4

ffmpeg -i SampleVideo_1280x720_5mb.mp4 -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 output3.mp4

ffmpeg -i SampleVideo_1280x720_5mb.mp4 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart output4.mp4

none worked. maybe you could point me in direction?
video size is 5 mb
duration 29 seconds…