Fix #3615: Unsupported video codecs.
Don't allow uploading videos with unsupported video codecs. The only video codecs we allow for MP4 files are H.264 and VP9. Other codecs, including H.265 (aka HEVC), MPEG-4 part 2, and AV1, are disallowed because they're not universally supported by browsers. Firefox doesn't support H.265 or MPEG-4 part 2, and Safari doesn't support AV1. Additionally, don't allow videos with multiple video tracks, multiple audio tracks, or no video tracks. Multiple video and audio tracks are disallowed because they're rare and for moderation purposes, we don't want people hiding content in extra tracks. These restrictions really only apply to MP4 videos, since WebM files don't support multiple video or audio tracks and only support a limited number of codecs (VP8 and VP9 for videos, Vorbis and Opus for audio). There are currently 22 posts with unsupported video codecs: * https://danbooru.donmai.us/posts?tags=video+is:mp4+-exif:Track1:CompressorID=avc1+-exif:Track2:CompressorID=avc1+-exif:Track1:CompressorID=vp09+-exif:Track2:CompressorID=vp09 # AVC1 is H.264 There is one post that has multiple audio tracks: * https://danbooru.donmai.us/posts/2382057
This commit is contained in:
@@ -31,7 +31,7 @@ class PostPreviewComponentTest < ViewComponent::TestCase
|
||||
|
||||
context "for a video post with sound" do
|
||||
should "render" do
|
||||
@post = create(:post_with_file, tag_string: "sound", filename: "test-audio.mp4").reload
|
||||
@post = create(:post_with_file, tag_string: "sound", filename: "mp4/test-audio.mp4").reload
|
||||
node = render_preview(@post, current_user: User.anonymous)
|
||||
|
||||
assert_equal(post_path(@post), node.css("article a").attr("href").value)
|
||||
|
||||
Reference in New Issue
Block a user