Log in

View Full Version : Selecting the right profile.


sameersbn
17th December 2010, 19:12
Hello,

I am trying to understand the difference between the various h.264 profiles namely baseline, main and high.

From what i already understand is that main and high profiles support bframes while baseline does not. I also have figured that high profile kinda superseeds main profile.

What i really need to understand is which of these provides for better quality at lower bitrates. I am trying to select a profile to stream compressed video over http so that it plays back smoothly on a 1 Mbps line. Through my tests i have arrived at the conclusion that at 800k video bitrate i am able to achieve smooth video playback (ignoring bandwidth fluctuations).

I am not trying to encode video at realtime, in which case speed of encoding becomes a big factor. The video will be pre-encoded and stored ready for streaming.

Now i really need to pick is the right profile and try various encoding options to get the best quality at 800k bitrate.

Looking forward to your reply.

Thanks and Regards
~Sameer

nm
17th December 2010, 19:27
What i really need to understand is which of these provides for better quality at lower bitrates.

High Profile. It allows 8x8 DCT, which improves compression by a percent or two, without sacrificing speed.

Blue_MiSfit
18th December 2010, 07:14
Yes. You should use High unless you have an old device that only supports Main or Baseline. Everything new these days supports High Profile.

Derek

sameersbn
18th December 2010, 08:36
Thanks for the replies.

Any suggestions on what ffmpeg/x264 settings will positively influence the quality of the rip.

Right now i am doing a two pass encode using ffmpeg with the default hq preset.

ffmpeg -i <infile> -vcodec libx264 -vpre hq -b 800k -an -threads 0 -pass 1 -f matroska /dev/null
ffmpeg -i <infile> -vcodec libx264 -vpre hq -b 800k -an -threads 0 -pass 2 -f matroska <outfile.mkv>

the default hq preset contains the following:

$ cat /usr/share/ffmpeg/libx264-hq.ffpreset
coder=1
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=8
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=2
qcomp=0.6
qmin=10
qmax=51
qdiff=4
bf=3
refs=4
directpred=3
trellis=1
flags2=+wpred+mixed_refs+dct8x8+fastpskip
wpredp=2
$

To a novice, these settings make little sense. Could you please point out which settings make the most of the quality difference and whether i should add some settings. Right now i am going by trail and error, but here the difficult part is identifying whether the quality has increased or decreased (is there a tool or something for that?).

I choose matroska because it seems to be lightweight in terms of data size.

Thanks and Regards
~Sameer

J_Darnley
18th December 2010, 11:26
Since the hq preset doesn't exist anymore, I wonder how old the rest of ffmpeg is. You should be using the x264 speed presets, e.g. medium_firstpass and medium. hq was roughly the same as slow. If you want a slower encode, use a slower preset.

Another thing, you appear to have forgotten audio options. You should give some unless you want mp2 at 64k.

There are lots of tools to measure the difference between the source and the encode. None of them are as good as your eye and they are meaningless with psychovisual features.

sameersbn
18th December 2010, 12:17
Since the hq preset doesn't exist anymore, I wonder how old the rest of ffmpeg is.


It is ffmpeg-0.6. I will compile the source from the daily snapshots now, including the x264 sources


You should be using the x264 speed presets, e.g. medium_firstpass and medium. hq was roughly the same as slow. If you want a slower encode, use a slower preset.


I might have copied it from an older ffmpeg installation.
Yes i will start using the speed preset here on. I would guess that slower the quality, better the encode.


Another thing, you appear to have forgotten audio options. You should give some unless you want mp2 at 64k.


For the audio, i am using
-acodec aac -ab 128k -ac 2 -ar 48000 -strict experimental

To reduce the overall bitrate i intend to bring down the audio bitrate to 96k or 64k. I am however hoping that i can keep it at 128k.

nm
18th December 2010, 16:00
For the audio, i am using
-acodec aac -ab 128k -ac 2 -ar 48000 -strict experimental

To reduce the overall bitrate i intend to bring down the audio bitrate to 96k or 64k. I am however hoping that i can keep it at 128k.

FAAC is a very poor choice. Use LAME MP3 at 128 kbps or some good AAC encoder at lower bitrates. If you can't use Nero AAC encoder because of licensing issues, or Vorbis because of missing player support, 96 kbps MP3 encoded with LAME should be ok.

sameersbn
18th December 2010, 17:59
FAAC is a very poor choice. Use LAME MP3 at 128 kbps or some good AAC encoder at lower bitrates. If you can't use Nero AAC encoder because of licensing issues, or Vorbis because of missing player support, 96 kbps MP3 encoded with LAME should be ok.

Thanks for the heads up on FAAC, now it makes sense why the encoding quality of AAC at 96k is so bad. I will test and evaluate lame at 96k, if it works better than AAC at 96k, than there's no looking back.

Regards
~Sameer

sameersbn
19th December 2010, 05:14
NeroAAC is amazing! At 32k as well i get great quality.
Will have to figure out how add the neroaac encoded stream to the output in ffmpeg.

upyzl
19th December 2010, 14:05
For lossy audio encoder, I suppose qtaacenc is the best :)
but the disadvantage is you must have installed QT Lite at least...

http://www.hydrogenaudio.org/forums/index.php?showtopic=78072