Topic: Mp4 conversion issues / quality degradation

Posted under General

So I've been uploading a bunch from furaffintiy over to e621, but the artist uploads to furaffintiy in an mp4 format which e621 doesn't accept. I convert the MP4s into AV1 format using this website ( https://convertio.co/mp4-av1 ). It seems to work, but staff have noted that there seems to be some fort of degradation happening in the conversion process. so when I upload the video, the staff have been kind enough to replace the posts with a version with better quality. Though the issue here is, as they are being replaced, my upload limit is slowly going down. I'm now at a limit of 9 and I do not wish to have that go any lower, considering I have over 100 more animations to post. I would very much appreciate it if someone could provide me with a way to convert these MP4 videos to an AV1 format without any issues resulting in a post replacement.

donovan_dmc said:
I reiterate again, people never listen

Mairo mentioned handbrake in your original topic, either look up how to use ffmpeg or figure out how that thing works

I wish I knew enough of this tech speak to be able to listen properly.

donovan_dmc said:
I reiterate again, people never listen

Mairo mentioned handbrake in your original topic, either look up how to use ffmpeg or figure out how that thing works

I got it, now I just gotta learn how to make it work.

donovan_dmc said:
I reiterate again, people never listen

Mairo mentioned handbrake in your original topic, either look up how to use ffmpeg or figure out how that thing works

Alright, so what are the specifics of AV1 format which is better for e621? AV1 (SVT) or AV1 10-bit (SVT)? Having the specifications of which file types/encoding things work best for e621 would help. I wish e621 had a little guide on how to get the best conversions of videos to use on the website.

freakazoid123 said:
I wish I knew enough of this tech speak to be able to listen properly.

I got it, now I just gotta learn how to make it work.

https://trac.ffmpeg.org/wiki/Encode/AV1
ffmpeg -i input.mp4 -metadata title="CHANGE THIS TITLE" -metadata comment="CHANGE THIS SOURCE URL" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart output.mp4
On Handbrake, enable "web optimized", disable all resolution limits and anamorphic, all filters off, encoder SVT, FPS same as source and constant, preset to 0, quality to 14 RF, audio either disable if there's none, passthrough if it's AAC or convert to 160k opus if you have no idea, disable subtitles and chapters and I guess that's all.

freakazoid123 said:
Alright, so what are the specifics of AV1 format which is better for e621? AV1 (SVT) or AV1 10-bit (SVT)? Having the specifications of which file types/encoding things work best for e621 would help. I wish e621 had a little guide on how to get the best conversions of videos to use on the website.

e621:supported_filetypes "..Should be YUV420 8bit.."
Ideally artists themselves would do this from their own software to begin with, but constant quality mode with slow encoding settings should be enough.

howto:transcode and convert if I had any extra time to do shit, already just moved howto:sites and sources away from my profile and others took over it.
Doesn't help that there's so many variables and then software also updates, apparently SVT only had three pass, now has two pass mode, but it's still not exposed to FFmpeg so????

mairo said:
https://trac.ffmpeg.org/wiki/Encode/AV1
ffmpeg -i input.mp4 -metadata title="CHANGE THIS TITLE" -metadata comment="CHANGE THIS SOURCE URL" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart output.mp4
On Handbrake, enable "web optimized", disable all resolution limits and anamorphic, all filters off, encoder SVT, FPS same as source and constant, preset to 0, quality to 14 RF, audio either disable if there's none, passthrough if it's AAC or convert to 160k opus if you have no idea, disable subtitles and chapters and I guess that's all.

e621:supported_filetypes "..Should be YUV420 8bit.."
Ideally artists themselves would do this from their own software to begin with, but constant quality mode with slow encoding settings should be enough.

howto:transcode and convert if I had any extra time to do shit, already just moved howto:sites and sources away from my profile and others took over it.
Doesn't help that there's so many variables and then software also updates, apparently SVT only had three pass, now has two pass mode, but it's still not exposed to FFmpeg so????

May I send you what file I got, as to avoid getting in trouble by uploading another video file which is incorrect?

mairo said:
https://trac.ffmpeg.org/wiki/Encode/AV1
ffmpeg -i input.mp4 -metadata title="CHANGE THIS TITLE" -metadata comment="CHANGE THIS SOURCE URL" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart output.mp4
On Handbrake, enable "web optimized", disable all resolution limits and anamorphic, all filters off, encoder SVT, FPS same as source and constant, preset to 0, quality to 14 RF, audio either disable if there's none, passthrough if it's AAC or convert to 160k opus if you have no idea, disable subtitles and chapters and I guess that's all.

e621:supported_filetypes "..Should be YUV420 8bit.."
Ideally artists themselves would do this from their own software to begin with, but constant quality mode with slow encoding settings should be enough.

howto:transcode and convert if I had any extra time to do shit, already just moved howto:sites and sources away from my profile and others took over it.
Doesn't help that there's so many variables and then software also updates, apparently SVT only had three pass, now has two pass mode, but it's still not exposed to FFmpeg so????

Also I'm not seeing a pre-set for "YUV420 8bit"

freakazoid123 said:
I'm new to Handbreak but I'm using it because I was told it would allow me to convert mp4 videos to an appropriate format for e621 with no degradation in quality. It just looks like I've stepped into the cockpit of a Boeing aircraft with all these buttons. I've watched tutorials but none of them are telling me "These are the buttons you want to say these things, for it to work best on e621." If anyone can help me with just figuring out how to correctly convert these videos using this soft ware, it would be much appreciated, and I'd write it down so I do the exact same thing everytime.

This is a great use case for scripting. You copy down the lines you use, and only modify them if you want something changed. Then you can just drag the file on top of the script.
As a bonus, you can also configure frontends to do this for you. Decent ones will list what options they throw at ffmpeg backend. In fact if they don't, that's a bad sign.

Also I'm not seeing a pre-set for "YUV420 8bit"

https://www.videoconverterfactory.com/tips/handbrake-presets.html You can copy an existing one and add that option. It also lets you just use a text file (JSON) to transfer them between PCs. Hmm, maybe we should have a handy list of presets for e621 videos to download on here.

I added some info on how to narrow down to the documentation you want, below.

If you run "ffmpeg -h" without a filename you can list some common options, a lot of options, and damn near all the options. ;) I pasted my steps and results so that others know how to get the information from the program. The online documentation has a lot of the same information, and is maybe easier to read. You can use a program like notepad or nano to read the full dump I linked above. CTRL-F is your friend!

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
    See man ffmpeg for detailed description of the options.

Running "ffmpeg -codecs" gives me:

DEV.L. vp9                  Google VP9 (decoders: vp9 libvpx-vp9 vp9_cuvid vp9_qsv) (encoders: libvpx-vp9 vp9_vaapi vp9_qsv)
DEAIL. opus                 Opus (Opus Interactive Audio Codec) (decoders: opus libopus) (encoders: opus libopus)

Both of them can both encode and decode (DE), VP9 is video (V), Opus is audio (A), both are lossy (L), and I isn't important.
It's telling you what the -encoder and -decoder options support.

Looking up other options Mairo listed:

-vcodec <codec>     alias for -c:v (select encoder/decoder for video streams)
DEV.L. av1                  Alliance for Open Media AV1 (decoders: libdav1d libaom-av1 av1 av1_cuvid av1_qsv) (encoders: libaom-av1 librav1e libsvtav1 av1_nvenc av1_qsv av1_amf av1_vaapi)
 -g                 <int>        E..V....... set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12)
-crf               <int>        E..V....... Select the quality for constant quality mode (from -1 to 63) (default -1)
-an                 disable audio
-movflags          <flags>      E.......... MOV muxer flags (default 0) -> faststart                    E.......... Run a second pass to put the index (moov atom) at the beginning of the file

The metadata title/comment tags are pretty nice to have. The preset of 0 is the most aggressive. AV1 has it's own documentation on the parameters like tune (Perception tuning, 0=Visual quality). "Don't worry, just use it." ;) I am not familiar with g but it seems to mess with seeking by rearranging the frame order. Faststart movflag seems much of the same. Quality of life settings for people playing your output videos.

Some (optional) background info on YUV. It explains "4:2:0" part of the name. The 4CC docs linked from there are nice but not really applicable for just wanting to use some tool. We're not writing our own FFMPEG! ;)

alphamule said:
This is a great use case for scripting. You copy down the lines you use, and only modify them if you want something changed. Then you can just drag the file on top of the script.
As a bonus, you can also configure frontends to do this for you. Decent ones will list what options they throw at ffmpeg backend. In fact if they don't, that's a bad sign.

https://www.videoconverterfactory.com/tips/handbrake-presets.html You can copy an existing one and add that option. It also lets you just use a text file (JSON) to transfer them between PCs. Hmm, maybe we should have a handy list of presets for e621 videos to download on here.

I added some info on how to narrow down to the documentation you want, below.

If you run "ffmpeg -h" without a filename you can list some common options, a lot of options, and damn near all the options. ;) I pasted my steps and results so that others know how to get the information from the program. The online documentation has a lot of the same information, and is maybe easier to read. You can use a program like notepad or nano to read the full dump I linked above. CTRL-F is your friend!

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
    See man ffmpeg for detailed description of the options.

Running "ffmpeg -codecs" gives me:

DEV.L. vp9                  Google VP9 (decoders: vp9 libvpx-vp9 vp9_cuvid vp9_qsv) (encoders: libvpx-vp9 vp9_vaapi vp9_qsv)
DEAIL. opus                 Opus (Opus Interactive Audio Codec) (decoders: opus libopus) (encoders: opus libopus)

Both of them can both encode and decode (DE), VP9 is video (V), Opus is audio (A), both are lossy (L), and I isn't important.
It's telling you what the -encoder and -decoder options support.

Looking up other options Mairo listed:

-vcodec <codec>     alias for -c:v (select encoder/decoder for video streams)
DEV.L. av1                  Alliance for Open Media AV1 (decoders: libdav1d libaom-av1 av1 av1_cuvid av1_qsv) (encoders: libaom-av1 librav1e libsvtav1 av1_nvenc av1_qsv av1_amf av1_vaapi)
 -g                 <int>        E..V....... set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12)
-crf               <int>        E..V....... Select the quality for constant quality mode (from -1 to 63) (default -1)
-an                 disable audio
-movflags          <flags>      E.......... MOV muxer flags (default 0) -> faststart                    E.......... Run a second pass to put the index (moov atom) at the beginning of the file

The metadata title/comment tags are pretty nice to have. The preset of 0 is the most aggressive. AV1 has it's own documentation on the parameters like tune (Perception tuning, 0=Visual quality). "Don't worry, just use it." ;) I am not familiar with g but it seems to mess with seeking by rearranging the frame order. Faststart movflag seems much of the same. Quality of life settings for people playing your output videos.

Some (optional) background info on YUV. It explains "4:2:0" part of the name. The 4CC docs linked from there are nice but not really applicable for just wanting to use some tool. We're not writing our own FFMPEG! ;)

While all this information is very useful, I lack the brain to actually understand what any of it means.

Do you think you could somehow make a preset for an e621 mp4 video? Something I can just select in Handbreak, and always use that option everytime I have a video to upload to e621. I just need to get convert an mp4 into an mp4 which is compatible with e621 and doesn't cause any degradation in the video quality. As of current, I have 288 videos yet to be uploaded to e621, from Kriskawaii on Furaffinity.

Steps to Convert Videos to MP4 Using FFMPEG on Windows:

  • 1) Go to https://ffmpeg.org/ and click on Download and choose the one for your computer's operating system (e.g., Windows, macOS, Linux).
    • If you are on Windows, you will need to download the full release by clicking here. The "essentials" version will not come with the AV1 codec installed.
  • 2) Extract the compressed zip file into an appropriate folder that you are going to use moving forward. I would suggest simply naming it as "FFMPEG".
  • 3) At this point, you should already have FFMPEG extracted and have the video you wish to convert in hand.
  • 4) (Optional) Open an empty notepad to help you with writing the command. You can skip this step and try inserting directly into Command Prompt if you are proficient enough.
  • 5) In the FFMPEG folder, open the "bin" folder and select ffmpeg.exe (don't double click and launch it, it does nothing). Copy the path of the program onto your clipboard (Google if you don't know how to).
  • 6) Go back to your notepad and press CTRL+V to paste the path. If nothing appears, repeat Step 5 again and make sure you have actually copied something.
    • Command should look like: "C:\Users\...\FFMPEG\bin\ffmpeg.exe".
  • 7) In the folder where you have kept the video, select the video you want to convert (e.g., unconverted_video.mp4) and copy the path to that (similar to Step 5).
  • 8) Go back to your notepad and press space once, followed by typing in -i, and then pressing space once more, and finally pressing CTRL+V to paste the input video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4".
  • 9) Copy the following -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart as suggested on @Mairo's comment.
  • 10) Go back to your notepad and press space once, followed by CTRL+V again to paste the remaining commands.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart.
  • 11) Find a suitable folder for where you want your converted file to be. In this case, I will demonstrate by putting it in the same folder as the unconverted video.
  • 12) Repeat Step 7.
  • 13) Go back to your notepad and press space once, followed by CTRL+V to paste the output video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\unconverted video.mp4".
  • 14) Edit the output video's path and rename the file to something else. It should not be the same as the unconverted video. In this case, I'll rename it to converted_video.mp4.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 15) Launch the Command Prompt program by searching for cmd on your Windows search. A black window should pop up with C:\Windows\system32> typed in.
  • 16) Copy the entire command from your notepad and press CTRL+V to paste it onto the Command Prompt.
    • Final command should look like C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 17) Press Enter to begin the conversion process. It may take a while.
  • 18) The conversion is complete once you see C:\Windows\system32> blinking again, and the file should be next to where you had saved your unconverted video.
    • If it is not there or if you had simply put the output path as output.mp4, check whatever directory your Command Prompt program is in. The path shown in Step 15 or Step 18 should be where it is located.
  • 19) (Optional) If you want to add the post's title and URL into the video's metadata, you can simply open the file's properties, open the Details tab, insert them directly into the Description section (i.e., the post's title under "Title" and the post's URL under "Comments"), and press Apply to save the changes.
  • 20) If you had saved the command on a notepad, you can simply replace the input/unconverted video's path and the output/converted video's path for any new conversions you want to make.

EDIT: This is for videos without audio, see forum #464086 for a new command to convert video w/ audio.

Updated

freakazoid123 said:
While all this information is very useful, I lack the brain to actually understand what any of it means.

Do you think you could somehow make a preset for an e621 mp4 video? Something I can just select in Handbreak, and always use that option everytime I have a video to upload to e621. I just need to get convert an mp4 into an mp4 which is compatible with e621 and doesn't cause any degradation in the video quality. As of current, I have 288 videos yet to be uploaded to e621, from Kriskawaii on Furaffinity.

If you are using constant quality mode, generally speaking, yes.
Practically you might need to change the quality depending on source material, adjust audio settings per video basis, if it's long form video you might need to change to constrained bitrate and use higher preset so it doesn't take two days to handle, etc.

This artists videos are really good bitrate, so use really low CRF/RF value, on scale of like 8-14, usually testing material for general video hosting site rips and medium quality videos around 16 is OK, some really poor source material going up to 21 might still be fine, 27 is way too high for purposes of preserving content as high quality as possible.

thegreatwolfgang said:
Steps to Convert Videos to MP4 Using FFMPEG on Windows:
<too many steps>

You can navigate away from system32, just cd to folder instead.
Instead of copying whole complete paths to literally everything, put the binary executable in %PATH% so you can simply use ffmpeg as command and open CLI on the folder where your files to work with are, on Windows 11 it's right clicking on folder context menu or write cmd or powershell on the address bar just to name couple fast methods.
Also you can literally put comments and titles with FFmpeg directly, without needing to modify the file after conversion.

mairo said:
You can navigate away from system32, just cd to folder instead.
Instead of copying whole complete paths to literally everything, put the binary executable in %PATH% so you can simply use ffmpeg as command and open CLI on the folder where your files to work with are, on Windows 11 it's right clicking on folder context menu or write cmd or powershell on the address bar just to name couple fast methods.
Also you can literally put comments and titles with FFmpeg directly, without needing to modify the file after conversion.

Alright, you're welcome to write an even more simplified step-by-step version for @Freakazoid123 to follow.

thegreatwolfgang said:
Steps to Convert Videos to MP4 Using FFMPEG on Windows:

  • 1) Go to https://ffmpeg.org/ and click on Download and choose the one for your computer's operating system (e.g., Windows, macOS, Linux).
    • If you are on Windows, you will need to download the full release by clicking here. The "essentials" version will not come with the AV1 codec installed.
  • 2) Extract the compressed zip file into an appropriate folder that you are going to use moving forward. I would suggest simply naming it as "FFMPEG".
  • 3) At this point, you should already have FFMPEG extracted and have the video you wish to convert in hand.
  • 4) (Optional) Open an empty notepad to help you with writing the command. You can skip this step and try inserting directly into Command Prompt if you are proficient enough.
  • 5) In the FFMPEG folder, open the "bin" folder and select ffmpeg.exe (don't double click and launch it, it does nothing). Copy the path of the program onto your clipboard (Google if you don't know how to).
  • 6) Go back to your notepad and press CTRL+V to paste the path. If nothing appears, repeat Step 5 again and make sure you have actually copied something.
    • Command should look like: "C:\Users\...\FFMPEG\bin\ffmpeg.exe".
  • 7) In the folder where you have kept the video, select the video you want to convert (e.g., unconverted_video.mp4) and copy the path to that (similar to Step 5).
  • 8) Go back to your notepad and press space once, followed by typing in -i, and then pressing space once more, and finally pressing CTRL+V to paste the input video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4".
  • 9) Copy the following -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart as suggested on @Mairo's comment.
  • 10) Go back to your notepad and press space once, followed by CTRL+V again to paste the remaining commands.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart.
  • 11) Find a suitable folder for where you want your converted file to be. In this case, I will demonstrate by putting it in the same folder as the unconverted video.
  • 12) Repeat Step 7.
  • 13) Go back to your notepad and press space once, followed by CTRL+V to paste the output video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\unconverted video.mp4".
  • 14) Edit the output video's path and rename the file to something else. It should not be the same as the unconverted video. In this case, I'll rename it to converted_video.mp4.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 15) Launch the Command Prompt program by searching for cmd on your Windows search. A black window should pop up with C:\Windows\system32> typed in.
  • 16) Copy the entire command from your notepad and press CTRL+V to paste it onto the Command Prompt.
    • Final command should look like C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 17) Press Enter to begin the conversion process. It may take a while.
  • 18) The conversion is complete once you see C:\Windows\system32> blinking again, and the file should be next to where you had saved your unconverted video.
    • If it is not there or if you had simply put the output path as output.mp4, check whatever directory your Command Prompt program is in. The path shown in Step 15 or Step 18 should be where it is located.
  • 19) (Optional) If you want to add the post's title and URL into the video's metadata, you can simply open the file's properties, open the Details tab, insert them directly into the Description section (i.e., the post's title under "Title" and the post's URL under "Comments"), and press Apply to save the changes.
  • 20) If you had saved the command on a notepad, you can simply replace the input/unconverted video's path and the output/converted video's path for any new conversions you want to make.

and nothing that I mess up here could negatively impact my computer, right?

freakazoid123 said:
and nothing that I mess up here could negatively impact my computer, right?

Yeah, as long as you follow it correctly all of it is fine. crf 14 is a bit high in some situations (lower is better quality, I'll sometimes go to as low as 8), but good as a default.
Ah, I see Mairo mentioned exactly that. And yeah this process is a bit slower than it needs to be, but at least should be reliable.

Updated

thegreatwolfgang said:
Steps to Convert Videos to MP4 Using FFMPEG on Windows:

  • 1) Go to https://ffmpeg.org/ and click on Download and choose the one for your computer's operating system (e.g., Windows, macOS, Linux).
    • If you are on Windows, you will need to download the full release by clicking here. The "essentials" version will not come with the AV1 codec installed.
  • 2) Extract the compressed zip file into an appropriate folder that you are going to use moving forward. I would suggest simply naming it as "FFMPEG".
  • 3) At this point, you should already have FFMPEG extracted and have the video you wish to convert in hand.
  • 4) (Optional) Open an empty notepad to help you with writing the command. You can skip this step and try inserting directly into Command Prompt if you are proficient enough.
  • 5) In the FFMPEG folder, open the "bin" folder and select ffmpeg.exe (don't double click and launch it, it does nothing). Copy the path of the program onto your clipboard (Google if you don't know how to).
  • 6) Go back to your notepad and press CTRL+V to paste the path. If nothing appears, repeat Step 5 again and make sure you have actually copied something.
    • Command should look like: "C:\Users\...\FFMPEG\bin\ffmpeg.exe".
  • 7) In the folder where you have kept the video, select the video you want to convert (e.g., unconverted_video.mp4) and copy the path to that (similar to Step 5).
  • 8) Go back to your notepad and press space once, followed by typing in -i, and then pressing space once more, and finally pressing CTRL+V to paste the input video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4".
  • 9) Copy the following -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart as suggested on @Mairo's comment.
  • 10) Go back to your notepad and press space once, followed by CTRL+V again to paste the remaining commands.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart.
  • 11) Find a suitable folder for where you want your converted file to be. In this case, I will demonstrate by putting it in the same folder as the unconverted video.
  • 12) Repeat Step 7.
  • 13) Go back to your notepad and press space once, followed by CTRL+V to paste the output video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\unconverted video.mp4".
  • 14) Edit the output video's path and rename the file to something else. It should not be the same as the unconverted video. In this case, I'll rename it to converted_video.mp4.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 15) Launch the Command Prompt program by searching for cmd on your Windows search. A black window should pop up with C:\Windows\system32> typed in.
  • 16) Copy the entire command from your notepad and press CTRL+V to paste it onto the Command Prompt.
    • Final command should look like C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 17) Press Enter to begin the conversion process. It may take a while.
  • 18) The conversion is complete once you see C:\Windows\system32> blinking again, and the file should be next to where you had saved your unconverted video.
    • If it is not there or if you had simply put the output path as output.mp4, check whatever directory your Command Prompt program is in. The path shown in Step 15 or Step 18 should be where it is located.
  • 19) (Optional) If you want to add the post's title and URL into the video's metadata, you can simply open the file's properties, open the Details tab, insert them directly into the Description section (i.e., the post's title under "Title" and the post's URL under "Comments"), and press Apply to save the changes.
  • 20) If you had saved the command on a notepad, you can simply replace the input/unconverted video's path and the output/converted video's path for any new conversions you want to make.

While I appreciate the help on how to use ffmpeg, I'm trying to get help using Handbreak. >> https://handbrake.fr << I just need to know what settings to set everything to so I can save it as a preset, so I can just use that preset with any video I need to convert to mp4 for e621, in a way that won't get me in trouble for doing it wrong and having the video quality end up being lower than the original video file. (I know NOTHING about software or filetypes! Only tech stuff I know is how to build a computer, and that's almost entirely hardware.)

freakazoid123 said:
While I appreciate the help on how to use ffmpeg, I'm trying to get help using Handbreak. >> https://handbrake.fr << I just need to know what settings to set everything to so I can save it as a preset, so I can just use that preset with any video I need to convert to mp4 for e621, in a way that won't get me in trouble for doing it wrong and having the video quality end up being lower than the original video file. (I know NOTHING about software or filetypes! Only tech stuff I know is how to build a computer, and that's almost entirely hardware.)

There's no one preset that will always work, a lot varies. It's also a lot harder to give exact instructions for a GUI program like handbrake than a CLI like ffmpeg.
That said, I'll put at least the ones I've seen Mairo give:

Start with the AV1 2-pass preset
Summary: Format MP4, web optimized, passthru common metadata
Dimensions: Resolution limit none, anamorphic none
Video: Video encoder AV1 (SVT), framerate same as source, encoder preset 0, encoder tune VQ, constant quality 14 (varies, but 14 is usually good)

Audio is tricky, but not relevant for approval. Opus, bitrate 160 usually works well enough.

freakazoid123 said:
While all this information is very useful, I lack the brain to actually understand what any of it means.

Do you think you could somehow make a preset for an e621 mp4 video? Something I can just select in Handbreak, and always use that option everytime I have a video to upload to e621. I just need to get convert an mp4 into an mp4 which is compatible with e621 and doesn't cause any degradation in the video quality. As of current, I have 288 videos yet to be uploaded to e621, from Kriskawaii on Furaffinity.

Been a while but I seem to remember you just chose the settings the one time, and then chose to save a new preset. Here's a short video showing how. You just edit some setting of an existing one, and then "+" (add) a new one.

thegreatwolfgang said:
Steps to Convert Videos to MP4 Using FFMPEG on Windows:

  • 1) Go to https://ffmpeg.org/ and click on Download and choose the one for your computer's operating system (e.g., Windows, macOS, Linux).
    • If you are on Windows, you will need to download the full release by clicking here. The "essentials" version will not come with the AV1 codec installed.
  • 2) Extract the compressed zip file into an appropriate folder that you are going to use moving forward. I would suggest simply naming it as "FFMPEG".
  • 3) At this point, you should already have FFMPEG extracted and have the video you wish to convert in hand.
  • 4) (Optional) Open an empty notepad to help you with writing the command. You can skip this step and try inserting directly into Command Prompt if you are proficient enough.
  • 5) In the FFMPEG folder, open the "bin" folder and select ffmpeg.exe (don't double click and launch it, it does nothing). Copy the path of the program onto your clipboard (Google if you don't know how to).
  • 6) Go back to your notepad and press CTRL+V to paste the path. If nothing appears, repeat Step 5 again and make sure you have actually copied something.
    • Command should look like: "C:\Users\...\FFMPEG\bin\ffmpeg.exe".
  • 7) In the folder where you have kept the video, select the video you want to convert (e.g., unconverted_video.mp4) and copy the path to that (similar to Step 5).
  • 8) Go back to your notepad and press space once, followed by typing in -i, and then pressing space once more, and finally pressing CTRL+V to paste the input video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4".
  • 9) Copy the following -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart as suggested on @Mairo's comment.
  • 10) Go back to your notepad and press space once, followed by CTRL+V again to paste the remaining commands.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart.
  • 11) Find a suitable folder for where you want your converted file to be. In this case, I will demonstrate by putting it in the same folder as the unconverted video.
  • 12) Repeat Step 7.
  • 13) Go back to your notepad and press space once, followed by CTRL+V to paste the output video's path.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\unconverted video.mp4".
  • 14) Edit the output video's path and rename the file to something else. It should not be the same as the unconverted video. In this case, I'll rename it to converted_video.mp4.
    • Command should look like "C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 15) Launch the Command Prompt program by searching for cmd on your Windows search. A black window should pop up with C:\Windows\system32> typed in.
  • 16) Copy the entire command from your notepad and press CTRL+V to paste it onto the Command Prompt.
    • Final command should look like C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:v libsvtav1 -preset 0 --svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -an -movflags +faststart "C:\Users\...\converted video.mp4".
  • 17) Press Enter to begin the conversion process. It may take a while.
  • 18) The conversion is complete once you see C:\Windows\system32> blinking again, and the file should be next to where you had saved your unconverted video.
    • If it is not there or if you had simply put the output path as output.mp4, check whatever directory your Command Prompt program is in. The path shown in Step 15 or Step 18 should be where it is located.
  • 19) (Optional) If you want to add the post's title and URL into the video's metadata, you can simply open the file's properties, open the Details tab, insert them directly into the Description section (i.e., the post's title under "Title" and the post's URL under "Comments"), and press Apply to save the changes.
  • 20) If you had saved the command on a notepad, you can simply replace the input/unconverted video's path and the output/converted video's path for any new conversions you want to make.

Alright, so I followed all the instructions, and the message the command program gave me was:

Unrecognized option '-svtav1-params'.
Error splitting the argument list: Option not found

and it didn't do anything. What happened? (On windows 11 btw)

freakazoid123 said:
Alright, so I followed all the instructions, and the message the command program gave me was:

Unrecognized option '-svtav1-params'.
Error splitting the argument list: Option not found

and it didn't do anything. What happened? (On windows 11 btw)

Oh that's a typo in the command thegreatwolfgang gave, it should be only one dash instead of two at the start.

scth said:
Oh that's a typo in the command thegreatwolfgang gave, it should be only one dash instead of two at the start.

two dashes at which part?

The whole message on my notepad is

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

freakazoid123 said:
two dashes at which part?

The whole message on my notepad is

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

-svtav1-params instead of --svtav1-params

scth said:
-svtav1-params instead of --svtav1-params

Okay, it worked. The video went from 36.8mb down to 16.6mb. I can't see a visual difference, but I'm not experienced in telling the difference. Hopefully this post is right! If this post is exactly up to standard, then I will from now on be using this method to convert videos. This is the post https://e621.net/posts/5781466

Question: can H.264 be converted to AV1 losslessly? If not, are the above recommendations optimal for that conversion?

0f8c4c9d05154171ae8 said:
Question: can H.264 be converted to AV1 losslessly? If not, are the above recommendations optimal for that conversion?

No, it cannot be (well, not without blowing up the filesize a LOT). As for "optimal", it depends on the input file, and if you're running up on the 100MB filesize limit. It's pretty good, the main thing would be the crf 14 that can vary - lower gives more accurate conversion, at the cost of extra size. The best option mostly depends on how noisy and well compressed the input file is. A badly compressed file (like one from X) might to up to 16, a 3d animation that hasn't been already badly compressed I'll go as low as 8. A low CRF on an already compressed file mostly just preserves compression artifacts, rather than useful content.

There are also various other options that can be used, in particular some ways to represent noise in AV1 at low bandwidth cost. Unnecessary for most animation, though.

freakazoid123 said:
Okay, it worked. The video went from 36.8mb down to 16.6mb. I can't see a visual difference, but I'm not experienced in telling the difference. Hopefully this post is right! If this post is exactly up to standard, then I will from now on be using this method to convert videos. This is the post https://e621.net/posts/5781466

So I've run into an issue. In videos with sound, the converted version lacks any sound.

freakazoid123 said:
So I've run into an issue. In videos with sound, the converted version lacks any sound.

Yeah, sound is a bit trickier to do properly (though irrelevant for approval, at least). Properly doing it would involve identifying the source format. Assuming the source video is also an MP4, though, this modification should do it:

C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:a copy -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -movflags +faststart "C:\Users\...\converted video.mp4" (with your paths instead of course, I just took what TheGreatWolfgang had and changed the -an, which removes audio, to -c:a copy which directly copies any audio streams).

If you're converting something that's not an MP4 already, or taking the audio from another source, that's another story.

Also, if you already have a video converted without sound, but meant for it to have sound, that's fixable:
Say the original video with sound is "unconverted video.mp4", and the converted video without sound is "converted video.mp4" (replace with the actual paths). You can do
ffmpeg -i "unconverted video.mp4" -i "converted video.mp4" -map 0:a -map 1:v -c copy "converted video with sound.mp4"
Which will copy in the audio without having to spend time reencoding the whole video.

Updated

scth said:
Yeah, sound is a bit trickier to do properly (though irrelevant for approval, at least). Properly doing it would involve identifying the source format. Assuming the source video is also an MP4, though, this modification should do it:

C:\Windows\system32>"C:\Users\...\FFMPEG\bin\ffmpeg.exe" -i "C:\Users\...\unconverted video.mp4" -c:a copy -c:v libsvtav1 -preset 0 -svtav1-params tune=0 -g 150 -pix_fmt yuv420p -crf 14 -movflags +faststart "C:\Users\...\converted video.mp4" (with your paths instead of course, I just took what TheGreatWolfgang had and changed the -an, which removes audio, to -c:a copy which directly copies any audio streams).

If you're converting something that's not an MP4 already, or taking the audio from another source, that's another story.

Also, if you already have a video converted without sound, but meant for it to have sound, that's fixable:
Say the original video with sound is "unconverted video.mp4", and the converted video without sound is "converted video.mp4" (replace with the actual paths). You can do
ffmpeg -i "unconverted video.mp4" -i "converted video.mp4" -map 0:a -map 1:v -c copy "converted video with sound.mp4"
Which will copy in the audio without having to spend time reencoding the whole video.

Thanks! It worked! :D

Original page: https://e621.net/forum_topics/58882?page=1