Unable to upload MP4 videos, gives error message: "Your media file could not be processed."



I have tested using the python script provided and it returns an error code 1 and could not find any indication as to what part of the mp4 is causing the video. I have transcoded the video track (using FFMPEG and copying the audio track) and the upload works, however; the original video track encoding meets all the requirements specified in Twitter’s documentation. This also, does not explain how the original mp4 uploads successfully using Twitter’s official mobile applications.

The video can be downloaded from the following link: https://drive.google.com/file/d/1oiyD8llImKDY56v7NIaeDTmL2wdWZEph/view?usp=sharing

@eos1d3, I agree that the root cause is from Twitter. We have had no problem uploading the media to other social media platforms. Re-transcoding video tracks would take substantially more time and resources.


Error code 1 does not sound like something that the python app would return. When I have time next week I’ll see what happens when I can upload your file.


Hi @andypiper, Thank you for your reply.

Error code 1 is the error code being returned from the Twitter API. This is the entire json response from the request:

{u'media_key': u'7_1080773046749806592', u'media_id_string': u'1080773046749806592', u'media_id': 1080773046749806592, u'processing_info': {u'state': u'failed', u'error': {u'message': u'file is invalid', u'code': 1, u'name': u'InvalidMedia'}, u'progress_percent': 100}, u'size': 9912711}

It states the file is invalid, but I am not sure why it’s invalid, and why we do not get an error message from Twitter mobile applications.


Now this is funny. You said you copy audio with ffmpeg while I just copy video part and encode audio. This means both audio and video do not have problem. It is likely Twitter just cannot parse some format of video file data and the problem may not be related to encoding.

But both Weibo and Instagram accept these files. Twitter has no excuse to say they have their own requirements. It is annoying to further process before upload.


@JonMallettVualto on your file: House_of_Commons_13-12-18_09-36-11.mp4
In the movie header, there are two SPS (Sequence Parameter Set) headers. We only support one.


@eos1d3 on your video 0034mu3ilx07l1cKf0IE010402004GQI0k010.mp4
It has HE_AAC audio codec instead of AAC_LC. We don’t support HE_AAC as of now.


Thank you for your reply. I’ll look into how this can be amended in our mp4, hopefully there’s a way to change this during the trans-muxing process. Is this something Twitter will support in the future?

Also, out of curiosity, what do the Twitter mobile apps do differently? Does it re-transcode the video within the app before upload? As mentioned before, we’ve had no issues testing the videos using Twitter apps on mobile.


I’m having the same issue.


Same issue here.
When uploading a video from the mobile the video is playing in slow motion.
When uploading the same video from a desktop I’m getting “Your media file could not be processed.”
I hope there will be some other workaround for this issue then replacing the audio codec of the video.