forum

[Guide] How to create High Quality/Size Videos

posted
Total Posts
60
Topic Starter
blissfulyoshi
Purpose:
This is a guide to teach people how to reencode videos to acheive the highest quality possible while keeping the filesize low, regardless of the scenario.
Special Thanks
Before I begin, I want to express special thanks to 3 people:
ziin: He kicked off the Avidemux guides and created a lot of the basis which I will work off today. I copied over quite a few of his pictures without asking for permission, so (Guide: http://osu.ppy.sh/forum/viewtopic.php?f=56&t=58235)
ampzz: He taught me a lot on filters and helped me constantly test out filter combinations. I am probably forgetting a lot of other things he did for me, but at least, let me say thanks for everything.
Miya: Tested the various revisions of the guide for me, and forced me to continue to improve ths guide. I don't think this guide would have been updated it is wasn't for him/her
Why should you use this guide?
This guide is simple and will give you better results than many other encoding methods. For samples of what this encoding method can do, check out http://osu.ppy.sh/s/41379 http://osu.ppy.sh/s/69992 and http://osu.ppy.sh/s/68504 (this map is very long so quality took a hit)

Required Items:

Avidemux 2.5 or 2.6 32bit (Avidemux 2.5 and 2.6 require slightly different steps, so I have notes for both 2.5 and 2.6)
A high quality source
A fast computer or a lot of time (Please do not underestimate the amount of processing power this will take.)

Steps:
1. Select the section of the video you want to encode:
To do this, there is an A and a B at the bottom of the screen. Navigate to the first frame you want to start the video from and press the A. Then go to the last frame and press the B. Since it is difficult to get to the exact frame, use the arrow keys on your keyboard to go travel frame by frame. (Reference: http://www.avidemux.org/admWiki/doku.ph ... ng:cutting)

From here, you can keep on following the easy way, or skip down to the spoilerbox to do things the long way.
2. Save the scripts (2.5 2.6) and unzip them somewhere.

3. Run the Scripts
2.5: Press File->Load/Run Project
2.6: Press File->Tinypy Project->Run Project
Regardless of which avidemux you have, select the file you are told to use by the following questionaire.
Are you dealing with real life footage or animated material?
If real life footage, use RealLife.txt
If animated, is the video of decent quality , or do you want the edges of sprites to be shaper?
If the video is of decent quality, use AnimationSimple.txt
(2.5 only) If the video has slightly fuzzy edges, use AnimationFilter1.txt or AnimationFilter2.txt (Beware, these filters will increase your video encoding time a lot and can introduce artifacts) (Also, due to missing filters in Avidemux 2.6, these are not available in the 2.6 package)

4. Resize to correct dimensions for osu!
Wait 30s and then press filters in the top leftish area, and select the Resize filter from the rightmost list. From there, click on the Configure button on the bottom right of the window and then configure the resolution to your hearts content (480p is the usual one). (Pictures are in Step 4 in the spoilerbox below)

*If filesize is too large or quality is too low then adjust quality slider as talked about in step 3 in the spoilerbox below

For those that want to do things manually
Below are the steps to do things manually in 2.5, but the steps in 2.6 are very similar, so you should be able to follow along fairly easily.

2. Remove the Audio from the video:
ziin's guide (http://osu.ppy.sh/forum/viewtopic.php?f=56&t=58235) outlines this very well, so I advise you just follow his instructions.

3. Select the Video encoder to be MPEG-4 AVC and configure it:
2.5 2.6
As stated, click on the pull down menu and change it to " MPEG-4 AVC." Afterward, press on the "Configure" button below. You will be greeted with a screen that has bunches of tabs, options and what not.
I know none of you want to deal with configuring this, so here are some preconfigured settings 2.6. Place this file in C:\Users\<username>\AppData\Roaming\avidemux\x264 . If for some reason you cannot save the file from that page as a .xml file. Create a .xml file in the location specified and copy the lines in.
With the file in place, click on the top of the page and scroll down to select the name of the .xml file added (if you used mine, it is "quality 5"). With that we are done with configuration (that was easy), but if the filesize is too big or you want to push out more quality, feel free to adjust the quality slider on that page to your hearts desire. Afterward, just make sure to press "Ok."


4. Applying filters:
There are plenty of filters to choose from, so here is the set of filters I used for one of anime filter sets. Feel free to adjust the filters to suit your needs.

To start off this process, press the "Filter" button under Video as shown above.
Now apply the following filters in the order listed:
(Format: Category > Filter)
Sharpness > MSmooth by Donald Graft: High Quality, Threshold: 15, Strength: 3
Noise > MPlayer hqdn3d: stock settings (settings it starts with)
Sharpness > asharp: Threshold: 2.00, Strength: 2.00, Block Adaptive: -1.00, Do not check High Quality Block Filtering
Sharpness > MSmooth by Donald Graft: High Quality, Threshold: 15, Strength: 1 (to clean up oversharpening)
Noise > Cnr2: stock settings
Noise > FluxSmooth: Temporal Threshold: 8, Spatial Threshold: 8
Noise > Temporal Cleaner: Luna Temporal Threshold: 5, Chroma Temporal Threshold: 0
Transform > Resize: Whatever resolution you want that fits osu! standards, but I do recommend Lanzcos3 as your "Resize Method" (If you want a slight speed boost, switch to MPlayer resize)
5. Save Video:
File->Save->Save Video... or Ctrl+S, and then name your video as whatever_you_want.avi

6. Check video over:
Open your reencoded video file. Does it meet all of your demands? Are there random artifacts, oversmoothing, oversharpening, or something else that bothers you? If have those symptoms please start over and use AnimationSimple.txt or play around with the filters till you get your desired look.

Conclusion:
There you have it. At this point you should have a high quality video that fits all the specifications for osu!. If you want to experiment more on your own feel free to do so. I know this set of filters is not perfect for every scenario, but I am sure you get something decent out of this. If you want to suggest something better, feel free to do so. If for some reason you are not satisfied with the filters available in Avidemux, research ffmpeg and use that to encode.

FAQ:
My output video is longer/shorter than my original. What do I do to fix it?
This is what happens when the frame rate of your video is not 23.97 FPS. To fix this, go to video->frame rate... and uncheck "Use custom value." Now change the standard frame rate to the frame rate of your video. Usually the answer is NTSC - 30FPS
My video is 10-bit (creating a green screen in Avidemux), how do I make Avidemux to be able to play it?
For this, you need ffmpeg, so install that, and in the bin folder make a .bat file with the following code.
FOR %%A IN (*.mkv) Do (ffmpeg -i "%%A" -sn -vcodec libx264 -crf 13 -acodec copy "8bit_%%A")
Now, move the mkv file to bing folder, and press the .bat file. This will convert your file to a 8-bit file that can be read by Avidemux. (I know crf 13 is a bit overkill, but I wanted it to be as close to lossless in comparison to the source file.)

I want a higher CRF, but my filesize won't permit it. What can I do?
In this case, I advise you apply a softening/blur filter , these will decrease fileize in exchange forchanging the image itself, allowing you to increase the crf.

How do I make details in my video pop be cleaner, be more evident?
In this case, use a sharpening filter like Msharpen to make everything that much more defined. I noticed that this helps a lot of TV broadcasted versions look better. (Beware this does increase filesize).
Miya
Let me try this method with1080p video from youtube. I will post the result once it's finish :3

Warning, this method takes a lot of time to encode 1080p video with HIGH CPU usage. If you don't have enough powerful CPU to do this and don't like waiting, i advice don't do this method

Some pics from the test

Not-encoded video filesize :

Not-encoded video when played :

When encoding :

Encoded video Filesize :

Encoded Video Result:

Encoded Video in Osu:



Result : Awesome!!, the picture is not crunched and looks nice even i enlarge the result (Note the encoded video resolution is 480p). But the encoded video loss some color, so it will looks like less colorful. ><

Nice tutorial :D
should be stickied xD
Topic Starter
blissfulyoshi

Miya wrote:

Result : Awesome!!, the picture is not crunched and looks nice even i enlarge the result (Note the encoded video resolution is 480p). But the encoded video loss some color, so it will looks like less colorful. ><
Experimental Colorful Easy Button xD: http://puu.sh/10BW5 (beware, my 13mb file went up to 15.6mb

Edit: Thanks again for taking so much time to try out my guide and help clean it up.
Colin Hou
848x480(480p) exceeded 800x600 (as the rule says), should goes to 800x450 or something like that.
Topic Starter
blissfulyoshi

Colin Hou wrote:

848x480(480p) exceeded 800x600 (as the rule says), should goes to 800x450 or something like that.
The rules said nothing about widescreen videos,so the pixel rule was under discussion. mm201 basically said in p/1288454 to basically change the rule to max 480000 pixels to meet the changing standards. For comparison, 800 x 600 = 480,000 pixels, while 848 x 480 = 407,040 pixels. As a result, my 848x480 is already better than the 800 x 600 posted in the rules and should be perfectly fine.
Miya
Bliss, the new method doesn't compress much.

I try to compress the new video with 720p quality with 77mb filesize
Here's the screenshot how's the video looks like

But after compression the video doesn't compress much like previous compression
And the video doesn't looks very good too like previous one

Too much quality loss :(
Topic Starter
blissfulyoshi
I promised myself a while ago that I would update this guide, but that took a while to happen.

For this small update, I added a new experimental filter that I sometimes use over my normal one (esp my long videos), and I added a way to deal with videos that get the wrong frame rate when encoded. In short, nothing much, but it hopefully will make the lives of the user of the guide a bit better.
Topic Starter
blissfulyoshi
Bumping for the large update.

I was planning to update this on Christmas day, but the Christmas modding queue pushed things backed, regardless, the guide is finally updated.

Changelog:
Now both Avidemux 2.5 and 2.6 are both supported by the guide
Added a script for real life footage, so you can make high qulaity videos from real life footage
Updated text to be simpler and easier to read (Still needs improvement)
Created a nicer way to get the scripts
Fixed a small bug in Avidemux 2.5 scripts that dealt with framerate
A few other small things that I don't feel like noting

I don't think there is much need for me to update this guide anytime soon. The one thing I might add is a way to get mp3s from videos, but I am not really motivated to do it.
Indra145
Hi, I'm having a problem here, although I moved the quality 5.xml into the x264 folder, the avidemux still won't read it, there's only the PSP and iPhone option, any help? I'm using avidemux 2.6
Topic Starter
blissfulyoshi
My first question is why are you not following the simpler instructions. The scripts automatically configure those settings for you. If you want, you can just run the script and save it.

Second, the script I provided was only for 2.5 and not 2.6. If you want the 2.6 settings, do what I said above because I see little need to upload it.

Third, if you really want to upload/save settings somewhere, go to C:\Users\<username>\AppData\Roaming\avidemux\pluginSettings\x264\1
Indra145
Ah, I finally figured it out, thank you so much, and sorry for my ignorance orz
Topic Starter
blissfulyoshi

Indra145 wrote:

Ah, I finally figured it out, thank you so much, and sorry for my ignorance orz
That is good, as long as you figured it out in the end. Also, sorry if I sounded condescending. I did not mean to be angry at you or anything like that, but for anyone, that needs help with following the guide or has comments, feel free to leave comments here or contact me ingame.
Broccoly
4. Resize to correct dimensions for osu!
Wait 30s and then press filters in the top rightish area, and select the Resize filter from the rightmost list.
Uh.. I did until 3 but kinda lost on 4.
The problem is that I don't see anything in the top rightish area.


Help plz?
Topic Starter
blissfulyoshi
That is strange, it didn't automatically change to H.264....
Okay, as a temporary fix, under video output, change that to H.264 (forgot the text exactly but it should be one of the top few options) and then the Filters section under it will light up.

Edit: The scripts for 2.6 have been changed to Tinypy Project files. For some reason that I don't know, support for the old files was removed, and SpiderMonkey Project files was giving me issues.
Mystyk
I wish it compressed more....my original file was about 54Mb and compressed 53Mb....I don't want to resize it to 640x360 (or whatever small resolution) D: It's 848x480 >.< and i have 2.6.1 version for 64bit windows, any way to make it smaller?
Topic Starter
blissfulyoshi
To compress it more, change the quality setting in the configure section under video


If I remember correctly, the script sets the quality at 26, which is okay for TV size. If you have something 3min, you will probably need 30 or above (If I remember correctly, every increase by 5 is half the size). If you have 53 at 26, then 32-34 should be okay... (it will probably look bad though sadly)
Hiyorin
I have my NCED video in MKV format, then I used MKVCleaver to extract the video portion and convert to .avi format. I checked that it plays properly in various media players (the .avi file), but it is not being opened properly in avidemux. It detects 0 frames and wont even play the avi file. How should I go about converting my mkv file? Any help would be appreciated, thanks in advance.
Topic Starter
blissfulyoshi
Most recent BD releases are in 10 bit format, and avidemux can't open them. Also, there are some weird encodes that don't work with avidemux either (I have a few), so fix this reencode it to 8bit

If you don't know how to do this, get ffmpeg and run a .bat file with this line
FOR %%A IN (*.mkv) Do (ffmpeg -i "%%A" -vcodec libx264 -crf 18 -acodec copy "re_%%A")
Verlaren
Nice tutorial. True with your settings problematic to convert video files for over 4 minutes long. I found the best settings for video files larger than 4 minutes ( I lost them, excuse me for that, I'll try to remember them, and then I will share them).
Topic Starter
blissfulyoshi
For 4min plus, it really depends on what the item is.

If is some mv for a vocaloid song, it probably doesn't have any super complex animations in it (unless you map something like Aria), so I have used quality lvl 20 for that even at 3-4min. However for live performance, I usually turn the quality to 32, and try an arrangement of filters. However, I haven't found any great filters for rl though.
Genkishi
Okay I'm stuck at 4 too.

After i run the script and waited for 30s there's no Filters that appear in the rightmost top area



And i'm having trouble at the .xml file part..i already put the .xml file with the lines on it in the x264 folder but there's no "quality 5,etc..." that appears
Topic Starter
blissfulyoshi
Woops, I was supposed to say top-left not top right (You can see it in your picture under Video (with MPEG-4 AVC and configure)).

Also, for the .xml file, you had to keep the original name that went with the file, but I don't feel like explaining that. Just follow the part of the guide not in the spoilerbox.
popner
Translated into Chinese: t/141953
Topic Starter
blissfulyoshi
Thanks popner, though I did notice that in one of the Chinese guides, someone had some other video settings posted.
alex_98
well, my compressed video is 297MB, while uncompressed 720p is 295..

a 15 min miku medley on MMD..
Topic Starter
blissfulyoshi
Well... 15min things usually mean lower res and lower nitrate to meet requirements. Try 360p with 32 for quality. Feel free to host a good version of the video elsewhere to give your players something better to see.
alex_98
https://osu.ppy.sh/s/175087
it's compressed to 198p with 17MB, I could upload the map but somehow it can't be updated anymore..

never mind.. it's just some issue that will deal with itself. It did upload once afterall
arviejhay
I compress a video
Uncompress size is 59 mb
then compress size is 22 mb but when i insert it in the editor why it's freezing or delaying sometimes ?
Topic Starter
blissfulyoshi
Well if your computer can't process the amount of data the video is giving it, the video will stutter (also osu!'s video playback is not very optimized)
xxdeathx
i don't think this works anymore, avidemux always crashes when i try to save video. i've used combinations of different settings but none of them work.
show more
Please sign in to reply.

New reply