Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd January 2013, 16:55   #21  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by h3nry View Post
yeah,I'am already using mxplayer since the day I bought my phone.true,the player can play all levels,profiles,formats.using s/w 16bit decoder for upto 720p,videos may plays smoothly.but it's like turning off the bravia engine.the color decoding is worse.it looks like the colors are washed out.setting s/w 32bit decoder improves color,but going above sd videos greatly slows down the video playback,while the audio plays at normal speed.
That sounds odd as I've got a Motorola Razr which I'm pretty sure has the same CPU as your phone. The hardware decoder is obviously better as it'll play level 4.1, 1080p without a problem, but switching to the CPU definitely doesn't slow down video playback speed for me. At least not when playing 480p/720p encodes. The CPU probably struggles with 1080p, but I can't remember as it was a while ago when I tested it.

If there's much of a colour difference between 16 and 32 bit colour I must admit I'm not seeing it. For some reason the hardware decoder in my phone doesn't play AVIs all that well. Movement looks a little jerky at times so I always use the s/w decoder for those. I wonder if the color/speed difference is something peculiar to your phone? Or maybe something else is hogging your CPU?

PS Actually thinking about it doesn't the "bravia engine" do contrast enhancing and sharpening etc to try to make the image using the LCD screen look better? If that's the case then using software decoding very possibly does bypass it, which would be why using the s/w decoder has the same effect as disabling bravia when using the hardware decoder.

Last edited by hello_hello; 3rd January 2013 at 17:03.
hello_hello is offline   Reply With Quote
Old 3rd January 2013, 19:47   #22  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Quote:
Originally Posted by hello_hello View Post
using software decoding very possibly does bypass it, which would be why using the s/w decoder has the same effect as disabling bravia when using the hardware decoder.
but s/w 32bit works fine,atleast better.I don't if it's only my phone's problem or all the xperia u's.could it be with the gpu(mali 400,not so common as adreno or powervr).cause I cannot play games as well(nfs shift,hot pursuit etc).any way not because too much process stealing my cpu.I always terminates unwanted background apps,allows only basic processes,usually 4.
h3nry is offline   Reply With Quote
Old 3rd January 2013, 19:59   #23  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Quote:
Originally Posted by hello_hello View Post
I think you're wrong about level 3.2 needing a limit of 13 ref frames. The way I read it on Wikipedia it only applies to level 3.1 and it's probably when using a 720x? resolution too. When setting 3.1 as the level x264 didn't limit my 704x384 encode to 13 ref frames.
Quote:
Originally Posted by h3nry View Post
it only supports till high profile @ level 3.2.that means I cannot use reframes >5 for a 720 video and >13 for a 480p video,and I cannot watch a 1080p video cause its high profile @ level >= 4.0.
I was mentioning about 480p video.when I tried 14 reframes for 854x480p video,I believe the level jumped to 4.0.so it's also applicable for level 3.2.

Last edited by h3nry; 3rd January 2013 at 20:02.
h3nry is offline   Reply With Quote
Old 3rd January 2013, 21:58   #24  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
I suspect 480p means 720x480, and a wider width would be considered more than 480p, but according to the info here there's no ref frames restriction for level 3.2 under 720p. http://en.wikipedia.org/wiki/H.264#Levels

The easiest way to find out is probably to run a short encode at 854x480 using the veryslow preset while specifying level 3.2. If the encoder doesn't reduce the number of ref frames to less than 16 you should be safe to use 16. If you're letting the encoder decide the level it's just guessing really.
hello_hello is offline   Reply With Quote
Old 4th January 2013, 15:31   #25  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
okay i'll give it a try.how to enforce level.is there a way to do it in vidcoder,I could only find profile,preset and tuning.
h3nry is offline   Reply With Quote
Old 4th January 2013, 18:49   #26  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by hello_hello View Post
I suspect 480p means 720x480, and a wider width would be considered more than 480p, but according to the info here there's no ref frames restriction for level 3.2 under 720p. http://en.wikipedia.org/wiki/H.264#Levels
Actually, it lists 5 as the maximum for 720p @ Level 3.2:
1,280×720@60.0 (5)
Even Levels 4.x are limited to 9 for 720p, and 13 at Level 5.0. You need to get to Level 5.1 before 14 refs is allowed for 720p.

That said, 854x480 is still legal in Level 3.0 (still fewer macroblocks than 720x576). But I have seen hardware decoders (or their middleware layers) that only go up to Level 3.0 also require a max width of 720 and a max height of 576 for 25 fps or less and a max height of 480 for >25 fps.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 4th January 2013, 21:50   #27  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by h3nry View Post
okay i'll give it a try.how to enforce level.is there a way to do it in vidcoder,I could only find profile,preset and tuning.
I must have remembered wrong. I thought VidCoder let you set both.
I think x264 uses High Profile unless you tell it to use something else, but looking at the HandBrake guide and how x264 speak is converted to mplayer speak, this would be my best guess:

profile=high and level=3.2 should do it, so if you wanted to combine them with preset veryslow I think the command line you'd add to either HandBrake or VidCoder would be:

profile=high:level=3.2:Preset=veryslow

(I just capitalised the "P" for preset to stop the forum from turning it into a smiliy. )

Last edited by hello_hello; 4th January 2013 at 21:52.
hello_hello is offline   Reply With Quote
Old 4th January 2013, 22:04   #28  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by benwaggoner View Post
Actually, it lists 5 as the maximum for 720p @ Level 3.2:
Even Levels 4.x are limited to 9 for 720p, and 13 at Level 5.0. You need to get to Level 5.1 before 14 refs is allowed for 720p.

That said, 854x480 is still legal in Level 3.0 (still fewer macroblocks than 720x576). But I have seen hardware decoders (or their middleware layers) that only go up to Level 3.0 also require a max width of 720 and a max height of 576 for 25 fps or less and a max height of 480 for >25 fps.
Yeah I was referring to it not listing ref frames for a resolution "under" 720p.
I wasn't sure how it works myself though, whether for 480p you can use 16, for 720p it's 5, but whether the number of ref frames allowed "scales" for resolutions in between 480p and 720p (ie 12 for around 680p etc), or whether it's a free-for-all right up to the 720p 5 ref frame barrier.

I guess if 854x480 is still "legal" 480p and there's no ref frame limit for 480p using level 3.2, x264 should use 16 if one of the slowest presets is also used. If so I guess h3nry can easily test an encode using his phone to see if it's hardware decoder minds.
hello_hello is offline   Reply With Quote
Old 5th January 2013, 16:52   #29  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Quote:
Originally Posted by hello_hello View Post
If you're letting the encoder decide the level it's just guessing really.
you're right.I tested it on vlc media player.set reframes=16 and selected level 3.2.and the video came out with 16 reframes while the level's still 3.2 .I thought the encoder will raise the level if only it's needed.

I tried it on my phone.though most of the time it showed "video cannot be played" it managed to play a few times.the playback began with white strips,false colors,and huge artifacts.it recovered within 5-10 seconds though.

let me see if I can enforce level using handbrakes command line.I had already tried setting the tuning and preset using command line. I thing it didn't worked
h3nry is offline   Reply With Quote
Old 5th January 2013, 21:12   #30  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
If you manually set any of the advanced options such as reference frames or add them to the command line they'll over-ride the chosen speed preset and profile/level. The x264 speed presets won't over-ride the profile/level though, so to be sure it's compliant you might want to use the veryslow or placebo speed preset to get the maximum number of reference frames while setting the level 3.2. You can still change any of the other options if you don't want to use the exact speed preset settings (number of b frames etc). I'm pretty sure that'll work.

I gather some decoders check the video stream differently to others. For instance MPC-HC's DXVA decoder has options to do a full check, skip the level check, skip the ref frames check or not check anything. By default it just skips the level check but I guess different decoders might do it differently.
hello_hello is offline   Reply With Quote
Old 5th January 2013, 21:58   #31  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
If you want to be completely compliant you might want to check if there's any bitrate restrictions in the phone's specs, and x264 doesn't automatically enforce them for a specificed profile/level as far as I know, so you might want to add the appropriate --vbv-bufsize & --vbv-maxrate settings to the command line. There's a table of them here. I'll go with the assumption it's correct.
http://www.encoding.com/do_you_have_any_information_on_h.264_levels
hello_hello is offline   Reply With Quote
Old 5th January 2013, 23:58   #32  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
They are correct for baseline and main profile. The other profiles have other values:
sneaker_ger is offline   Reply With Quote
Old 7th January 2013, 11:16   #33  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Quote:
Originally Posted by hello_hello View Post
The x264 speed presets won't over-ride the profile/level though, so to be sure it's compliant you might want to use the veryslow or placebo speed preset to get the maximum number of reference frames while setting the level 3.2.
okay,I tried with handbrake.we can enforce a level using hb's command line.and you are wrong.setting level to a certain value ain't limiting anything.I encoded a 720p video with veryslow preset and set the level to 3.2. I tried handbrake,vidcoder and vlc.(In handbrake we cannot set the preset/tune using it's command line.so I manually set reframes=16)I checked the output using mpc-hc,and it's showing level=3.2 while refames still 16!where it shouldn't be more than 5.I also tried manually setting reframes=16 and restricting level=3.2 in all the three.same result

then I tried a 1080p video with reframes=16 and set the level to 3.2.the resolution itself won't fit in the level.still mpc-hc showed level 3.2 with reframes=16 for a 1920*1080p video.
h3nry is offline   Reply With Quote
Old 7th January 2013, 21:45   #34  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by h3nry View Post
okay,I tried with handbrake.we can enforce a level using hb's command line.and you are wrong.setting level to a certain value ain't limiting anything.
As I said, if you manually set a value for one of x264's settings in the command line it'll over-ride the level used. It'll also over-ride the speed preset used. If you add ref frames to the command line that's the value which will be used.

I just ran 4 short encodes using x264 defaults and the veryslow preset. High profile Level 3.2. I changed nothing but the resizing in the script each time. According to MediaInfo:

1280x720, 5 ref frames.
854x480, 12 ref frames.
720x480, 15 ref frames.
720x400, 16 ref frames.

And just to be 100% certain it was x264 adjusting the number of reference frames and not MeGUI being clever, I created a script and opened it with AvsPmod and used it to run two encodes using the same command line. According to MediaInfo:

1280x720, 5 ref frames.
720x480, 15 ref frames.

So I guess my suggestion there are no ref frame restrictions for level 3.2 under 720p was wrong, while I guess my theorising that it might work on a sliding scale according to resolution is correct. Well the x264 encoder seems to think so.....

Quote:
Originally Posted by h3nry View Post
I encoded a 720p video with veryslow preset and set the level to 3.2. I tried handbrake,vidcoder and vlc.(In handbrake we cannot set the preset/tune using it's command line.
Vidcoder does have an option to set the Profile and speed preset though, so after setting it to High Profile and Preset VerySlow, all of the advanced encoder options to default, deleting anything already in the command line area and then adding level=3.2, I ran an encode and got MediaInfo to take a look.

1280x720, 16 ref frames, Level 3.2

Given my VidCoder encode still used 16 ref frames at 1280x720, it shows VidCoder can no more use an x264 speed preset than HandBrake can. The obvious conclusion would be it's simply letting you select a speed preset but adding the appropriate x264 advanced options to the command line behind the scenes instead of requiring you to enter them manually as HandBrake does. I had no idea VidCoder's x264 speed preset option is really only VidCoder playing pretends. You learn something every day. I think that makes it a bad program in some ways. Users might expect the chosen speed preset will have it's ref frames kept in check by the x264 level used as it should. At least Handbrake is honest about it.

Last edited by hello_hello; 7th January 2013 at 22:04.
hello_hello is offline   Reply With Quote
Old 8th January 2013, 11:51   #35  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Whatever,if it doesn't work,the video should be showing appropriate level.why is it still showing level 3.2 for 1080p video with 16 reframes?how's that possible?

Quote:
Originally Posted by hello_hello View Post
I just ran 4 short encodes using x264 defaults and the veryslow preset. High profile Level 3.2. I changed nothing but the resizing in the script each time. According to MediaInfo:

1280x720, 5 ref frames.
854x480, 12 ref frames.
720x480, 15 ref frames.
720x400, 16 ref frames.

And just to be 100% certain it was x264 adjusting the number of reference frames and not MeGUI being clever
it seems this level thing works in MeGUI .how did you managed to use Mencoder. I couldn't even install that.I checked for installation guides in many sites and I did't understand any of that.
h3nry is offline   Reply With Quote
Old 8th January 2013, 12:39   #36  |  Link
JEEB
もこたんインしたお!
 
JEEB's Avatar
 
Join Date: Jan 2008
Location: Finland / Japan
Posts: 512
If the thing uses libx264, it would have to implement reference frame limits by itself. The library does not have this feature built-in. In it, just like in x264cli quite some time ago, the level setting is just a flag. Nothing more, nothing less. If you used libx264 and got reference frames limited automatically, then something implemented that and set the settings for libx264 manually.

On the other hand, x264cli, which is used by, f.ex., MeGUI, does actually limit reference frames to the level limits if the user does not override. It is implemented in x264.c:
Code:
/* Automatically reduce reference frame count to match the user's target level
 * if the user didn't explicitly set a reference frame count. */
if( !b_user_ref )
{
    int mbs = (((param->i_width)+15)>>4) * (((param->i_height)+15)>>4);
    for( int i = 0; x264_levels[i].level_idc != 0; i++ )
        if( param->i_level_idc == x264_levels[i].level_idc )
        {
            while( mbs * 384 * param->i_frame_reference > x264_levels[i].dpb &&
                   param->i_frame_reference > 1 )
            {
                param->i_frame_reference--;
            }
            break;
        }
}
__________________
[I'm human, no debug]
JEEB is offline   Reply With Quote
Old 8th January 2013, 21:36   #37  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by h3nry View Post
it seems this level thing works in MeGUI .how did you managed to use Mencoder. I couldn't even install that.I checked for installation guides in many sites and I did't understand any of that.
I didn't. I tried it using VidCoder. It didn't work. I originally thought that's because VidCoder doesn't really use the x264 preset system but instead just adds the equivalent advanced settings to the command line, which stops x264 from limiting the number of reference frames as it normally would.

According to JEEB's post above this one however, I got that wrong. The version of x264 which HandBrake/Vidcoder uses simply doesn't have the ability to limit reference frames according to the specified level as the command line version does. If that's the case I'm sorry, I was completely unaware of the differences in x264 versions and as a result I've probably led you on a bit of a wild goose chase.
hello_hello is offline   Reply With Quote
Old 8th January 2013, 22:16   #38  |  Link
JEEB
もこたんインしたお!
 
JEEB's Avatar
 
Join Date: Jan 2008
Location: Finland / Japan
Posts: 512
Not really a case of versions. The x264 provides libx264 (the library) and x264cli (the command line encoder).

x264cli uses libx264, and then implements a command line application around it to encode stuff with easily (input modules, ability to read data from files etc.). It also implements that piece of code I posted. In other words, if any application uses libx264, it won't get that feature. For example ffmpeg and libav lack this for that exact reason in their libavcodec libraries, as they do not implement it themselves. And Handbrake, for example, if I recall correctly, uses libavcodec to encode with libx264. Thus, setting the level there is a case of just setting a flag to a value.

I recommend people either poke x264 developers to get this feature into libx264, or start poking the projects using it to implement the feature

I've been thinking about implementing it in libavcodec for a while, maybe when I get the time...
__________________
[I'm human, no debug]
JEEB is offline   Reply With Quote
Old 10th January 2013, 22:20   #39  |  Link
h3nry
Registered User
 
Join Date: Dec 2012
Posts: 16
Quote:
Originally Posted by jq963152 View Post
But to use it you can not use the options string text box (like mentioned above), instead you have to select the desired Profile and Level from the "H.264 Profile" and "H.264 Level" drop-down lists in the Video tab of the HandBrake/VidCoder GUI.
where?there are no "H.264 Profile" and "H.264 Level" drop-down lists in hanbrake.all it have is a built in presets list(ipod,appletv etc).and there's no "H.264 Level" drop-down list in vidcoder
h3nry is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.