Topic: Can't upload my video even tho it's a webm.

Posted under e621 Tools and Applications

I've been trying to upload a video saved as a webm. However, when I go to post it, the site presents me this message: "error: ActiveRecord::RecordInvalid - Validation failed: File ext application/x-matroska is invalid (only JPEG, PNG, GIF, and WebM files are allowed"

Supported Filetypes

VP9 with Opus for audio preferred, VP8 and Vorbis supported. Matroska container not supported.

The Matroska container is not supported, so you will have to use VP9 or VP8. I suggest messaging Mairo, he can help you with that.

Use FFmpeg.
Use this command to see information about your video:

ffmpeg -i [input file]

If Stream #0:0: Video is not VP8 or VP9, you have to transcode the video.
If Stream #0:1: Audio is not Opus or Vorbis, you have to transcode the audio.
If both streams are the right codec, then you only need to remux the streams. For that you use the following command:

ffmpeg -i [input file] -c:v copy -c:a copy -f webm [output file].webm

If you have to transcode video (but not audio), you use the following command:

ffmpeg -i [input file] -c:v libvpx-vp9 -row-mt 1 -b:v [an appropriate bit rate for video] -c:a copy -f webm [output file].webm

If you have to transcode audio (but not video), you use the following command:

ffmpeg -i [input file] -c:v copy -c:a libopus -b:a [an appropriate bit rate for audio] -f webm [output file].webm

If you have to transcode both audio and video, you use the following command:

ffmpeg -i [input file] -c:v libvpx-vp9 -row-mt 1 -b:v [an appropriate bit rate for video] -c:a libopus -b:a [an appropriate bit rate for audio] -f webm [output file].webm

Edit:
If your file does not contain audio, use the following command to remux:

ffmpeg -i [input file] -c:v copy -f webm [output file].webm

Use this to transcode:

ffmpeg -i [input file] -c:v libvpx-vp9 -row-mt 1 -b:v [an appropriate bit rate for video] -f webm [output file].webm

The text between square brackets as well as the brackets themselves is meant to be replaced with data such as file names and bit rates. Do not put file names or bit rates in between brackets.

Updated

How e621 handles files is that it completely scrubs the filename, it calculates MD5 hash which will be the main part of the filename, then it checks for file header and uses that as extension.
So what this means in practise that if you rename .exe file into .jpg, the site completely ignores the filename, checks that it's .exe and just says that you cannot upload .exe files here. Same is happening here, you are trying to upload .mkv file, even if you or someone else have renamed it to .webm.

This is also the reason why we have about ~45 000 posts from Furaffinity where FA claims the file to be .png but e621 corrects them to be .jpg what they actually are: filetype:jpg source:*facdn*.png*

electricitywolf said:
Use FFmpeg.
Use this command to see information about your video:

Damn, I wasn't even needed here, that's extremely rare.

There has been cases here where completely empty audio track has caused the video not playback to users (wrong codec, surround audio, etc.) or the container was somehow corrupted while the tracks were intact, so in these cases simply moving the tracks to new container like this has made them work without touching the actual content itself at all, so this is extremely valid approach here. I would also prefer it if audio editors used this much more often as then I wouldn't have to deal with ultra compressed audio edit uploads when the visuals weren't even touched in any manner.

With transcoding though I would highly suggest using constant quality mode instead of contrained bitrate mode, so that the filesize isn't bloated for no reason or the quality doesn't suffer with too low value. CRF 16 has been generally good starting point and only if the video is so long or complex that 100MB filesize exceeds, then calculate approximate bitrate and encode with that.

  • 1