How do I increase the max. video size or resolution for uploads?

Viewed 17

Default video size of 40 MB is not always sufficient. Newer phones also have higher resolution than 1920x1200 which also prevents uploads.

1 Answers

The customization is tested and works for Mastodon 4.1.1

1. Increase maximum video size and resolution for uploads (from 40 to 100 MB and 1920x1200 to 1920x1440)

As mastodon:

cd ~/live
cp -p app/models/media_attachment.rb app/models/media_attachment.rb.orig
sed -i 's/40.mega/100.mega/g' app/models/media_attachment.rb
sed -i 's/2_304_000 # 1920x1200px/2_764_800 # 1920x1440px/g' app/models/media_attachment.rb

RAILS_ENV=production bundle exec rails assets:precompile && echo "pass" || echo "fail"

As root:

service mastodon-web reload

2. Before upgrades, revert customization (otherwise “git checkout” will complain)

As mastodon:

cd ~/live
cp -p app/models/media_attachment.rb.orig app/models/media_attachment.rb

3. After upgrade, just repeat “Implement customization” again