X264 profile - trying to use Fabio Sonatti's settings

Share with other users your experience in using MediaCoder.
Entity
Amateur
Amateur
Posts: 23
Joined: Tue Feb 26, 2008 9:22 am

X264 profile - trying to use Fabio Sonatti's settings

Post by Entity » Tue Feb 26, 2008 10:03 am

Hey guys,

I was checking out a link on Flashguru with some pretty amazing x264/h264 settings that Fabio Sonatti came up with:

(The link to the Sigur Ros video done in 500kbs is pretty impressive)

Anyway, I'm trying to figure out how to get these settings in his ffmpeg script to transfer over to a MediaCoder profile, but I can't seem to get the encoding to not end up looking pretty crappy. Was wondering if anyone would be willing to help on this...the settings are incredibly impressive but unfortunately I'm not as good with the commandline as I'd like to be.

Rob

Entity
Amateur
Amateur
Posts: 23
Joined: Tue Feb 26, 2008 9:22 am

Re: X264 profile - trying to use Fabio Sonatti's settings

Post by Entity » Tue Feb 26, 2008 10:04 am

Entity wrote:Hey guys,

I was checking out a link on Flashguru with some pretty amazing x264/h264 settings that Fabio Sonatti came up with:

(The link to the Sigur Ros video done in 500kbs is pretty impressive)

Anyway, I'm trying to figure out how to get these settings in his ffmpeg script to transfer over to a MediaCoder profile, but I can't seem to get the encoding to not end up looking pretty crappy. Was wondering if anyone would be willing to help on this...the settings are incredibly impressive but unfortunately I'm not as good with the commandline as I'd like to be.

Rob
Since this was my first post the forum wouldn't let me post the link to it -- posting it here. If you haven't seen it, check it out...I'm pretty amazed at the quality he was able to get out of 500k encoding.

http://www.flashcomguru.com/index.cfm/2 ... -drop-h264

Gaz
Beginner
Beginner
Posts: 4
Joined: Tue Feb 26, 2008 10:36 am

Post by Gaz » Tue Feb 26, 2008 10:37 am

I just watched the flash demo, very nice indeed :)

B!ink
Expert
Expert
Posts: 1275
Joined: Sun Nov 26, 2006 9:08 am

Post by B!ink » Thu Feb 28, 2008 7:51 am

Impressive.

http://www.progettosinergia.com/flashvi ... eoblog.htm

This person mentions some of the specs.

B!ink
Expert
Expert
Posts: 1275
Joined: Sun Nov 26, 2006 9:08 am

Post by B!ink » Thu Feb 28, 2008 8:44 am

I managed to get a hold of the video (don't ask me how). I'm going to analyze the video and see what else I can come up with.

B!ink
Expert
Expert
Posts: 1275
Joined: Sun Nov 26, 2006 9:08 am

Fabio Sonatti's Profile (Updated)

Post by B!ink » Thu Feb 28, 2008 2:21 pm

Take a look Fabio Sonatti article posted at his website.
Fabio Sonatti's wrote:13 February, 2008
Pushing H.264 to the limit - Part II



My latest H.264 encoding experiment has been largely appreciated by Flash Video fans, developers and media firms' executives. Indeed, a lot of people watched my experiment and congratulate with me for the final result. In the next posts I'll go further in exploring the limits of the H.264, but now, I would like to discuss some point of interest about the "HD video @ 500Kbit/s" topic.

1) Generally speaking, you need more than 500Kbit/s for HD videos.

This is an experiment. Heima footage is very well suited for H.264 encoding. H.264 can retrieve a lot of informations from the previous frames with very little bistream when the video is slowly changing or "quiet". A very fast moving footage, with back and forth or stroboscopic lights is much more difficult to encode and require an higher bitrate. How much higher ? In my experience It is possible to encode *generic* video in 720p with very good result with around 1Mbit/s and 1080p with no less than 2Mbit/s. Its is a great achievement in any case.

2) The video shows less quality in panning scenes

I'm able today to improve such behavior. That is: I'm now able to achieve a slightly higher perceptual quality for the same 500Kbit/s, or go down to less than 450Kbit/s.
This is possible using a better motion vector prediction in B-frame and passing from two to three pass encoding.


3) What tools am I useing ?

I use a mix of Ffmpeg, x264, Mencoder and Nero AAC. Here some parameters used:
5 reference frames, 5 B-frames, authomatic B-Frames, B-pyramid enabled, adaptive macroblock type, advanced Trellis on, Subq=7, advanced exagon search, deblocking filter with custom alpha e beta parameter, three pass encoding...


4) Why does the video stutter ?

There are a main reason: the web hosting I used, is limited to a 10Mbit/s bandwidth, the high amount of viewer saturated the bandwidth. A second possibility is the processing power of your pc: decoding an HD video require at least a P4@3GHz, Athlon 3500+ or better, but it depends significantly by your monitor's resolution, too.
On my QuadCore @ 3GHz with a 22'' monitor, the 10-15% of the cpu is used.


Fabio Sonnati ::

Source:
http://www.progettosinergia.com/flashvi ... eoblog.htm
It's no secret what programs and settings are used seen above (highlighted in red). It's a matter of duplicating the settings as close as possible to Fabio Sonatti's Profile in MediaCoder. As mention earlier in my post, I manage to get a hold of the video (again don't ask how I got it) to analyze the video further.

Code: Select all

General
Complete name                    : D:\My Videos\heima_720p_500.mp4
Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 15.5 MiB
Duration                         : 3mn 53s
Overall bit rate                 : 555 Kbps
Encoded date                     : UTC 2007-12-02 17:30:57
Tagged date                      : UTC 2007-12-02 17:30:57

Video
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L5.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 6 frames
Codec ID                         : avc1
Duration                         : 3mn 53s
Bit rate mode                    : Variable
Bit rate                         : 482 Kbps
Nominal bit rate                 : 500 Kbps
Maximum bit rate                 : 1970 Kbps
Width                            : 1280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16/9
Frame rate mode                  : Constant
Frame rate                       : 25.000 fps
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.021
Stream size                      : 13.4 MiB (87%)
Writing library                  : x264 core 56
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x133 / me=hex / subme=7 / brdo=1 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=5 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=0 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=abr / bitrate=500 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30
Encoded date                     : UTC 2007-12-02 17:30:57
Tagged date                      : UTC 2007-12-02 17:30:57

Audio
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format version                   : Version 4
Format profile                   : LC
Format settings, SBR             : Yes
Format settings, PS              : Yes
Codec ID                         : 40
Duration                         : 3mn 53s
Bit rate mode                    : Variable
Bit rate                         : 70.4 Kbps
Maximum bit rate                 : 78.8 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Stream size                      : 1.96 MiB (13%)
Encoded date                     : UTC 2007-12-02 17:30:57
Tagged date                      : UTC 2007-12-02 17:30:57
Make sure you have installed and updated to the latest version of MediaCoder. Let's begin.
Fabio Sonatti's H.264/AACv2 Profile (Closely Duplicated)

Go to
File menu --> Revert All Settings

Audio Tab
Source: (Auto-Select)
Encoder: Nero Encoder
Resample: 48000 Hz
Channel: Stereo

Nero Encoder Tab
Profile: HE-AAC V2
Rate Mode: Target Quality
Bitrate / Quality: 25

Video Tab
Mode: Bitrate-based
Bitrate: 500 kbps
Format: H.264
Container: MP4
Source: (Auto-Select)
Encoder: (Auto-Select)

x264 Tab
Profile: High
Predictor Frames: 6
Motion Est. Mode: Normal
Motion Est. Range: 16
Level: 5.1
B-Frames: 5
Subpel Refinement: 7

Click "Advanced" button.

MediaCoder Preferences Window
  • Video Encoders
    |-----x264
Bitstream profile = High (highlight and select "High" in the drop down box below)

Level of bitstream = 51 (enter value in the box below and click apply button)

Frames used as predictors in B and P frames = 6 (enter value in the box below and click apply button)

Maximum B frames between I and P frames = 5 (enter value in the box below and click apply button)

B-frames decision = true (click "Yes" radio button below)

B-frames used as for predicting = true (click "Yes" radio button below)

Use CABAC = true (click "Yes" radio button below)

Direct macroblocks prediction = Auto (highlight and click "Auto" in the drop down box below)

Use weighted prediction for B-frames = true (click "Yes" radio button below)

Adaptive spatial transform size = true (click "Yes" radio button below)

Fullpixel motion estimation algorithm = Hexagonal (highlight and click "Hexagonal" in the drop down box below)

Subpel refinement quality = 7 (enter value in the box below and click apply button)

Mixed reference frame = true (click "Yes" radio button below)

Rate-distortion optimization of B-frames macroblock type = true (click "Yes" radio button below)

Refine motion vectors use in bidirectional macroblocks = false (click "No" radio button below)

Rate-distortion optimal quantization = Enable during all mode decisions (highlight and click "Enable during all mode decisions" in the box below)

Performs early skip detection in P-frames = false (click "No" radio button below)

Threads (0 for auto) = 6 (enter value in the box below and click apply button)

The only settings left under MediaCoder Preferences window is Alpha and Beta deblocking.

Please read: How To Use Mpeg4 AVC Deblocking Effectively (Small FAQ)

Deciding what values to use is a personal choice. In this example, I will be using more detailed look and occasional block setting of -2:-1.


Alpha parameter of deblocking filter = -2 (enter value in the box below and click apply button)

Beta parameter of deblocking filter = -1 (enter value in the box below and click apply button)

Click "X" button in the upper right hand corner of MediaCoder Preferences window.

Muxer Tab
"Enable" radio button

Multiplexer: MP4Box

Picture Tab
Resize: 1280x720
Crop: disable
Frame Rate: (Untick Box)
Aspect Ratio: (Untick Box)
Rotation: (Untick Box)

End of Settings
Final Note:

Fabio Sonatti's profile is experimental.

Not all settings could be duplicated. Filled in some of the gaps.

Don't expect these settings to work wonders on lower quality videos. Input video is the biggest factor.

Video will be outputted in MP4 format.

Encoding time may vary depending on video and specs of computer.

Edit: Tested using MediaCoder 0.6.1.4180. Used Fabio Sonatti's "Heima 720p" video as reference. Fabio Sonatti's "Hero 720p" video is not setup the same way.

Updated on August 23, 2008
Last edited by B!ink on Sun Aug 24, 2008 9:17 am, edited 5 times in total.

Cruz
Amateur
Amateur
Posts: 45
Joined: Wed Apr 02, 2008 11:46 am

Post by Cruz » Thu Apr 10, 2008 1:45 pm

iMPRESSIVE, THANKS BLINK I AM GOING TO TRY A FEW SETTINGS ON SOME SHORT MOVES

User avatar
SirAuron
Expert
Expert
Posts: 798
Joined: Thu Feb 08, 2007 1:39 am
Location: Germany

Post by SirAuron » Fri Apr 11, 2008 11:07 pm

Now that was an impressing video (and I think it's perfectly legal to get the video, says nowhere you shouldn't)!

I will most likely adopt some of those settings. Are they suitable for 800 kb/s (or higher), too?

Since I will be mostly using this for low definition clips a final question. What does Level of Bitstream do? Do I have to set this to a lower value (like the default 40) when I transcode low resolution stuff?


Edit: He also uploaded a 720P clip of heroes. Quite brilliant.

http://3172.voxcdn.com/DEMO720-Heroes500.html
MediaCoder settings:

x264 (backend/source: mencoder, fps: 23,976, Fabio Sonatti's settings) + nero aac 64 in matroska

Cruz
Amateur
Amateur
Posts: 45
Joined: Wed Apr 02, 2008 11:46 am

Post by Cruz » Fri Apr 11, 2008 11:54 pm

Yes i watched 3 clips in total all were very good.

I attmpted a transcode with the settings in the post above at 800 bit rate but with only 2 pass as a test.

This was on an AVI 700mb file, turned out pretty bad quality compared to what i have been producing with H.264 on standard settings, however i will be testing alot more and good luck to your efforts.

Entity
Amateur
Amateur
Posts: 23
Joined: Tue Feb 26, 2008 9:22 am

Post by Entity » Fri Apr 18, 2008 8:18 pm

I've been trying to work with these settings, but no matter what (I've tried reinstalling and a bunch of other things), the transcoding process always fails when I try to use the HE-AAC V2 Profile. Using HE-AAC seems to work fine. Anyone have any idea what might cause this? (By the process failing, I mean that it reports that the decoding thread may be blocked and the transcode has stalled).

Using the latest version. When I press F6 to see the console, it's clearly Nero's encoder where it is stalling. Tried downloading Nero's encoder separately but got the same issues with a new EXE.

Rob

Locked