superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.82k stars 331 forks source link

[bug/v0.17.0-rc1] ffmpeg/upload bug, error 422 unprocessable entity #3362

Closed cadusilva closed 1 month ago

cadusilva commented 1 month ago

Describe the bug with a clear and concise description of what the bug is.

I was hoping someone would report this, but I guess it's a pretty particular case. When trying to upload a media file like an opus audio or mp4 video, there's this error:

OPUS file (5 MB):

statusCode=422 path=/api/v2/media errors="Error #01: StoreLocalMedia: error processing media: store: error cleaning metadata: ffmpeg: non-zero return code 1 ([ogv @ 0xae8a70] Unsupported codec id in stream 0\nCould not write header for output file #0 (incorrect codec parameters ?): Invalid argument\nError initializing output stream 0:1 -- \n\n)\n" msg="Unprocessable Entity: wrote 72B"

MP4 video (61 MB):

statusCode=422 path=/api/v2/media errors="Error #01: StoreLocalMedia: error processing media: store: error draining data to tmp: reached read limit 128MiB\n" msg="Unprocessable Entity: wrote 72B"

There's enough disk space and reducing the max media size in the config file didn't help. The /tmp directory is not a partition or in-memory and there's 13 GB of free space.

Is this expected? Uploading a mp3 file went fine.

Running Debian 12 amd64, GoToSocial 0.17.0-rc1+git-de72855, binary version (but happened with Docker version too).

Thank you!

What's your GoToSocial Version?

0.17.0-rc1+git-de72855

GoToSocial Arch

amd64 binary

What happened?

Uploading media files like opus audio or mp4 video results in ffmpeg failing to process the file or a weird error draining data to tmp message.

What you expected to happen?

Files converted as necessary and able to be successfully published.

How to reproduce it?

Try to upload an opus or mp4 file and after sending the file, there's an 422 error.

Anything else we need to know?

media-local-max-size: 128MiB
media-remote-max-size: 128MiB
tsmethurst commented 1 month ago

Thanks for reporting ^_^

NyaaaWhatsUpDoc commented 1 month ago

ah the big buck bunny :D

also yes thank you for reporting! will get right on this

cadusilva commented 1 month ago

Thank you, people!

So, I downloaded this file (via), converted it to opus using the same software and with the same settings as the file with the reported error, and then, this time... It worked.

I tried another file, this time the "Study and Relax" from here. Same software, same settings and the error 422 was back with the output'd opus file.

cadusilva commented 1 month ago

About the converter settings:

Screen capture showing Opus selected as codec with 'insanely high' bitrate settings and 48 kHz resample

NyaaaWhatsUpDoc commented 1 month ago

found and fixed :)

NyaaaWhatsUpDoc commented 1 month ago

thank you again for the detailed report @cadusilva !

cadusilva commented 1 month ago

Hooray! Thanks for the fix 😄