玩玩XviD--(0)编译及基本用法
先讲讲一个有趣的故事
当初mpeg4的标准提出来后,微软最先实现了它。不过微软的代码不公开,并且只用在他自家的media player上。mpeg4视频压缩比大,图像质量好,非常适合盗版及网络共享。微软的做法激怒了广大人民。人民群众的力量是伟大的,大家发起了一个名叫divx的开源组织,破解了微软的mpeg4核心,于是乎网上铺天盖地的出现了divx格式的盗版电影。divx到版本3.11后已经占据了绝大部分的市场份额,这个时候divx的一些创办者露出了真面目,他们不再公开后继版本,并推出divx5.1收取许可费。愤怒和失望过后,开源社区剩下的人和divx的另一些创办者没有放弃,他们采用完全开源的协议,开始了重新实现mpeg4的工作。于是诞生了xvid。
看下面的链接就行,很详细,不过我没碰到这么多问题,知道去下载个nasm就行了,从来没用过nasm这玩意儿。
Visual Studio 2005 XviD编译过程
How to compile Xvid with Microsoft Visual C++
http://www.xvid.org/FAQ.42.0.html
I have problems compiling the asm files – what to do?
Make sure you have the latest version of nasm installed for your platform: http://nasm.sourceforge.net If you still get experience and you try to compile for a rather new platform you may require the latest cvs version of nasm or should try yasm instead http://www.tortall.net/projects/yasm/ If both doesn’t help you should report your problem at [email protected].
调用Xvid编码器流程(基于xvid1.1.0)
xvid静态库的封装类(编码和解码)
[PDF] XviD 应用编程接口( API )简介( v0.1 )
关于examples
xvid_encraw -type 1 -i cactus.pgm -o test.mp4u
xvid_decraw -i test.mp4u -d -c rgb32 -f tga
E:\TDDOWNLOAD\Code\XVID\xvidcore
-
1.2
.
1
\xvidcore\build\win32\bin
>
xvid_encraw
-
hel
p
xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002 - 2003
xvid_encraw built at 07 : 27 : 18 on Jan 9 2009
Usage : xvid_encraw [OPTIONS]
Input options:
- i string : input filename (stdin)
- type integer: input data type (yuv = 0 , pgm = 1 , avi / avs = 2 )
- w integer: frame width ([ 1.2048 ])
- h integer: frame height ([ 1.2048 ])
- csp string : colorspace of raw input file i420, yv12 ( default )
- frames integer: number of frames to encode
Output options:
- dump : save decoder output
- save : save an Elementary Stream file per frame
- o string : save an Elementary Stream for the complete sequence
- avi string : save an AVI file for the complete sequence
- mkv string : save a MKV file for the complete sequence
BFrames options:
- max_bframes integer: max bframes ( 2 )
- bquant_ratio integer: bframe quantizer ratio ( 150 )
- bquant_offset integer: bframe quantizer offset ( 100 )
Rate control options:
- framerate float : target framerate ( 25.0 )
- bitrate [integer] : target bitrate in kbps ( 700 )
- size integer : target size in kilobytes
- single : single pass mode ( default )
- cq float : single pass constant quantizer
- pass1 [filename] : twopass mode (first pass)
- full1pass : perform full first pass
- pass2 [filename] : twopass mode (2nd pass)
- zq starting_frame float : bitrate zone; quant
- zw starting_frame float : bitrate zone; weight
- max_key_interval integer : maximum keyframe interval ( 300 )
Single Pass options:
- reaction integer : reaction delay factor ( 16 )
- averaging integer : averaging period ( 100 )
- smoother integer : smoothing buffer ( 100 )
Second Pass options:
- kboost integer : I frame boost ( 10 )
- kthresh integer : I frame reduction threshold ( 1 )
- kreduction integer : I frame reduction amount ( 20 )
- ostrength integer : overflow control strength ( 5 )
- oimprove integer : max overflow improvement ( 5 )
- odegrade integer : max overflow degradation ( 5 )
- chigh integer : high bitrate scenes degradation ( 0 )
- clow integer : low bitrate scenes improvement ( 0 )
- overhead integer : container frame overhead ( 24 )
- vbvsize integer : use vbv buffer size
- vbvmax integer : vbv max bitrate
- vbvpeak integer : vbv peak bitrate over 1 second
Other options
- noasm : do not use assembly optmized code
- turbo : use turbo presets for higher encoding speed
- quality integer : quality ([ 0 .. 6 ]) ( 6 )
- vhqmode integer : level of R - D optimizations ([ 0 .. 4 ]) ( 1 )
- bvhq : use R - D optimizations for B - frames
- qpel : use quarter pixel ME
- gmc : use global motion compensation
- qtype integer : quantization type (H263: 0 , MPEG4: 1 ) ( 0 )
- qmatrix filename : use custom MPEG4 quantization matrix
- interlaced [integer] : interlaced encoding (BFF: 1 , TFF: 2 ) ( 1 )
- nopacked : Disable packed mode
- noclosed_gop : Disable closed GOP mode
- lumimasking : use lumimasking algorithm
- stats : print stats about encoded frames
- ssim [integer] : prints ssim for every frame (accurate: 0 fast:
4 ) ( 2 )
- ssim_file filename : outputs the ssim stats into a file
- debug : activates xvidcore internal debugging output
- vop_debug : print some info directly into encoded frames
- nochromame : Disable chroma motion estimation
- notrellis : Disable trellis quantization
- imin integer : Minimum I Quantizer ( 1 .. 31 ) ( 2 )
- imax integer : Maximum I quantizer ( 1 .. 31 ) ( 31 )
- bmin integer : Minimum B Quantizer ( 1 .. 31 ) ( 2 )
- bmax integer : Maximum B quantizer ( 1 .. 31 ) ( 31 )
- pmin integer : Minimum P Quantizer ( 1 .. 31 ) ( 2 )
- pmax integer : Maximum P quantizer ( 1 .. 31 ) ( 31 )
- drop integer : Frame Drop Ratio ( 0 .. 100 ) ( 0 )
- start integer : Starting frame number
- threads integer : Number of threads
- progress [integer] : Show progress updates every n frames ( 10 )
- par integer[:integer] : Set Pixel Aspect Ratio.
1 = 1 : 1
2 = 12 : 11 ( 4 : 3 PAL)
3 = 10 : 11 ( 4 : 3 NTSC)
4 = 16 : 11 ( 16 : 9 PAL)
5 = 40 : 33 ( 16 : 9 NTSC)
other = custom (width:height)
- help : prints this help message
NB: You can define 64 zones repeating the - z[qw] option as needed.
p
xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002 - 2003
xvid_encraw built at 07 : 27 : 18 on Jan 9 2009
Usage : xvid_encraw [OPTIONS]
Input options:
- i string : input filename (stdin)
- type integer: input data type (yuv = 0 , pgm = 1 , avi / avs = 2 )
- w integer: frame width ([ 1.2048 ])
- h integer: frame height ([ 1.2048 ])
- csp string : colorspace of raw input file i420, yv12 ( default )
- frames integer: number of frames to encode
Output options:
- dump : save decoder output
- save : save an Elementary Stream file per frame
- o string : save an Elementary Stream for the complete sequence
- avi string : save an AVI file for the complete sequence
- mkv string : save a MKV file for the complete sequence
BFrames options:
- max_bframes integer: max bframes ( 2 )
- bquant_ratio integer: bframe quantizer ratio ( 150 )
- bquant_offset integer: bframe quantizer offset ( 100 )
Rate control options:
- framerate float : target framerate ( 25.0 )
- bitrate [integer] : target bitrate in kbps ( 700 )
- size integer : target size in kilobytes
- single : single pass mode ( default )
- cq float : single pass constant quantizer
- pass1 [filename] : twopass mode (first pass)
- full1pass : perform full first pass
- pass2 [filename] : twopass mode (2nd pass)
- zq starting_frame float : bitrate zone; quant
- zw starting_frame float : bitrate zone; weight
- max_key_interval integer : maximum keyframe interval ( 300 )
Single Pass options:
- reaction integer : reaction delay factor ( 16 )
- averaging integer : averaging period ( 100 )
- smoother integer : smoothing buffer ( 100 )
Second Pass options:
- kboost integer : I frame boost ( 10 )
- kthresh integer : I frame reduction threshold ( 1 )
- kreduction integer : I frame reduction amount ( 20 )
- ostrength integer : overflow control strength ( 5 )
- oimprove integer : max overflow improvement ( 5 )
- odegrade integer : max overflow degradation ( 5 )
- chigh integer : high bitrate scenes degradation ( 0 )
- clow integer : low bitrate scenes improvement ( 0 )
- overhead integer : container frame overhead ( 24 )
- vbvsize integer : use vbv buffer size
- vbvmax integer : vbv max bitrate
- vbvpeak integer : vbv peak bitrate over 1 second
Other options
- noasm : do not use assembly optmized code
- turbo : use turbo presets for higher encoding speed
- quality integer : quality ([ 0 .. 6 ]) ( 6 )
- vhqmode integer : level of R - D optimizations ([ 0 .. 4 ]) ( 1 )
- bvhq : use R - D optimizations for B - frames
- qpel : use quarter pixel ME
- gmc : use global motion compensation
- qtype integer : quantization type (H263: 0 , MPEG4: 1 ) ( 0 )
- qmatrix filename : use custom MPEG4 quantization matrix
- interlaced [integer] : interlaced encoding (BFF: 1 , TFF: 2 ) ( 1 )
- nopacked : Disable packed mode
- noclosed_gop : Disable closed GOP mode
- lumimasking : use lumimasking algorithm
- stats : print stats about encoded frames
- ssim [integer] : prints ssim for every frame (accurate: 0 fast:
4 ) ( 2 )
- ssim_file filename : outputs the ssim stats into a file
- debug : activates xvidcore internal debugging output
- vop_debug : print some info directly into encoded frames
- nochromame : Disable chroma motion estimation
- notrellis : Disable trellis quantization
- imin integer : Minimum I Quantizer ( 1 .. 31 ) ( 2 )
- imax integer : Maximum I quantizer ( 1 .. 31 ) ( 31 )
- bmin integer : Minimum B Quantizer ( 1 .. 31 ) ( 2 )
- bmax integer : Maximum B quantizer ( 1 .. 31 ) ( 31 )
- pmin integer : Minimum P Quantizer ( 1 .. 31 ) ( 2 )
- pmax integer : Maximum P quantizer ( 1 .. 31 ) ( 31 )
- drop integer : Frame Drop Ratio ( 0 .. 100 ) ( 0 )
- start integer : Starting frame number
- threads integer : Number of threads
- progress [integer] : Show progress updates every n frames ( 10 )
- par integer[:integer] : Set Pixel Aspect Ratio.
1 = 1 : 1
2 = 12 : 11 ( 4 : 3 PAL)
3 = 10 : 11 ( 4 : 3 NTSC)
4 = 16 : 11 ( 16 : 9 PAL)
5 = 40 : 33 ( 16 : 9 NTSC)
other = custom (width:height)
- help : prints this help message
NB: You can define 64 zones repeating the - z[qw] option as needed.
E:\TDDOWNLOAD\Code\XVID\xvidcore-1.2.1\xvidcore\build\win32\bin>xvid_decraw -hel
p
xvid_decraw - raw mpeg4 bitstream decoder written by Christoph Lampert 2002-2003
Usage : xvid_decraw [OPTIONS]
Options :
-asm : use assembly optimizations (default=disabled)
-debug : debug level (debug=0)
-i string : input filename (default=stdin)
-d : save decoder output
-c csp : choose colorspace output (rgb16, rgb24, rgb32, yv12, i420)
-f format : choose output file format (tga, pnm, pgm)
-m : save mpeg4 raw stream to individual files
-help : This help message
(* means default)
p
xvid_decraw - raw mpeg4 bitstream decoder written by Christoph Lampert 2002-2003
Usage : xvid_decraw [OPTIONS]
Options :
-asm : use assembly optimizations (default=disabled)
-debug : debug level (debug=0)
-i string : input filename (default=stdin)
-d : save decoder output
-c csp : choose colorspace output (rgb16, rgb24, rgb32, yv12, i420)
-f format : choose output file format (tga, pnm, pgm)
-m : save mpeg4 raw stream to individual files
-help : This help message
(* means default)
E:\TDDOWNLOAD\Code\XVID\xvidcore
-
1.2
.
1
\xvidcore\build\win32\bin
>
xvid_encraw
-
typ
e 1 - i cactus.pgm - o test.mp4u
xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002 - 2003
Trying to retrieve width and height from input header
xvidcore build version: xvid - 1.2 . 1
Bitstream version: 1.2 . 1
Detected CPU flags: ASM MMX MMXEXT SSE SSE2 SSE3 3DNOW 3DNOWEXT TSC
Detected 2 cpus, using 2 threads.
- 1 : key = 0 , time = 16 , len = 927 | type = I, quant = 4 , len = 14366
- 1 : key = 0 , time = 16 , len = 297 | type = B, quant = 7 , len = 297
- 1 : key = 0 , time = 0 , len = - 5 | type = P, quant = 4 , len = 927
Tot: enctime(ms) = 47.00 , length(bytes) = 15590
Avg: enctime(ms) = 9.40 , fps = 106.38 , length(bytes) = 3118
I frames: 1 frames, size = 14366 / 14366 , quants = 4 / 4.00 / 4
P frames: 1 frames, size = 927 / 927 , quants = 4 / 4.00 / 4
B frames: 1 frames, size = 297 / 297 , quants = 7 / 7.00 / 7
e 1 - i cactus.pgm - o test.mp4u
xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002 - 2003
Trying to retrieve width and height from input header
xvidcore build version: xvid - 1.2 . 1
Bitstream version: 1.2 . 1
Detected CPU flags: ASM MMX MMXEXT SSE SSE2 SSE3 3DNOW 3DNOWEXT TSC
Detected 2 cpus, using 2 threads.
- 1 : key = 0 , time = 16 , len = 927 | type = I, quant = 4 , len = 14366
- 1 : key = 0 , time = 16 , len = 297 | type = B, quant = 7 , len = 297
- 1 : key = 0 , time = 0 , len = - 5 | type = P, quant = 4 , len = 927
Tot: enctime(ms) = 47.00 , length(bytes) = 15590
Avg: enctime(ms) = 9.40 , fps = 106.38 , length(bytes) = 3118
I frames: 1 frames, size = 14366 / 14366 , quants = 4 / 4.00 / 4
P frames: 1 frames, size = 927 / 927 , quants = 4 / 4.00 / 4
B frames: 1 frames, size = 297 / 297 , quants = 7 / 7.00 / 7
E:\TDDOWNLOAD\Code\XVID\xvidcore
-
1.2
.
1
\xvidcore\build\win32\bin
>
xvid_decraw
-
i t
est.mp4u - d - c rgb32 - f tga
xvid_decraw - raw mpeg4 bitstream decoder written by Christoph Lampert 2002 - 2003
Resized frame buffer to 352x240
Frame 0 : type = I, dectime(ms) = 16.0 , length(bytes) = 927
Frame 1 : type = B, dectime(ms) = 16.0 , length(bytes) = 297
Frame 2 : type = P, dectime(ms) = 0.0 , length(bytes) = 0
Avg: dectime(ms) = 10.67 , fps = 93.75 , length(bytes) = 5196
est.mp4u - d - c rgb32 - f tga
xvid_decraw - raw mpeg4 bitstream decoder written by Christoph Lampert 2002 - 2003
Resized frame buffer to 352x240
Frame 0 : type = I, dectime(ms) = 16.0 , length(bytes) = 927
Frame 1 : type = B, dectime(ms) = 16.0 , length(bytes) = 297
Frame 2 : type = P, dectime(ms) = 0.0 , length(bytes) = 0
Avg: dectime(ms) = 10.67 , fps = 93.75 , length(bytes) = 5196