Log in

View Full Version : Xvid compression to Exact Filesize/Bitrate i choose..


DjDiabolik
17th March 2015, 03:21
Hi boys&Girls in this forum... i need some help whit this mpeg2 file:

General
Complete name : 05_OK.mpg
Format : MPEG-PS
File size : 1.37 GiB
Duration : 20mn 17s
Overall bit rate mode : Variable
Overall bit rate : 9 683 Kbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : Variable
Format settings, picture st : Frame
Duration : 20mn 17s
Bit rate mode : Variable
Bit rate : 9 300 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.897
Time code of first frame : 00:00:00:00
Time code source : Group of pictures header
Stream size : 1.31 GiB (95%)
Color primaries : BT.601 PAL
Transfer characteristics : BT.470 System B, BT.470 System G
Matrix coefficients : BT.601

Audio
ID : 189 (0xBD)-128 (0x80)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Muxing mode : DVD-Video
Duration : 20mn 17s
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : 24ms
Stream size : 37.1 MiB (3%)



Whit this file i have also already encoding another nine similar mpeg2 (01..02..03.. etc etc.. it's all episode of serial tv) and whit all this nine mpeg2 i have correctly obtain xvid file using a bitrate about 1500 and for everyone obtain a file around 240MB.
For converts this other mpeg2 file i ever used Xvid4psp.... and every conversion it's been completed in about 40 minutes.


Whit this 05.mpeg (and only whit this) i have however a little problems can try to explain:
I have load on xvid4psp.... set all configuration like other file (240MB by bitrate value etc etc)... but the output file it's be bigger than filesize i want and then using a bigger bitrate diffent from that i choose.
I have obtain a about 15MB bigger file:

General
Complete name : 05_OK.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 258 MiB
Duration : 20mn 17s
Overall bit rate : 1 778 Kbps
Writing application : VirtualDubMod 1.5.10.3 | www.virtualdub-fr.org || (build 2550/release)
Writing library : VirtualDubMod build 2550/release

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple@L5
Format settings, BVOP : 1
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 20mn 17s
Bit rate : 1 640 Kbps
Width : 720 pixels
Height : 408 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.223
Stream size : 238 MiB (92%)
Writing library : XviD 1.2.1 (UTC 2008-12-04)

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 20mn 17s
Bit rate mode : Constant
Bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 18.6 MiB (7%)
Alignment : Aligned on interleaves
Interleave, duration : 40 ms (1.00 video frame)
Interleave, preload duratio : 504 ms
Writing library : LAME3.99r
Encoding settings : -m s -V 4 -q 2 -lowpass 17 -b 128



I have retry too many time to re-encode the main mpeg2 whit different profile and different bitrate value (for obtain a 240MB in this case xvid4psp suggest a value of about 1513) but i can't understand because everytime it's used all other different value and the output file it's bigger what i want to obtain.
It's very strange situaion............

After some reading about internet...... i have also tryed to install GordianKnot (0.35.0) and tryed two or three time to converts the 05.mpeg from here i have the same exact "problems":
Configure all.... set desidered bitrate.. wait the finish of encoding... look mediainfo and again... another bigger filesize :)

At this point i have tryed so many solution... like:
- Using xvid4psp and try to set a bitrate value for obtain a file 15MB smallest. I set 225 and i was thinking of getting a file of about 240MB at the end but......no... in this case the filesize and bitrate i choose it's been respected whitout problems!

What appened ?? Someone can help to understand this strange situation ?

Thanks in advance... ad if you need a more info about my file ask to me whitout problems......

Warperus
17th March 2015, 10:45
If you use 1 pass encoding, it's possible for encoder to miss target bitrate due to increasing complexity of video. Last part(s) demand too much bitrate and encoder tolerates increase in file size to come point. Generally it's about 10% of file size that is acceptable. Unfortunately, whatever is already encoded is not touched, so encoder can only make worse quality if you force lower bitrate tolerance or increase file size.
You can try 2 pass encoding. Second pass will know about complexity of source parts and may compensate for it. Exact fit is not garaneteed, but it should be more close to your target.

DjDiabolik
17th March 2015, 13:28
If you use 1 pass encoding, it's possible for encoder to miss target bitrate due to increasing complexity of video. Last part(s) demand too much bitrate and encoder tolerates increase in file size to come point. Generally it's about 10% of file size that is acceptable. Unfortunately, whatever is already encoded is not touched, so encoder can only make worse quality if you force lower bitrate tolerance or increase file size.
You can try 2 pass encoding. Second pass will know about complexity of source parts and may compensate for it. Exact fit is not garaneteed, but it should be more close to your target.

I ever using 2Pass encoding......... using 2pass in xvid4psp.. and like 2pass on Gordian Knot.. ever :)

The last tentative to obtain a 240MB (like other 9 episodes) it's this:

General
Complete name : 05_OK_1.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 216 MiB
Duration : 20mn 17s
Overall bit rate : 1 492 Kbps
Writing application : VirtualDubMod 1.5.10.2 (build 2540/release)
Writing library : VirtualDubMod build 2540/release

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple@L5
Format settings, BVOP : 2
Format settings, QPel : Yes
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 20mn 17s
Bit rate : 1 354 Kbps
Width : 720 pixels
Height : 400 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.188
Stream size : 196 MiB (91%)
Writing library : XviD 73

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Mode extension : MS Stereo
Codec ID : 55
Codec ID/Hint : MP3
Duration : 20mn 17s
Bit rate mode : Constant
Bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 18.6 MiB (9%)
Alignment : Aligned on interleaves
Interleave, duration : 40 ms (1.00 video frame)
Interleave, preload duratio : 504 ms



I have obtained this using Gordian Knot and all setting i choose this time it's been respected as all....
But i can't understand because when i choose to use a much bitrate i can't obtain those selected bitrate but it's can be used a totally and higher bitrate :(

On this site i have founding a setting for using xvid 1.1 with virtualdub/GK but on my windows (windows 7 x64) i have installed the K-Lite Codec Pack and the xvid driver, i check, it's the 1.4.0 developer.
The setting for encoder 1.1 suggestend in this site it's also ok for my version ??

If you want to verify i have ever using the second pass encoding i can post the setting used by GK... it's 05_OK_1_secondpass.settings:

REGEDIT4

[HKEY_CURRENT_USER\Software\GNU\XviD]
"mode"=dword:00000002
"bitrate"=dword:000002bc
"desired_size"=dword:000314a2
"use_2pass_bitrate"=dword:00000000
"desired_quant"=dword:00000190
"quant_type"=dword:00000000
"lum_masking"=dword:00000000
"interlacing"=dword:00000000
"tff"=dword:00000000
"qpel"=dword:00000001
"gmc"=dword:00000000
"use_bvop"=dword:00000001
"max_bframes"=dword:00000002
"bquant_ratio"=dword:00000096
"bquant_offset"=dword:00000064
"packed"=dword:00000000
"closed_gov"=dword:00000001
"num_slices"=dword:00000001
"ar_mode"=dword:00000000
"aspect_ratio"=dword:00000000
"par_x"=dword:00000001
"par_y"=dword:00000001
"ar_x"=dword:00000004
"ar_y"=dword:00000003
"max_vbv_size"=dword:00000000
"max_bitrate"=dword:00000000
"vbv_peakrate"=dword:00000000
"num_zones"=dword:00000001
"rc_reaction_delay_factor"=dword:00000010
"rc_averaging_period"=dword:00000064
"rc_buffer"=dword:00000064
"discard1pass"=dword:00000001
"full1pass"=dword:00000000
"keyframe_boost"=dword:0000000a
"kfreduction"=dword:00000014
"kfthreshold"=dword:00000001
"curve_compression_high"=dword:00000000
"curve_compression_low"=dword:00000000
"overflow_control_strength"=dword:00000005
"twopass_max_overflow_improvement"=dword:00000005
"twopass_max_overflow_degradation"=dword:00000005
"container_type"=dword:00000001
"target_size"=dword:000a2800
"subtitle_size"=dword:00000000
"hours"=dword:00000001
"minutes"=dword:0000001e
"seconds"=dword:00000000
"fps"=dword:00000002
"audio_mode"=dword:00000000
"audio_type"=dword:00000000
"audio_rate"=dword:00000080
"audio_size"=dword:00000000
"motion_search"=dword:00000006
"vhq_mode"=dword:00000001
"vhq_metric"=dword:00000000
"vhq_bframe"=dword:00000001
"chromame"=dword:00000001
"use4mv"=dword:00000001
"turbo"=dword:00000001
"max_key_interval"=dword:0000012c
"frame_drop_ratio"=dword:00000000
"min_iquant"=dword:00000001
"max_iquant"=dword:0000001f
"min_pquant"=dword:00000001
"max_pquant"=dword:0000001f
"min_bquant"=dword:00000001
"max_bquant"=dword:0000001f
"trellis_quant"=dword:00000001
"fourcc_used"=dword:00000000
"debug"=dword:00000000
"vop_debug"=dword:00000000
"display_status"=dword:00000001
"cpu_flags"=dword:000001ff
"divx5_user_data"=dword:00000001
"num_threads"=dword:00000002
"Brightness"=dword:00000000
"Deblock_Y"=dword:00000000
"Deblock_UV"=dword:00000000
"Dering_Y"=dword:00000000
"Dering_UV"=dword:00000000
"FilmEffect"=dword:00000000
"profile"="MPEG4 Advanced Simple @ L5"
"quality"="(User defined)"
"stats"="05_OK_1.stats"
"qmatrix_intra"=hex:08,11,12,13,15,17,19,1b,11,12,13,15,17,19,1b,1c,14,15,16,\
17,18,1a,1c,1e,15,16,17,18,1a,1c,1e,20,16,17,18,1a,1c,1e,20,23,17,18,1a,1c,\
1e,20,23,26,19,1a,1c,1e,20,23,26,29,1b,1c,1e,20,23,26,29,2d
"qmatrix_inter"=hex:10,11,12,13,14,15,16,17,11,12,13,14,15,16,17,18,12,13,14,\
15,16,17,18,19,13,14,15,16,17,18,1a,1b,14,15,16,17,19,1a,1b,1c,15,16,17,18,\
1a,1b,1c,1e,16,17,18,1a,1b,1c,1e,1f,17,18,19,1b,1c,1e,1f,21
"zone0_frame"=dword:00000000
"zone0_mode"=dword:00000000
"zone0_weight"=dword:00000064
"zone0_quant"=dword:000001f4
"zone0_type"=dword:00000000
"zone0_greyscale"=dword:00000000
"zone0_chroma_opt"=dword:00000000
"zone0_bvop_threshold"=dword:00000000
"zone0_cartoon_mode"=dword:00000000
"credits_start"=dword:00000000


But this file contain a completely different value i choose.... strange...