Module: FFMpeg::VideoAdvancedOptions
- Included in:
- FFMpeg
- Defined in:
- lib/ffmpeg/video_advanced_options.rb
Instance Method Summary collapse
-
#b_frame_factor(factor) ⇒ Object
Use qp factor between P- and B-frames.
-
#b_frame_offset(offset) ⇒ Object
Use qp offset between P- and B-frames.
-
#b_frames(frames) ⇒ Object
Use ‘frames’ B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
-
#calculate_psnr ⇒ Object
Calculate PSNR of compressed frames.
-
#dct_algorithm(algorithm) ⇒ Object
Set DCT algorithm to algo.
-
#deinterlace ⇒ Object
Deinterlace pictures.
-
#dump_video_statistics(file = nil) ⇒ Object
Dump video coding statistics to ‘vstats_HHMMSS.log’ or the supplied file.
-
#enable_advanced_intra_coding ⇒ Object
Enable Advanced intra coding (h263+).
-
#enable_unlimited_motion_vector ⇒ Object
Enable Unlimited Motion Vector (h263+).
-
#error_concealment(mask) ⇒ Object
Set error concealment to bit_mask.
-
#error_resilience(number) ⇒ Object
Set error resilience to n.
-
#group_of_pictures_size(size) ⇒ Object
Set the group of pictures size.
-
#i_frame_factor(factor) ⇒ Object
Use qp factor between P- and I-frames.
-
#i_frame_offset(offset) ⇒ Object
Use qp offset between P- and I-frames.
-
#idct_algorithm(algorithm) ⇒ Object
Set IDCT algorithm to algo.
-
#initial_complexity(complexity) ⇒ Object
Use initial complexity for single pass encoding.
-
#interlacing_support ⇒ Object
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
-
#macroblock_decision_mode(mode) ⇒ Object
Macroblock decision mode.
-
#motion_estimation_method(method) ⇒ Object
Set motion estimation method to method.
-
#pixel_format(format) ⇒ Object
Set pixel format.
-
#rate_control_equation(equation) ⇒ Object
Set rate control equation (see section 3.11 FFmpeg formula evaluator) (default = tex^qComp).
-
#rate_control_override(override) ⇒ Object
Set rate control override for specific intervals.
-
#show_qp_histogram ⇒ Object
Show QP histogram.
-
#strictness(strictness) ⇒ Object
How strictly to follow the standards.
-
#swscaler_flags(flags) ⇒ Object
Set SwScaler flags (only available when compiled with swscale support).
-
#use_data_partitioning ⇒ Object
Use data partitioning (MPEG-4 only).
-
#use_four_motion_vector ⇒ Object
Use four motion vector by macroblock (MPEG-4 only).
-
#use_only_intra_frames ⇒ Object
Use only intra frames.
-
#video_bitstream_filter(filter) ⇒ Object
Bitstream filters available are “dump_extra”, “remove_extra”, “noise”, “h264_mp4toannexb”, “imxdump” and “mjpegadump”.
-
#video_discard_threshold(number) ⇒ Object
Discard threshold.
-
#video_maximum_lagrange_factor(lambda) ⇒ Object
Use max video lagrange factor (VBR).
-
#video_maximum_macroblock_scale(lambda) ⇒ Object
Use maximum macroblock quantizer scale (VBR).
-
#video_maximum_quantizer_difference(diff) ⇒ Object
Use maximum difference between the quantizer scales (VBR).
-
#video_maximum_quantizer_scale(scale) ⇒ Object
Use maximum video quantizer scale (VBR).
-
#video_minimum_lagrange_factor(lambda) ⇒ Object
Use minimum video lagrange factor (VBR).
-
#video_minimum_macroblock_scale(lambda) ⇒ Object
Use minimum macroblock quantizer scale (VBR).
-
#video_minimum_quantizer_scale(scale) ⇒ Object
Use minimum video quantizer scale (VBR).
-
#video_quantizer_scale(scale) ⇒ Object
Use fixed video quantizer scale (VBR).
-
#video_quantizer_scale_blur(blur) ⇒ Object
Use video quantizer scale blur (VBR) (range 0.0 - 1.0).
-
#video_quantizer_scale_compression(compression) ⇒ Object
Use video quantizer scale compression (VBR) (default 0.5).
Instance Method Details
#b_frame_factor(factor) ⇒ Object
Use qp factor between P- and B-frames
97 98 99 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 97 def b_frame_factor(factor) FFMpegCommand << "-b_qfactor #{factor}" end |
#b_frame_offset(offset) ⇒ Object
Use qp offset between P- and B-frames
107 108 109 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 107 def b_frame_offset(offset) FFMpegCommand << "-b_qoffset #{offset}" end |
#b_frames(frames) ⇒ Object
Use ‘frames’ B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
188 189 190 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 188 def b_frames(frames) FFMpegCommand << "-bf #{frames}" end |
#calculate_psnr ⇒ Object
Calculate PSNR of compressed frames.
242 243 244 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 242 def calculate_psnr FFMpegCommand << "-psnr" end |
#dct_algorithm(algorithm) ⇒ Object
Set DCT algorithm to algo. Available values are:
`0' FF_DCT_AUTO (default)
`1' FF_DCT_FASTINT
`2' FF_DCT_INT
`3' FF_DCT_MMX
`4' FF_DCT_MLIB
`5' FF_DCT_ALTIVEC
148 149 150 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 148 def dct_algorithm(algorithm) FFMpegCommand << "-dct_algo #{algorithm}" end |
#deinterlace ⇒ Object
Deinterlace pictures.
230 231 232 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 230 def deinterlace FFMpegCommand << "-deinterlace" end |
#dump_video_statistics(file = nil) ⇒ Object
Dump video coding statistics to ‘vstats_HHMMSS.log’ or the supplied file.
247 248 249 250 251 252 253 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 247 def dump_video_statistics(file = nil) unless file.nil? FFMpegCommand << "-vstats_file #{file}" else FFMpegCommand << "-vstats" end end |
#enable_advanced_intra_coding ⇒ Object
Enable Advanced intra coding (h263+).
220 221 222 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 220 def enable_advanced_intra_coding FFMpegCommand << "-aic" end |
#enable_unlimited_motion_vector ⇒ Object
Enable Unlimited Motion Vector (h263+)
225 226 227 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 225 def enable_unlimited_motion_vector FFMpegCommand << "-umv" end |
#error_concealment(mask) ⇒ Object
Set error concealment to bit_mask. bit_mask is a bit mask of the following values:
`1' FF_EC_GUESS_MVS (default = enabled)
`2' FF_EC_DEBLOCK (default = enabled)
183 184 185 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 183 def error_concealment(mask) FFMpegCommand << "-ec #{mask}" end |
#error_resilience(number) ⇒ Object
Set error resilience to n.
`1' FF_ER_CAREFUL (default)
`2' FF_ER_COMPLIANT
`3' FF_ER_AGGRESSIVE
`4' FF_ER_VERY_AGGRESSIVE
175 176 177 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 175 def error_resilience(number) FFMpegCommand << "-er #{number}" end |
#group_of_pictures_size(size) ⇒ Object
Set the group of pictures size.
14 15 16 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 14 def group_of_pictures_size(size) FFMpegCommand << "-g #{size}" end |
#i_frame_factor(factor) ⇒ Object
Use qp factor between P- and I-frames
102 103 104 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 102 def i_frame_factor(factor) FFMpegCommand << "-i_qfactor #{factor}" end |
#i_frame_offset(offset) ⇒ Object
Use qp offset between P- and I-frames
112 113 114 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 112 def i_frame_offset(offset) FFMpegCommand << "-i_qoffset #{offset}" end |
#idct_algorithm(algorithm) ⇒ Object
Set IDCT algorithm to algo. Available values are:
`0' FF_IDCT_AUTO (default)
`1' FF_IDCT_INT
`2' FF_IDCT_SIMPLE
`3' FF_IDCT_SIMPLEMMX
`4' FF_IDCT_LIBMPEG2MMX
`5' FF_IDCT_PS2
`6' FF_IDCT_MLIB
`7' FF_IDCT_ARM
`8' FF_IDCT_ALTIVEC
`9' FF_IDCT_SH4
`10' FF_IDCT_SIMPLEARM
165 166 167 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 165 def idct_algorithm(algorithm) FFMpegCommand << "-idct_algo #{algorithm}" end |
#initial_complexity(complexity) ⇒ Object
Use initial complexity for single pass encoding
92 93 94 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 92 def initial_complexity(complexity) FFMpegCommand << "-rc_init_cplx #{complexity}" end |
#interlacing_support ⇒ Object
Force interlacing support in encoder (MPEG-2 and MPEG-4 only). Use this option if your input file is interlaced and you want to keep the interlaced format for minimum losses. The alternative is to deinterlace the input stream with ‘-deinterlace’, but deinterlacing introduces losses.
237 238 239 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 237 def interlacing_support FFMpegCommand << "-ilme" end |
#macroblock_decision_mode(mode) ⇒ Object
Macroblock decision mode
`0' FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
`1' FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
`2' FF_MB_DECISION_RD: rate distortion
197 198 199 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 197 def macroblock_decision_mode(mode) FFMpegCommand << "-mbd #{mode}" end |
#motion_estimation_method(method) ⇒ Object
Set motion estimation method to method. Available methods are (from lowest to best quality):
`zero' - Try just the (0, 0) vector.
`phods'
`log'
`x1'
`hex'
`umh'
`epzs' - (default method)
`full' - exhaustive search (slow and marginally better than epzs)
136 137 138 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 136 def motion_estimation_method(method) FFMpegCommand << "-me_method #{method}" end |
#pixel_format(format) ⇒ Object
Set pixel format. Use ‘list’ as parameter to show all the supported pixel formats.
4 5 6 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 4 def pixel_format(format) FFMpegCommand << "-pix_fmt #{format}" end |
#rate_control_equation(equation) ⇒ Object
Set rate control equation (see section 3.11 FFmpeg formula evaluator) (default = tex^qComp).
117 118 119 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 117 def rate_control_equation(equation) FFMpegCommand << "-rc_eq string" end |
#rate_control_override(override) ⇒ Object
Set rate control override for specific intervals
122 123 124 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 122 def rate_control_override(override) FFMpegCommand << "-rc_override #{override}" end |
#show_qp_histogram ⇒ Object
Show QP histogram.
265 266 267 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 265 def show_qp_histogram FFMpegCommand << "-qphist" end |
#strictness(strictness) ⇒ Object
How strictly to follow the standards.
215 216 217 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 215 def strictness(strictness) FFMpegCommand << "-strict #{strictness}" end |
#swscaler_flags(flags) ⇒ Object
Set SwScaler flags (only available when compiled with swscale support).
9 10 11 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 9 def swscaler_flags(flags) FFMpegCommand << "-sws_flags #{flags}" end |
#use_data_partitioning ⇒ Object
Use data partitioning (MPEG-4 only).
207 208 209 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 207 def use_data_partitioning FFMpegCommand << "-part" end |
#use_four_motion_vector ⇒ Object
Use four motion vector by macroblock (MPEG-4 only).
202 203 204 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 202 def use_four_motion_vector FFMpegCommand << "-4mv" end |
#use_only_intra_frames ⇒ Object
Use only intra frames.
19 20 21 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 19 def use_only_intra_frames FFMpegCommand << "-intra" end |
#video_bitstream_filter(filter) ⇒ Object
Bitstream filters available are “dump_extra”, “remove_extra”, “noise”, “h264_mp4toannexb”, “imxdump” and “mjpegadump”.
271 272 273 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 271 def video_bitstream_filter(filter) FFMpegCommand << "-vbsf #{filter}" end |
#video_discard_threshold(number) ⇒ Object
Discard threshold.
24 25 26 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 24 def video_discard_threshold(number) FFMpegCommand << "-vdt #{number}" end |
#video_maximum_lagrange_factor(lambda) ⇒ Object
Use max video lagrange factor (VBR)
This option uses ‘lambda’ units, but you may use the QP2LAMBDA constant to easily convert from ‘q’ units:
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
71 72 73 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 71 def video_maximum_lagrange_factor(lambda) FFMpegCommand << "-lmax #{lambda}" end |
#video_maximum_macroblock_scale(lambda) ⇒ Object
Use maximum macroblock quantizer scale (VBR).
This option uses ‘lambda’ units, but you may use the QP2LAMBDA constant to easily convert from ‘q’ units:
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
87 88 89 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 87 def video_maximum_macroblock_scale(lambda) FFMpegCommand << "-mblmax #{lambda}" end |
#video_maximum_quantizer_difference(diff) ⇒ Object
Use maximum difference between the quantizer scales (VBR)
44 45 46 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 44 def video_maximum_quantizer_difference(diff) FFMpegCommand << "-qdiff #{diff}" end |
#video_maximum_quantizer_scale(scale) ⇒ Object
Use maximum video quantizer scale (VBR)
39 40 41 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 39 def video_maximum_quantizer_scale(scale) FFMpegCommand << "-qmax #{scale}" end |
#video_minimum_lagrange_factor(lambda) ⇒ Object
Use minimum video lagrange factor (VBR)
This option uses ‘lambda’ units, but you may use the QP2LAMBDA constant to easily convert from ‘q’ units:
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
63 64 65 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 63 def video_minimum_lagrange_factor(lambda) FFMpegCommand << "-lmin #{lambda}" end |
#video_minimum_macroblock_scale(lambda) ⇒ Object
Use minimum macroblock quantizer scale (VBR)
This option uses ‘lambda’ units, but you may use the QP2LAMBDA constant to easily convert from ‘q’ units:
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
79 80 81 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 79 def video_minimum_macroblock_scale(lambda) FFMpegCommand << "-mblmin #{lambda}" end |
#video_minimum_quantizer_scale(scale) ⇒ Object
Use minimum video quantizer scale (VBR)
34 35 36 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 34 def video_minimum_quantizer_scale(scale) FFMpegCommand << "-qmin #{scale}" end |
#video_quantizer_scale(scale) ⇒ Object
Use fixed video quantizer scale (VBR).
29 30 31 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 29 def video_quantizer_scale(scale) FFMpegCommand << "-qscale #{scale}" end |
#video_quantizer_scale_blur(blur) ⇒ Object
Use video quantizer scale blur (VBR) (range 0.0 - 1.0)
49 50 51 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 49 def video_quantizer_scale_blur(blur) FFMpegCommand << "-qblur #{blur}" end |
#video_quantizer_scale_compression(compression) ⇒ Object
Use video quantizer scale compression (VBR) (default 0.5). Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
55 56 57 |
# File 'lib/ffmpeg/video_advanced_options.rb', line 55 def video_quantizer_scale_compression(compression) FFMpegCommand << "-qcomp #{compression}" end |