Video Encoding: For Beginners

OP
R

RahulB

Journeyman
Exactly but I wonder why use avi at all when we have better containers like mkv and mp4 which support better codecs too. Maybe you have a DVD player which only supports avi.
 
OP
R

RahulB

Journeyman
Well then freemake is good, you can also look into avidemux, that is good too, x264 in avi won't work on your device, you will have to use xvid
 

anirbandd

Conversation Architect
great tutorial. bookmarked.

i use AVS video converter to convert mkv to mp4 for playing on PS3/Bravia. will these settings works for mp4 too??

if i use MeGUI, do i need to install any other libraries??
 
OP
R

RahulB

Journeyman
I am not sure about AVS but if they use H.264 the settings should have the same names.. Give it a try.
To use MeGUI you would require AviSynth ( I think newer versions don't require it, spotted AVS.dll in my MeGUI folder ),
you would also require to set up a dedicated Directshow decoding engine. Just install LAV filters and use Win7DS Filter Tweaker to change defaults.
A good guide is available at MeGUI website.

Otherwise MeGUI is quite hassle free
 

anirbandd

Conversation Architect
umm.. thats all hebrew for me :p

am using handbrake. its beautiful...
i got this encoding setting from the KMPlayer media info of a recent blockbuster movie.
cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=8954 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00

i followed your guide on post 1 and got the following setting on the CLI on the Advanced tab:
rc-lookahead=50: ref=6: bframes=6: b-adapt=2: direct=auto:me=umh: subme=10: merange=30: analyse=all: psy-rd=1.0,0.15

a sample encode showed the following settings:
cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=30 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=6 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=2500 / ratetol=1.0 / qcomp=0.60 / qpmin=4 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00

the sample was awesome in quality. on 30mins or so on Handbrake, and i get a gawddam awesome encode..

thanks a lot bro!! :clap2: :doublethumb: :goodjob:

only one more thing... am using mp4 container.. the sample came out as m4v.. no suppot for m4v is listed on Sony site.. *www.sony.co.th/support/compatibility/450045/product/kdl-46ex520?site=hp_en_TH_i

i will test on my TV but just incase, is there any method to change extension to mp4??

UPDATE: not detecting on Bravia. PS3 detecting file and playing, but no video, only audio.

UPDATE: Fixed.. changed file extension to mp4 in the destination field.
 
Last edited:
OP
R

RahulB

Journeyman
Good Job. Hmm.. I haven't used Handbrake in some time. I think certain new settings are now available. Should update my post I suppose. Or maybe I should finally post a guide to MeGUI. I started one but MeGUI kept on changing drastically. It seems stable now. What do you think?
 

anirbandd

Conversation Architect
Sure!! i would definitely agree with you on adding a new Encoding Tutorial on MeGUI. :+1:

as for updating Handbrake, i can suggest something, if you give me the permission ;)
 

anirbandd

Conversation Architect
For direct use on LED/LCD TV via USB or PS3/X360.

Profile: Universal Profile.
Use *.mp4 as extension on the Destination field.

PICTURE:
........................................Anamorphic: None - Width and Height equal to source.
........................................Cropping: Custom - Set according to source pixel size. Mostly all zeros.
VIDEO FILTERS:
........................................Detelecine: Off
........................................Decomb: Off for HQ BluRay/BRrip source. On for LQ BRrip/DVDrip source.
........................................Deinterlace: Off for HQ BluRay/BRrip source. On for LQ BRrip/DVDrip source.
........................................Denoise: Off for HQ BluRay/BRrip source. Weak for LQ BRrip/DVDrip source.
........................................Deblock: Off for HQ BluRay/BRrip source. 5-7 for LQ BRrip/DVDrip source.
VIDEO:
........................................Codec: H.264
........................................FPS: Same as source - Variable.
........................................Quality: Avg Bitrate (set as required, less than than source bitrate) - [Enable 2Pass Encoding & Turbo first Pass]
AUDIO:
........................................Codec: AAC (ffmpeg) [Have not tested AC3/DTS]
........................................Bitrate: Less than or Equal to Source audio
........................................Sample Rate: Auto
........................................Mixdown: Stereo (Louder) / 5.1Ch (Less Loud)
........................................Gain: 0-2
ADVANCED:

........................................Paste in CLI:
Code:
rc-lookahead=50:ref=6:bframes=6:b-adapt=2:direct=auto:me=umh:subme=10:merange=30:analyse=all:psy-rd=1.0,0.15
 

anirbandd

Conversation Architect
wow! cool!

this is taken from the media info of a encode:
Writing application : mkvmerge v4.1.1 ('Bouncin' Back') built on Jul 3 2010 22:54:08
Writing library : libebml v1.0.0 + libmatroska v1.0

now as far as i know, mkvmerge is a merging s/w, which merges a mkv video source, audio source/s, subtitles, chapters into a single mkv container.. so its obvious, that these guys seperately encode video and audio and then merge them. assuming they use handbrake for video encode, what s/w is used for the audio encode??

UPDATE: DTS passthru option in audio tab of handbrake should not be used for direct USB playing on TVs. TV hardware cannot decode DTS. tested on Bravia KDL-EX520 46"
 

Prongs298

In the zone
i am trying to convert all the 700 mb and 1.x gb dvdrips or brrips to 350 or 400 mb mkvs. now the new versions of handbrake 0.9.6 and 0.9.8 have removed the target size option but i have the older versions. can someone guide me on how to get their size right with small loss in quality. i did some reading but cant get the encodes right. i am trying to get something like this -
ormat : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 323 MiB
Duration : 1h 34mn
Overall bit rate mode : Variable
Overall bit rate : 480 Kbps
Encoded date : UTC 2011-04-27 23:39:48
Tagged date : UTC 2011-04-27 23:39:48
Writing application : Yamb 2.1.0.0 [*yamb.unite-video.com]

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1h 34mn
Bit rate : 435 Kbps
Maximum bit rate : 2 173 Kbps
Width : 720 pixels
Height : 384 pixels
Display aspect ratio : 1.85:1
Frame rate mode : Constant
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.066
Stream size : 293 MiB (91%)
Title : Imported with GPAC 0.4.6-DEV (internal rev. 5)
Writing library : x264 core 114 r1900 60ef1f8
Encoding settings : cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=0 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=1 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / constrained_intra=0 / bframes=6 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=435 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2011-04-27 22:41:30
Tagged date : UTC 2011-04-27 23:41:33

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AACv2 / HE-AAC / LC
Codec ID : 40
Duration : 1h 34mn
Bit rate mode : Variable
Bit rate : 42.0 Kbps
Maximum bit rate : 50.0 Kbps
Channel(s) : 2 channels / 1 channel / 1 channel
Channel positions : Front: L R / Front: C / Front: C
Sampling rate : 48.0 KHz / 48.0 KHz / 24.0 KHz
Compression mode : Lossy
Stream size : 28.3 MiB (9%)
Encoded date : UTC 2011-04-27 23:41:30
Tagged date : UTC 2011-04-27 23:41:33

i really need to convert these as i have no money for ext. HDD and i am returning to college in 3 days. I can do with a reasonable loss in quality as i have all the movies in my desktop hdd at home. please help.
 

anirbandd

Conversation Architect
reduce the bitrate: Bit rate : ~500 Kbps

but keep all other encoding settings same as the one you have given.
 
OP
R

RahulB

Journeyman
Increase settings and reduce bitrate ~500

wow! cool!

this is taken from the media info of a encode:

now as far as i know, mkvmerge is a merging s/w, which merges a mkv video source, audio source/s, subtitles, chapters into a single mkv container.. so its obvious, that these guys seperately encode video and audio and then merge them. assuming they use handbrake for video encode, what s/w is used for the audio encode??

UPDATE: DTS passthru option in audio tab of handbrake should not be used for direct USB playing on TVs. TV hardware cannot decode DTS. tested on Bravia KDL-EX520 46"

Yeah I don't think DTS is supported for Bravia.
For Audio they must be using AAC or AC-3.
Encoder used could be: Nero AAC encoder, FAAC ( I think this is the one handbrake uses )
Encoder for AC-3: Aften
 

anirbandd

Conversation Architect
Yeah I don't think DTS is supported for Bravia.
For Audio they must be using AAC or AC-3.
Encoder used could be: Nero AAC encoder, FAAC ( I think this is the one handbrake uses )
Encoder for AC-3: Aften

have you used DTS passthru option?? i tested it on my PC & PS3 too. video is playing fine, but there is no audio. KMPlayer shows the audio stream info:
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 37.8 MiB
Duration : 30s 29ms
Overall bit rate : 10.6 Mbps
Encoded date : UTC 2012-12-27 18:32:48
Tagged date : UTC 2012-12-27 18:34:05
Writing application : HandBrake 5106svn 2012122601
Video #1
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.0
Format settings, CABAC : Yes
Format settings, ReFrames : 6 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 30s 29ms
Bit rate mode : Variable
Bit rate : 9 000 Kbps
Width : 1 920 pixels
Height : 800 pixels
Display aspect ratio : 2.40:1
Frame rate mode : Variable
Frame rate : 23.976 fps
Minimum frame rate : 23.810 fps
Maximum frame rate : 24.390 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.244
Stream size : 32.4 MiB (86%)
Writing library : x264 core 128
Encoding settings : cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=30 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=6 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=9000 / ratetol=1.0 / qcomp=0.60 / qpmin=4 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2012-12-27 18:32:48
Tagged date : UTC 2012-12-27 18:34:05
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
Audio #2
ID : 2
Format : DTS
Format/Info : Digital Theater Systems
Codec ID : A9
Bit rate mode : Constant
Bit rate : 1 510 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 5.40 MiB (14%)
Language : English
Encoded date : UTC 2012-12-27 18:32:48
Tagged date : UTC 2012-12-27 18:34:04

what seems to be the problem??
 
OP
R

RahulB

Journeyman
Try changing the Codec ID to A_DTS
Try Remuxing file using MKVtoolnix ( Handbrake MKV muxing mode can be dodgy sometimes )
Try playing using a different player ( ditch KMplayer use Potplayer ) like MPC-HC
Check Soundcard settings
 
Top Bottom