12 ->
List results:
Search options:
Use \ before commas in usernames
I was wondering about the knowledge base settings for encoding H.264 videos.  It suggests a b-frame count of 3, but I was wondering why not just set it to max.  With adaptive b-frames, the encoded will only use as many of them as will improve quality for the bitrate.  This could be even more percievable in RTS games where still and panning frames can be primarialy encoded by motion compensation from previous and post P frames.

I wish I had some uncompressed RTS footage so that I could play around with that and Elecard Streem Eye, and I might be able to say more, but if someone knows a good reason why b-frames should not be higher than 3 when adaptive b-frames is on I am all ears.
Thread title:  
was it quicktime? there was some reason. have to wait for snow as that part of the settings was him.
When I was writing the guide, I was reading info about the settings at the same time. I believe I was getting the info from doom9. Anyways, I remember reading that encodings usually don't use more than 3 b-frames in a row, which is why I wrote:
Number of B-Frames - I recommend 3, since it is rare that you'll see more than that in a row.

Eh, these are just recommended settings after all. Use more if you want.
be very careful though to test your output in various players. quicktime especially is notorious for not supporting good features of the standard.
Edit history:
ballofsnow: 2007-02-25 11:24:02 pm
Found a way to list frame types in a video.

- Download mpeg4ip
- Extract the raw video stream from your video, either with YAMB or mp4box.exe -raw 1 filename.mp4. (may have to use 2 instead of 1 for trackid #)
- Extract h264_parse.exe from mpeg4ip
- Run a command line:

h264_parse.exe rawvideo.h264 | find "slice_type:" > framedump.txt

I used 5 adaptive b-frames in a particular video and saw from the frame dump that there were indeed many places that used 5 b-frames in a row.

Should we raise the number suggested? Maybe I can write a script to see how many times there were singles, two in a row, three-in a row, etc..
definitely a good idea. i mean if quicktime and friends support it then there's no reason not to if your script finds they're being used, right?
Edit history:
ballofsnow: 2007-02-26 02:25:16 am
Well.. it's a pretty crude script, but that's what you get from batch files...

This reads the framedump, so the h264_parse must be done first.

@echo off
del temp.txt 2> nul

REM i=7,p=5,b=6
set itotal=0
set ptotal=0
set btotal=0
set b0=0
set b1=0
set b2=0
set b3=0
set b4=0
set b5=0
set bcount=0

set linenum=1
FOR /F "tokens=2 delims= " %%A IN ('type %1') do call :count %%A
set linenum=1
FOR /F "tokens=1 delims= " %%A IN ('type temp.txt') do call :countb %%A

set /A b1percent=(%b1% * 10000) / %btotal%
set /A b2percent=(%b2% * 2 * 10000) / %btotal%
set /A b3percent=(%b3% * 3 * 10000) / %btotal%
set /A b4percent=(%b4% * 4 * 10000) / %btotal%
set /A b5percent=(%b5% * 5 * 10000) / %btotal%

echo Total I frames: %itotal%
echo Total P frames: %ptotal%
echo Total B frames: %btotal%
echo B1: %b1%  ~%b1percent:~0,-2%.%b1percent:~-2%%%  of total b-frames
echo B2: %b2%  ~%b2percent:~0,-2%.%b2percent:~-2%%%
echo B3: %b3%  ~%b3percent:~0,-2%.%b3percent:~-2%%%
echo B4: %b4%  ~%b4percent:~0,-2%.%b4percent:~-2%%%
echo B5: %b5%  ~%b5percent:~0,-2%.%b5percent:~-2%%%
del temp.txt 2> nul

if %1==6 (
   set /A btotal=%btotal% + 1 & set /A bcount=%bcount%+1
) else (
   if %1==5 (
      set /A ptotal=%ptotal% + 1  & echo %bcount% >> temp.txt & set bcount=0
   ) else (
      if %1==7 (
         set /A itotal=%itotal% + 1 & echo %bcount% >> temp.txt & set bcount=0
echo %linenum%
set /A linenum=%linenum%+1

if %1==1 (
   set /A b1=%b1%+1
) else (
   if %1==2 (
      set /A b2=%b2%+1
   ) else (
      if %1==3 (
         set /A b3=%b3%+1
      ) else (
         if %1==4 (
            set /A b4=%b4%+1
         ) else (
            if %1==5 (
               set /A b5=%b5%+1
echo %linenum%
set /A linenum=%linenum%+1

The code would have to be changed to allow count for more than 5 b-frames in a row.

Anyways, I ran it on the vid with max 5 b-frames and got:

Total I frames: 143
Total P frames: 11503
Total B frames: 13708

B1: 5444
B2: 1642
B3: 999
B4: 159
B5: 269


~40% were singles
~24% in twos
~22% in threes
~5% in fours
~10% in fives

I'm going to encode another full segment soon, set with max b-frames and post results from that. Will be a day or two before it comes.
ok very cool. this is good work you're doing for us.
Edit history:
ballofsnow: 2007-02-26 07:11:30 pm
Total I frames: 157
Total P frames: 16283
Total B frames: 14323

B1: 7541  ~52.64%  of total b-frames
B2: 1576  ~22.00%
B3: 395  ~8.27%
B4: 198  ~5.52%
B5: 240  ~8.37%
B6: 1  ~.4%
B7: 0  ~.0%
B8: 0  ~.0%
B9: 0  ~.0%
B10: 0  ~.0%
B11: 0  ~.0%
B12: 1  ~.8%
B13: 0  ~.0%
B14: 0  ~.0%
B15: 29  ~3.03%

Strange that there's so few between B6 and B14, and then 29 sets of 15 b frames...


Total I frames: 163
Total P frames: 13563
Total B frames: 14378

B1: 7404  ~51.49%  of total b-frames
B2: 1424  ~19.80%
B3: 575  ~11.99%
B4: 266  ~7.40%
B5: 267  ~9.28%
B6: 0  ~.0%
B7: 0  ~.0%
B8: 0  ~.0%
B9: 0  ~.0%
B10: 0  ~.0%
B11: 0  ~.0%
B12: 0  ~.0%
B13: 0  ~.0%
B14: 0  ~.0%
B15: 0  ~.0%

I think 5 will be a good number to recommend.
if i understand what a b-frame is then that 15 actually makes a lot of sense. in games you see a lot more of this kind of thing where everything on the screen is the same save for say text scrolling by or an energy bar filling up or something along those lines. and that tends to go on for a long time in some cases, thus the hella b-frame sequences. so yeah i mean we could recommend 5 but why not just go with 15 since it's obviously using them? can you tell what cutting those guys out does to the bitrate? also i know i'm a broken record at this point but we need to test every step of the way in quicktime and friends before this gets out anywhere.
Edit history:
ballofsnow: 2007-02-26 10:44:50 pm
but why not just go with 15 since it's obviously using them?

Depends on if the encoding time goes up. I could just as easily recommend that people use Multi Hex instead of Hexagon, RDO Level 2 instead of Multi QPel, more reference frames, Trellis 2.......
that's true. need more testing i guess. Wink
Edit history:
darkwasabi: 2007-02-27 05:31:46 pm
King of hearts
I love the concept of B frames.  I always set it to 16 for my highest quality(I go all out with all the settings).  The rest don't matter since if you cared about that extra little bit of quality, you wouldn't get NQ or LQ in the first place.
very true.
new settings for all qualities:

--direct temporal --filter 6,6 --ref 5 --mixed-refs --bframes 16 --bime --weightb --subme 6 --trellis 2 --analyse all --me umh
--filter 6,6

Can you explain the rationale behind this?
lol, how did that get in there!? wow. might be better to leave that default, don't you think?
k... thought you found some secret deblocking strategy or something.


Edit history:
dex: 2007-03-08 06:58:53 pm
Invisible avatar
Goodie I have the source files for my first Deus Ex segment...

Are there any more changes imminent, or is it going to be more or less the final setup? Because I don't have the hard drive capacity to store more than 10 segments lossless files, and I don't have a DVD recorder either...

Also, maybe something about an encoding scheme change somewhere else on the site, I almost omitted this thread...
Edit history:
ballofsnow: 2007-03-08 09:42:50 pm
Also, maybe something about an encoding scheme change somewhere else on the site, I almost omitted this thread...

Encoding scheme? Encoding scheme?

You don't have to follow nate's settings exact. You can do anything you want, as long as main profile is selected, b-pyramid is off and the appropriate minimum quantizer is used.

Apart from setting b-frames to max which I consider a pretty significant change, nate just used higher quality settings for everything else.

Anyone crazy enough to follow this encoding scheme?

--ref 16 --mixed-refs --no-fast-pskip --bframes 16 --b-rdo --bime --weightb --subme 7 --trellis 2 --analyse p8x8,b8x8,i4x4,p4x4 --me umh --merange 64 --threads auto --thread-input --progress --no-psnr --no-ssim

edit- hmm

--analyse all

This looks like you have high profile selected. I'm pretty sure Quicktime 7 can't handle I8x8 and Adaptive DCT.

I've never tested this myself, though. The Quicktime profile that comes with MeGUI uses main profile.

edit- http://forum.doom9.org/showthread.php?t=102609&highlight=quicktime+adaptive+dct

erm.. it's also saying quicktime 7 decoder handles max 2 b-frames.. But I don't think this is true..

edit- Just tested, Adaptive DCT + I8X8 does not work in quicktime 7.
Invisible avatar
Hehe, so I can avoid using a few of those settings? That would be cool, because the new settings quadruple the encoding time without giving too much quality boost over my usual settings.
It might be trellis slowing you down.
Invisible avatar
Hmm, I'll check that and if it is it, I'll just lower that one option.
This looks like you have high profile selected. I'm pretty sure Quicktime 7 can't handle I8x8 and Adaptive DCT.

how did you test? i tested the hlbs stuff with qt 7 on both doze and mac and there were no problems.