Topic: Issue uploading a video

Posted under General

I've been converting videos to the correct format using FFMPEG for months, but one of the videos is giving me this error adn I don't know what it means.

error: ActiveRecord::RecordInvalid - Validation failed: video is anamorphic (SAR is 40:33)

I have been using the following line:

"D:\FFMPEG\ffmpeg-7.1.1-full_build\ffmpeg-7.1.1-full_build\bin\ffmpeg.exe" -i "unconverted video.mp4" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "converted video.mp4"

Of course replacing "unconverted video" and "converted video" with the path as needed. This has been working just fine for ages, up until this video here https://www.furaffinity.net/view/60211721/ I have been uploading all the animations from this artist from oldest to newest posts. I would appreciate it if anyone could help me fix this issue.

I am doing this, and have been doing this on a Windows 11 computer.

Updated

freakazoid123 said:
I've been converting videos to the correct format using FFMPEG for months, but one of the videos is giving me this error adn I don't know what it means.

error: ActiveRecord::RecordInvalid - Validation failed: video is anamorphic (SAR is 40:33)

See topic #37202.

So from what I could find, apparently:

The command I am using is almost fine. The problem is simply that FFmpeg is preserving the original anamorphic pixel aspect ratio, so the output still has SAR 40:33, and the site rejects it.

I just need to force square pixels (SAR 1:1) during the video filter stage.

So the new command I have is:

"D:\FFMPEG\ffmpeg-7.1.1-full_build\ffmpeg-7.1.1-full_build\bin\ffmpeg.exe" -i "unconverted video.mp4" -vf "setsar=1" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "converted video.mp4"

With the added -vf "setsar=1" to force the anamorphic pixel aspect ratio into the desired ratio. I'll update this comment soon on if this worked or not.

Update: It worked! For some reason it also made the process significantly faster than the previous method, and I do not know why this is. Starting at a speed around x0.1 instead of the usual speed of around x0.01 (In both cases, the number slowly climbs higher and higher)

Very cool.

Updated

freakazoid123 said:
I edited my message to add more context in the issue I'm having.

I'm not that well-versed on all of the possible commands used on FFMPEG, so everything I say beyond this point is purely assumptions and should not be taken as a definitive fix.

Assuming that your command had always worked prior to this post, it is very likely that the artist had encoded the animation with the anamorphic setting enabled. This means that even after using your conversion command, it still remains set as anamorphic.

A preliminary Google search with Gemini AI on how to disable this setting using FFMPEG suggests the following:

  • To disable the anamorphic display setting in FFmpeg, you should use the setsar=1:1 filter to enforce square pixels and potentially a scale filter to adjust the display resolution. This process, known as "desqueezing," ensures the video plays with the correct aspect ratio on all devices.
  • The general command structure for disabling anamorphic video and forcing square pixels (1:1 Sample Aspect Ratio or SAR) is as follows: ffmpeg -i input_video.mkv -vf "scale=iw*sar:ih,setsar=1:1" -c:a copy output_video.mp4.
  • Command Breakdown
    • -i input_video.mkv: Specifies your source file.
    • -vf "scale=iw*sar:ih,setsar=1:1": This is the key video filtergraph.
      • scale=iw*sar:ih: Resizes the video horizontally to its intended display width (iw for input width multiplied by the sar or sample aspect ratio), while keeping the input height (ih) the same. This converts the anamorphic pixels into square pixels while maintaining the displayed image's proportions.
      • setsar=1:1: Explicitly sets the output Sample Aspect Ratio (pixel aspect ratio) to 1:1 (square pixels) in the metadata, so players know not to apply any further anamorphic scaling.
    • -c:a copy: Copies the audio stream directly without re-encoding, saving time and preventing quality loss.
    • output_video.mp4: The name of the new, correctly proportioned output file.

I'm going to assume that including -vf "scale=iw*sar:ih,setsar=1:1" into your existing FFMPEG command would fix the issue, but I can't be sure if it would screw anything else up.
I would suggest waiting for someone with a better understanding of the program and the conversion process to chip in with their solution.

thegreatwolfgang said:
I'm not that well-versed on all of the possible commands used on FFMPEG, so everything I say beyond this point is purely assumptions and should not be taken as a definitive fix.

Assuming that your command had always worked prior to this post, it is very likely that the artist had encoded the animation with the anamorphic setting enabled. This means that even after using your conversion command, it still remains set as anamorphic.

A preliminary Google search with Gemini AI on how to disable this setting using FFMPEG suggests the following:

  • To disable the anamorphic display setting in FFmpeg, you should use the setsar=1:1 filter to enforce square pixels and potentially a scale filter to adjust the display resolution. This process, known as "desqueezing," ensures the video plays with the correct aspect ratio on all devices.
  • The general command structure for disabling anamorphic video and forcing square pixels (1:1 Sample Aspect Ratio or SAR) is as follows: ffmpeg -i input_video.mkv -vf "scale=iw*sar:ih,setsar=1:1" -c:a copy output_video.mp4.
  • Command Breakdown
    • -i input_video.mkv: Specifies your source file.
    • -vf "scale=iw*sar:ih,setsar=1:1": This is the key video filtergraph.
      • scale=iw*sar:ih: Resizes the video horizontally to its intended display width (iw for input width multiplied by the sar or sample aspect ratio), while keeping the input height (ih) the same. This converts the anamorphic pixels into square pixels while maintaining the displayed image's proportions.
      • setsar=1:1: Explicitly sets the output Sample Aspect Ratio (pixel aspect ratio) to 1:1 (square pixels) in the metadata, so players know not to apply any further anamorphic scaling.
    • -c:a copy: Copies the audio stream directly without re-encoding, saving time and preventing quality loss.
    • output_video.mp4: The name of the new, correctly proportioned output file.

I'm going to assume that including -vf "scale=iw*sar:ih,setsar=1:1" into your existing FFMPEG command would fix the issue, but I can't be sure if it would screw anything else up.
I would suggest waiting for someone with a better understanding of the program and the conversion process to chip in with their solution.

I included -vf "setsar=1" in the new command and that worked. Thanks for the help!