2012-03-26 37 views
0

私はffmpegとx264でビデオをエンコードしようとしています。私はffmpegがコマンドラインからプログラムffmpegを使用するときにx264プリセットを使用できることを知っています。しかし、コード内のffmpegでエンコードするときに、これらのプリセットを簡単に使用することは可能ですか?コード内にffmpegを持つx264プリセットを使用する簡単な方法はありますか?

ffmpegコードからx264パラメータを設定する最も良い方法は何ですか? AVCodecContextのプロパティを使用しているだけですか?すべてのx264オプションはこれで利用できますか?

ありがとうございました!

答えて

0

申し訳ありませんが、私は同じ質問がありましたが、私が見つけた解決策を共有したいと思います。 はい、少なくともlibavを使用しているときは、コマンドラインとAPIを通じてx264オプションの多くを渡すことができます(今はffmpegで確認できません)。 avconv発行することによって、あなたはこれを見つけることができます--help:

libx264 AVOptions: 
-preset   <string> E.V.. Set the encoding preset (cf. x264 --fullhelp) 
-tune    <string> E.V.. Tune the encoding params (cf. x264 --fullhelp) 
-profile   <string> E.V.. Set profile restrictions (cf. x264 --fullhelp) 
-fastfirstpass  <int> E.V.. Use fast settings when encoding first pass 
-crf    <float> E.V.. Select the quality for constant quality mode 
-crf_max   <float> E.V.. In CRF mode, prevents VBV from lowering quality beyond this point. 
-qp    <int> E.V.. Constant quantization parameter rate control method 
-aq-mode   <int> E.V.. AQ method 
    none     E.V.. 
    variance    E.V.. Variance AQ (complexity mask) 
    autovariance   E.V.. Auto-variance AQ (experimental) 
-aq-strength  <float> E.V.. AQ strength. Reduces blocking and blurring in flat and textured areas. 
-psy    <int> E.V.. Use psychovisual optimizations. 
-psy-rd   <string> E.V.. Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format. 
-rc-lookahead  <int> E.V.. Number of frames to look ahead for frametype and ratecontrol 
-weightb   <int> E.V.. Weighted prediction for B-frames. 
-weightp   <int> E.V.. Weighted prediction analysis method. 
    none     E.V.. 
    simple     E.V.. 
    smart     E.V.. 
-ssim    <int> E.V.. Calculate and print SSIM stats. 
-intra-refresh  <int> E.V.. Use Periodic Intra Refresh instead of IDR frames. 
-b-bias   <int> E.V.. Influences how often B-frames are used 
-b-pyramid   <int> E.V.. Keep some B-frames as references. 
    none     E.V.. 
    strict     E.V.. Strictly hierarchical pyramid 
    normal     E.V.. Non-strict (not Blu-ray compatible) 
-mixed-refs  <int> E.V.. One reference per partition, as opposed to one reference per macroblock 
-8x8dct   <int> E.V.. High profile 8x8 transform. 
-fast-pskip  <int> E.V.. 
-aud    <int> E.V.. Use access unit delimiters. 
-mbtree   <int> E.V.. Use macroblock tree ratecontrol. 
-deblock   <string> E.V.. Loop filter parameters, in <alpha:beta> form. 
-cplxblur   <float> E.V.. Reduce fluctuations in QP (before curve compression) 
-partitions  <string> E.V.. A comma-separated list of partitions to consider. Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all 
-direct-pred  <int> E.V.. Direct MV prediction mode 
    none     E.V.. 
    spatial     E.V.. 
    temporal    E.V.. 
    auto     E.V.. 
-slice-max-size <int> E.V.. Limit the size of each slice in bytes 
-stats    <string> E.V.. Filename for 2 pass stats 

AVCodecContext構造体を使用して、あなたはまた、AVCodecContext :: rc_lookaheadに設定することができます-rc、先読みのようなこれらのオプションを設定することができますが、 - 私がわかりません約-preset。これは

0

が最初に助けることができる

希望、あなたはx264ののencodecのより正確な制御を追加するために、ffmpegのサポートx264optsとx264の-のparamsを知っている必要があります。 ":"で区切られたkey = valueリストをx264に渡します。例えば :x264のために0にBフレームを設定する平均

ffmpeg .... -x264opts bframes=0:... ... 

。この形式はx264と完全に同じではありません。

詳細チェック本:

1、ffmpge document

2、x264

関連する問題