Skip to content

[BUG] Paperclip::Error: Error while transcoding + 500 Error when Uploading Gifs #136

@KaguyaIndustries

Description

@KaguyaIndustries

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When Users try to Upload a gif or video, they receive "500 Error processing thumbnail for uploaded media"

Expected Behavior

User should be able to upload Gifs and Videos just fine.

Steps To Reproduce

Use the following Config

Our docker-compose looks like this:

services:
  db:
    image: postgres:14-alpine
    env_file:
      - .env
    container_name: mastodon_db
    restart: unless-stopped
    shm_size: 256mb
    networks: 
      - mastodon_network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d mastodon -U mastodon"]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - /mnt/storage/postgres/data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    env_file:
      - .env
    container_name: mastodon_redis
    restart: unless-stopped
    networks:
      - mastodon_network
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - /mnt/storage/redis/data:/data

  mastodon:
    image: lscr.io/linuxserver/mastodon:latest
    env_file:
      - .env
    container_name: mastodon
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - NO_CHOWN= #optional
      - LOCAL_DOMAIN=${LOCAL_DOMAIN}
      - WEB_DOMAIN=${WEB_DOMAIN} #optional
      - SITE_TITLE=${SITE_TITLE}
      - SITE_SHORT_DESCRIPTION=${SITE_SHORT_DESCRIPTION}
      - REGISTRATIONS_MODE=open              # open | approved | none; no approval needed, as it is restricted by EMAIL_DOMAIN_ALLOWLIST
      - EMAIL_DOMAIN_ALLOWLIST=SECRET
      - SITE_CONTACT_USERNAME=admin          # account has to exist
      - SITE_CONTACT_EMAIL=SECRET
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - DB_HOST=db
      - DB_PORT=5432
      - DB_USER=${POSTGRES_USER}
      - DB_NAME=${POSTGRES_DB}
      - DB_PASS=${POSTGRES_PASSWORD}
      - DB_POOL=5 #optional
      - SECRET_KEY_BASE=${SECRET_KEY_BASE}
      - OTP_SECRET=${OTP_SECRET}
      - VAPID_PRIVATE_KEY=${VAPID_PRIVATE_KEY}
      - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY}
      - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY}
      - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT}
      - SMTP_SERVER=${SMTP_SERVER}
      - SMTP_PORT=${SMTP_PORT}
      - SMTP_LOGIN=${SMTP_LOGIN}
      - SMTP_PASSWORD=${SMTP_PASSWORD}
      - SMTP_FROM_ADDRESS=${SMTP_LOGIN}
      - SIDEKIQ_ONLY=false #optional
      - SIDEKIQ_QUEUE= #optional
      - SIDEKIQ_DEFAULT=false #optional
      - SIDEKIQ_THREADS=5 #optional
      - ES_ENABLED=false
      - ES_HOST=es #optional
      - ES_PORT=9200 #optional
      - ES_USER=elastic #optional
      - ES_PASS=elastic #optional
      - S3_ENABLED=false
      - S3_BUCKET= #optional
      - AWS_ACCESS_KEY_ID= #optional
      - AWS_SECRET_ACCESS_KEY= #optional
      - S3_ALIAS_HOST= #optional
      - MASTODON_PROMETHEUS_EXPORTER_ENABLED= #optional
    volumes:
      - /mnt/storage/config:/config
      - ./mastodon-bootstrap:/custom-cont-init.d:ro
      - ./docs/richtlinien:/richtlinien:ro
      - ./mastodon-branding:/branding:ro
    ports:
      - ${LOCAL_PORT}:80
      #- 443:443
      - 9394:9394
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - mastodon_network


networks:
  mastodon_network:
    driver: bridge
    ipam:
      config:
        - subnet: 10.10.10.0/24

and then try to upload Gifs or Videos

Environment

- OS:Debian GNU/Linux 13 (trixie)
- How docker service was installed: distro's packagemanager using this documentation https://docs.docker.com/engine/install/debian/

CPU architecture

x86-64

Docker creation

Use docker compose with the specified Config

Container logs

> I, [2026-03-16T12:29:49.332953 #433]  INFO -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] [paperclip] Trying to link /tmp/RackMultipart20260316-433-29abkk.mp4 to /tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh.mp4
I, [2026-03-16T12:29:49.333983 #433]  INFO -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] [paperclip] Trying to link /tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh.mp4 to /tmp/bc1469b305cf03fb1cb4aad0919e862920260316-433-5rcung.mp4
I, [2026-03-16T12:29:49.334391 #433]  INFO -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] Command :: file -b --mime '/tmp/bc1469b305cf03fb1cb4aad0919e862920260316-433-5rcung.mp4'
I, [2026-03-16T12:29:49.521903 #433]  INFO -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] Command :: ffmpeg -nostdin -ss '0' -i '/tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh.mp4' -loglevel 'fatal' -vf 'scale='\''min(640\, iw):min(640\, ih)'\'':force_original_aspect_ratio=decrease' -f 'image2' -vframes '1' -y '/tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh20260316-433-caswzd.png'
E, [2026-03-16T12:29:49.665645 #433] ERROR -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] Paperclip::Error: Error while transcoding a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh: Command 'ffmpeg -nostdin -ss '0' -i '/tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh.mp4' -loglevel 'fatal' -vf 'scale='\''min(640\, iw):min(640\, ih)'\'':force_original_aspect_ratio=decrease' -f 'image2' -vframes '1' -y '/tmp/a81df3ed1ecc0ec6df787ab132a3259c20260316-433-aqw0uh20260316-433-caswzd.png'' returned nil. Expected 0
Here is the command output: STDOUT:



> STDERR:


> I, [2026-03-16T12:29:49.666450 #433]  INFO -- : [dde59c48-d6ad-4e5b-a2ad-912d430e6cee] method=POST path=/api/v2/media format=html controller=Api::V2::MediaController action=create status=500 allocations=3589 duration=341.81 view=0.47 db=0.97

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions